Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
ShorthandMaster
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmj
ShorthandMaster
Commits
802cdabd
Commit
802cdabd
authored
Sep 29, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
7ceb0c54
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
26 deletions
+32
-26
CRConstants.swift
ShorthandMaster/Contstants/CRConstants.swift
+2
-0
SHInputController.swift
ShorthandMaster/Input/Controller/SHInputController.swift
+3
-3
SHRecordShowViewController.swift
ShorthandMaster/Record/SHRecordShowViewController.swift
+4
-4
SHRecordViewController.swift
ShorthandMaster/Record/SHRecordViewController.swift
+7
-7
SHRecordDetailsCell.swift
ShorthandMaster/Record/View/SHRecordDetailsCell.swift
+13
-12
SHAVAudioManager.swift
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
+3
-0
No files found.
ShorthandMaster/Contstants/CRConstants.swift
View file @
802cdabd
...
...
@@ -29,3 +29,5 @@ let kAutoWidth = SCREEN_WIDTH / 375
let
kAutoHeight
=
SCREEN_HEIGHT
/
667
let
DocumentPath
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
let
RecordMp3
=
"/record.mp3"
let
RecordCaf
=
"/xbMixData.caf"
ShorthandMaster/Input/Controller/SHInputController.swift
View file @
802cdabd
...
...
@@ -272,7 +272,7 @@ class SHInputController: SHBaseViewController
// 是否有录音都传, 用它来做为唯一表示
self
.
dataModel
.
pathFile
=
self
.
viewModel
.
documentFilePath
+
"/recorder.mp3"
self
.
dataModel
.
pcmPathFile
=
self
.
viewModel
.
documentFilePath
+
"/xbMixData.caf"
self
.
dataModel
.
pcmPathFile
=
self
.
viewModel
.
documentFilePath
+
RecordCaf
// 保存数据
...
...
@@ -781,7 +781,7 @@ extension SHInputController
self
.
shInputView
.
bottomView
.
setUpSubviewsLocation
()
self
.
dataModel
.
pathFile
=
self
.
viewModel
.
documentFilePath
+
"/recorder.mp3"
self
.
dataModel
.
pcmPathFile
=
self
.
viewModel
.
documentFilePath
+
"/xbMixData.caf"
self
.
dataModel
.
pcmPathFile
=
self
.
viewModel
.
documentFilePath
+
RecordCaf
let
mp3Path
:
String
=
DocumentPath
+
self
.
dataModel
.
pathFile
let
pcmPath
:
String
=
DocumentPath
+
self
.
dataModel
.
pcmPathFile
...
...
@@ -874,7 +874,7 @@ extension SHInputController
// MARK: - 播放
extension
SHInputController
:
AVAudioPlayerDelegate
{
// "/202009291601362601/recorder.mp3"
// MARK: 初始化播放器
func
initPlayer
()
{
...
...
ShorthandMaster/Record/SHRecordShowViewController.swift
View file @
802cdabd
...
...
@@ -224,7 +224,7 @@ class SHRecordShowViewController: SHBaseViewController {
//写入
if
let
videoData
=
try
?
Data
(
contentsOf
:
URL
(
fileURLWithPath
:
model
!.
assetFileUrlPath
)){
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
RecordMp3
)
!
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
...
@@ -304,7 +304,7 @@ class SHRecordShowViewController: SHBaseViewController {
}
do
{
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
RecordMp3
)
!
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
...
@@ -345,7 +345,7 @@ class SHRecordShowViewController: SHBaseViewController {
//没有 先创建 有 直接拿
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile_mp3
)
==
false
{
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
RecordMp3
)
!
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
...
@@ -360,7 +360,7 @@ class SHRecordShowViewController: SHBaseViewController {
// let data_wav = try Data.init(contentsOf: fileURL_wav)
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
RecordMp3
)
!
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
802cdabd
...
...
@@ -232,8 +232,8 @@ class SHRecordViewController: SHBaseViewController{
if
documentsFile
==
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
{
let
path
=
documentsFile
.
appending
(
time
)
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
pcm_file_path
=
"/"
+
subFile
+
time
+
"/xbMixData.caf"
mp3_file_path
=
"/"
+
subFile
+
time
+
RecordMp3
pcm_file_path
=
"/"
+
subFile
+
time
+
RecordCaf
image_file_path
=
"/"
+
subFile
+
time
+
"/"
...
...
@@ -248,8 +248,8 @@ class SHRecordViewController: SHBaseViewController{
if
exist
==
false
{
let
path
=
(
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
.
appending
(
time
))
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
pcm_file_path
=
"/"
+
subFile
+
time
+
"/xbMixData.caf"
mp3_file_path
=
"/"
+
subFile
+
time
+
RecordMp3
pcm_file_path
=
"/"
+
subFile
+
time
+
RecordCaf
image_file_path
=
"/"
+
subFile
+
time
+
"/"
...
...
@@ -270,7 +270,7 @@ class SHRecordViewController: SHBaseViewController{
model
.
modifyDate
=
nowDate
model
.
address
=
currentAddress
??
""
model
.
rename
=
currentAddress
??
""
model
.
txt
=
currentTxt
??
""
;
model
.
txt
=
"
\n
"
+
(
currentTxt
??
""
)
model
.
pathFile
=
mp3_file_path
model
.
pcmPathFile
=
pcm_file_path
model
.
during
=
seconds
...
...
@@ -421,7 +421,7 @@ extension SHRecordViewController{
}
do
{
let
range
:
Range
=
currentModel
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
range
:
Range
=
currentModel
!.
pathFile
.
range
(
of
:
RecordMp3
)
!
let
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
...
...
@@ -460,7 +460,7 @@ extension SHRecordViewController{
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_wav
)
// let data_wav = try Data.init(contentsOf: fileURL_wav)
let
range
:
Range
=
currentModel
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
range
:
Range
=
currentModel
!.
pathFile
.
range
(
of
:
RecordMp3
)
!
let
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
...
...
ShorthandMaster/Record/View/SHRecordDetailsCell.swift
View file @
802cdabd
...
...
@@ -30,19 +30,20 @@ class SHRecordDetailsCell: UITableViewCell {
titleName
?
.
text
=
newValue
.
rename
timeLab
?
.
text
=
Date
.
getShortTimeByStamp_record
(
timestamp
:
Int64
(
newValue
.
modifyDate
.
timeIntervalSince1970
))
if
model
.
recordingType
==
1
{
let
txts
=
newValue
.
txt
.
components
(
separatedBy
:
"
\n
"
)
let
result
=
txts
.
reduce
(
""
,
{
x
,
y
in
if
x
.
length
==
0
{
return
x
+
y
}
else
{
return
x
+
"
\n
"
+
y
}
})
txtLab
?
.
text
=
result
}
else
{
txtLab
?
.
text
=
newValue
.
txt
let
txts
=
newValue
.
txt
.
components
(
separatedBy
:
"
\n
"
)
var
result
=
txts
.
reduce
(
""
,
{
x
,
y
in
if
x
.
length
==
0
{
return
x
+
y
}
else
{
return
x
+
"
\n
"
+
y
}
})
if
result
.
hasSuffix
(
"
\n
"
){
result
=
result
.
substring
(
0
,
length
:
result
.
length
-
2
)
??
""
}
txtLab
?
.
text
=
result
duringLab
?
.
text
=
countSecond
(
newValue
.
during
)
selectedBtn
?
.
isSelected
=
model
.
selected
icloudBtn
?
.
isSelected
=
model
.
icloud
...
...
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
View file @
802cdabd
...
...
@@ -251,6 +251,9 @@ class SHAVAudioManager: NSObject {
audioEngine
.
stop
()
recognitionRequest
=
nil
audioEngine
.
inputNode
.
removeTap
(
onBus
:
0
)
resultTxts
=
[]
bestRestlt
=
""
}
func
resultRecoderTxt
(
_
results
:[
String
],
_
processStr
:
String
=
""
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment