浏览代码

添加发音人设置界面

jsonwang 3 年之前
父节点
当前提交
feb2241e53
共有 1 个文件被更改,包括 63 次插入1 次删除
  1. 63 1
      BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

+ 63 - 1
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -433,6 +433,18 @@ public class BFRecordScreenController: BFBaseViewController {
         return btn
     }()
     
+    // 字幕设置
+    lazy var voiceSettingBtn: UIButton = {
+        let btn = UIButton(type: .custom)
+        btn.setImage(imageInRecordScreenKit(by: "TTS"), for: .normal)
+        btn.setTitle("变声", for: .normal)
+        btn.titleLabel?.font = UIFont.systemFont(ofSize: 10)
+        btn.addTarget(self, action: #selector(voiceSetting), for: .touchUpInside)
+        btn.imageEdgeInsets = UIEdgeInsets(top: -20, left: 4, bottom: 0, right: -4)
+        btn.titleEdgeInsets = UIEdgeInsets(top: 20, left: -40, bottom: -20, right: 0)
+        return btn
+    }()
+    
     
     // 镜头反转设置
     lazy var cameraFlipBtn: UIButton = {
@@ -453,7 +465,13 @@ public class BFRecordScreenController: BFBaseViewController {
         subtitleSetting.isHidden = true
         return subtitleSetting
     }()
-
+    //变音设置面板
+    lazy var voiceSettingView: BFVoiceSettingView = {
+        let voiceSettingView = BFVoiceSettingView(frame: CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
+        voiceSettingView.isHidden = true
+        return voiceSettingView
+    }()
+ 
     // 编辑字幕
     lazy var subtitleEditView: BFSubtitleEditView = {
         let subtitleEditView = BFSubtitleEditView(frame: CGRect(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
@@ -668,9 +686,14 @@ public class BFRecordScreenController: BFBaseViewController {
 //        view.addSubview(drawPinBtn)
         view.addSubview(subtitleBtn)
         view.addSubview(soundSettingBtn)
+        if(BFLocalizedUtil.currentLanguage() == "zh"){
+            view.addSubview(voiceSettingBtn)
+        }
+   
         view.addSubview(cameraFlipBtn)
         view.addSubview(subtitleSettingView)
         view.addSubview(audioSettingView)
+        view.addSubview(voiceSettingView)
 
         bottomeView.addSubview(progreddL)
         //        view.addSubview(toolV)
@@ -745,6 +768,21 @@ public class BFRecordScreenController: BFBaseViewController {
             view.addSubview(neoNuiDebugLabel)
             view.addSubview(audioQueueRecoderLabel)
         }
+        
+        
+        voiceSettingView.voiceSettingCallBack = {[weak self] actionType ,selectVoice in
+            guard let wself = self else { return }
+            if actionType == .VoiceSettingActionConfirm{
+                BFLog(2, message: "确认发音人操作")
+                
+            }else if actionType == .voiceSettingActionCancel{
+                BFLog(2, message: "取消发音人操作")
+                
+            }else if actionType == .voiceSettingActionDelete{
+                BFLog(2, message: "删除发音人操作")
+            }
+            
+        }
     }
     
     func layoutsubview() {
@@ -809,6 +847,13 @@ public class BFRecordScreenController: BFBaseViewController {
             make.top.equalTo(soundSettingBtn.snp.bottom).offset(18)
         }
         
+        if(BFLocalizedUtil.currentLanguage() == "zh"){
+            voiceSettingBtn.snp.makeConstraints { make in
+                make.right.width.height.equalTo(subtitleBtn)
+                make.top.equalTo(subtitleBtn.snp.bottom).offset(18)
+            }
+        }
+        
         cameraFlipBtn.snp.makeConstraints { make in
             make.left.equalTo(8)
             make.top.equalTo(soundSettingBtn)
@@ -1212,6 +1257,23 @@ public class BFRecordScreenController: BFBaseViewController {
         audioSettingView.isHidden = false
     }
     
+    //变声设置
+    @objc func voiceSetting() {
+        BFLog(message: "设置变音")
+
+        voiceSettingView.isHidden = false
+        
+    
+        BFRecordScreenViewModel.getAllVoiceCates { [weak self] categorys, voices in
+            guard let wself = self else { return }
+            wself.voiceSettingView.categorys = categorys
+            wself.voiceSettingView.voices = voices
+         
+        }
+        
+      
+    }
+    
     @objc func doubleTapAction(tap:UITapGestureRecognizer) {
         if currMediaType == .Camera {
             rscmanager.cameraFlip()