Commit 802cdabd authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent 7ceb0c54
......@@ -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"
......@@ -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()
{
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
var 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
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
......
......@@ -251,6 +251,9 @@ class SHAVAudioManager: NSObject {
audioEngine.stop()
recognitionRequest = nil
audioEngine.inputNode.removeTap(onBus: 0)
resultTxts = []
bestRestlt = ""
}
func resultRecoderTxt(_ results:[String], _ processStr:String = ""){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment