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
b667ec14
Commit
b667ec14
authored
Sep 29, 2020
by
zhangzhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'branch_1.0.1' of gitlab.huolea.com:lmi/shorthandmaster into branch_1.0.1
parents
210ad2e5
802cdabd
Show 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 @
b667ec14
...
@@ -29,3 +29,5 @@ let kAutoWidth = SCREEN_WIDTH / 375
...
@@ -29,3 +29,5 @@ let kAutoWidth = SCREEN_WIDTH / 375
let
kAutoHeight
=
SCREEN_HEIGHT
/
667
let
kAutoHeight
=
SCREEN_HEIGHT
/
667
let
DocumentPath
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
let
DocumentPath
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
let
RecordMp3
=
"/record.mp3"
let
RecordCaf
=
"/xbMixData.caf"
ShorthandMaster/Input/Controller/SHInputController.swift
View file @
b667ec14
...
@@ -271,7 +271,7 @@ class SHInputController: SHBaseViewController
...
@@ -271,7 +271,7 @@ class SHInputController: SHBaseViewController
// 是否有录音都传, 用它来做为唯一表示
// 是否有录音都传, 用它来做为唯一表示
self
.
dataModel
.
pathFile
=
self
.
viewModel
.
documentFilePath
+
"/recorder.mp3"
self
.
dataModel
.
pathFile
=
self
.
viewModel
.
documentFilePath
+
"/recorder.mp3"
self
.
dataModel
.
pcmPathFile
=
self
.
viewModel
.
documentFilePath
+
"/xbMixData.caf"
self
.
dataModel
.
pcmPathFile
=
self
.
viewModel
.
documentFilePath
+
RecordCaf
// 保存数据
// 保存数据
...
@@ -780,7 +780,7 @@ extension SHInputController
...
@@ -780,7 +780,7 @@ extension SHInputController
self
.
shInputView
.
bottomView
.
setUpSubviewsLocation
()
self
.
shInputView
.
bottomView
.
setUpSubviewsLocation
()
self
.
dataModel
.
pathFile
=
self
.
viewModel
.
documentFilePath
+
"/recorder.mp3"
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
mp3Path
:
String
=
DocumentPath
+
self
.
dataModel
.
pathFile
let
pcmPath
:
String
=
DocumentPath
+
self
.
dataModel
.
pcmPathFile
let
pcmPath
:
String
=
DocumentPath
+
self
.
dataModel
.
pcmPathFile
...
@@ -873,7 +873,7 @@ extension SHInputController
...
@@ -873,7 +873,7 @@ extension SHInputController
// MARK: - 播放
// MARK: - 播放
extension
SHInputController
:
AVAudioPlayerDelegate
{
extension
SHInputController
:
AVAudioPlayerDelegate
{
// "/202009291601362601/recorder.mp3"
// MARK: 初始化播放器
// MARK: 初始化播放器
func
initPlayer
()
func
initPlayer
()
{
{
...
...
ShorthandMaster/Record/SHRecordShowViewController.swift
View file @
b667ec14
...
@@ -224,7 +224,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -224,7 +224,7 @@ class SHRecordShowViewController: SHBaseViewController {
//写入
//写入
if
let
videoData
=
try
?
Data
(
contentsOf
:
URL
(
fileURLWithPath
:
model
!.
assetFileUrlPath
)){
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
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
@@ -304,7 +304,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -304,7 +304,7 @@ class SHRecordShowViewController: SHBaseViewController {
}
}
do
{
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
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
@@ -345,7 +345,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -345,7 +345,7 @@ class SHRecordShowViewController: SHBaseViewController {
//没有 先创建 有 直接拿
//没有 先创建 有 直接拿
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile_mp3
)
==
false
{
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
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
@@ -360,7 +360,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -360,7 +360,7 @@ class SHRecordShowViewController: SHBaseViewController {
// let data_wav = try Data.init(contentsOf: fileURL_wav)
// 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
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
b667ec14
...
@@ -232,8 +232,8 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -232,8 +232,8 @@ class SHRecordViewController: SHBaseViewController{
if
documentsFile
==
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
{
if
documentsFile
==
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
{
let
path
=
documentsFile
.
appending
(
time
)
let
path
=
documentsFile
.
appending
(
time
)
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
mp3_file_path
=
"/"
+
subFile
+
time
+
RecordMp3
pcm_file_path
=
"/"
+
subFile
+
time
+
"/xbMixData.caf"
pcm_file_path
=
"/"
+
subFile
+
time
+
RecordCaf
image_file_path
=
"/"
+
subFile
+
time
+
"/"
image_file_path
=
"/"
+
subFile
+
time
+
"/"
...
@@ -248,8 +248,8 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -248,8 +248,8 @@ class SHRecordViewController: SHBaseViewController{
if
exist
==
false
{
if
exist
==
false
{
let
path
=
(
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
.
appending
(
time
))
let
path
=
(
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
.
appending
(
time
))
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
mp3_file_path
=
"/"
+
subFile
+
time
+
RecordMp3
pcm_file_path
=
"/"
+
subFile
+
time
+
"/xbMixData.caf"
pcm_file_path
=
"/"
+
subFile
+
time
+
RecordCaf
image_file_path
=
"/"
+
subFile
+
time
+
"/"
image_file_path
=
"/"
+
subFile
+
time
+
"/"
...
@@ -270,7 +270,7 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -270,7 +270,7 @@ class SHRecordViewController: SHBaseViewController{
model
.
modifyDate
=
nowDate
model
.
modifyDate
=
nowDate
model
.
address
=
currentAddress
??
""
model
.
address
=
currentAddress
??
""
model
.
rename
=
currentAddress
??
""
model
.
rename
=
currentAddress
??
""
model
.
txt
=
currentTxt
??
""
;
model
.
txt
=
"
\n
"
+
(
currentTxt
??
""
)
model
.
pathFile
=
mp3_file_path
model
.
pathFile
=
mp3_file_path
model
.
pcmPathFile
=
pcm_file_path
model
.
pcmPathFile
=
pcm_file_path
model
.
during
=
seconds
model
.
during
=
seconds
...
@@ -421,7 +421,7 @@ extension SHRecordViewController{
...
@@ -421,7 +421,7 @@ extension SHRecordViewController{
}
}
do
{
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
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
...
@@ -460,7 +460,7 @@ extension SHRecordViewController{
...
@@ -460,7 +460,7 @@ extension SHRecordViewController{
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_wav
)
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_wav
)
// let data_wav = try Data.init(contentsOf: fileURL_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
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
...
...
ShorthandMaster/Record/View/SHRecordDetailsCell.swift
View file @
b667ec14
...
@@ -30,19 +30,20 @@ class SHRecordDetailsCell: UITableViewCell {
...
@@ -30,19 +30,20 @@ class SHRecordDetailsCell: UITableViewCell {
titleName
?
.
text
=
newValue
.
rename
titleName
?
.
text
=
newValue
.
rename
timeLab
?
.
text
=
Date
.
getShortTimeByStamp_record
(
timestamp
:
Int64
(
newValue
.
modifyDate
.
timeIntervalSince1970
))
timeLab
?
.
text
=
Date
.
getShortTimeByStamp_record
(
timestamp
:
Int64
(
newValue
.
modifyDate
.
timeIntervalSince1970
))
if
model
.
recordingType
==
1
{
let
txts
=
newValue
.
txt
.
components
(
separatedBy
:
"
\n
"
)
let
txts
=
newValue
.
txt
.
components
(
separatedBy
:
"
\n
"
)
let
result
=
txts
.
reduce
(
""
,
{
x
,
y
in
var
result
=
txts
.
reduce
(
""
,
{
x
,
y
in
if
x
.
length
==
0
{
if
x
.
length
==
0
{
return
x
+
y
return
x
+
y
}
else
{
}
else
{
return
x
+
"
\n
"
+
y
return
x
+
"
\n
"
+
y
}
}
})
})
txtLab
?
.
text
=
result
if
result
.
hasSuffix
(
"
\n
"
){
}
else
{
result
=
result
.
substring
(
0
,
length
:
result
.
length
-
2
)
??
""
txtLab
?
.
text
=
newValue
.
txt
}
}
txtLab
?
.
text
=
result
duringLab
?
.
text
=
countSecond
(
newValue
.
during
)
duringLab
?
.
text
=
countSecond
(
newValue
.
during
)
selectedBtn
?
.
isSelected
=
model
.
selected
selectedBtn
?
.
isSelected
=
model
.
selected
icloudBtn
?
.
isSelected
=
model
.
icloud
icloudBtn
?
.
isSelected
=
model
.
icloud
...
...
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
View file @
b667ec14
...
@@ -251,6 +251,9 @@ class SHAVAudioManager: NSObject {
...
@@ -251,6 +251,9 @@ class SHAVAudioManager: NSObject {
audioEngine
.
stop
()
audioEngine
.
stop
()
recognitionRequest
=
nil
recognitionRequest
=
nil
audioEngine
.
inputNode
.
removeTap
(
onBus
:
0
)
audioEngine
.
inputNode
.
removeTap
(
onBus
:
0
)
resultTxts
=
[]
bestRestlt
=
""
}
}
func
resultRecoderTxt
(
_
results
:[
String
],
_
processStr
:
String
=
""
){
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