小编ddp*_*ddp的帖子

iOS:处理来自AVPlayer视频轨道的音频

我打算在我的iOS应用程序中重构我的录音系统.背景:到目前为止,我分别录制视频和音频,同时开始大致录制.一旦完成记录,同样的系统,我分别播放视频和音频,在音频上动态应用AudioUnits.最后,我合并了视频和修改过的音频.碰巧两个记录不会同时启动(出于任何原因),从而产生不同步的结果.

是否可以像这样重构我的系统:

1) Record normal video with audio into mov file --> I would be sure that audio+video would be synchronized.

2) During viewing the result with AVPlayer, process the audio part on the fly. (I will use AudioKit) --> that's the part I m not confident. 
   Would I be able to send the audio buffer to Audiokit (which would process it) and give back the processed audio to AVPlayer like if it was the original AVPlayer audio part?

3) …
Run Code Online (Sandbox Code Playgroud)

video audiounit ios avplayer audiokit

4
推荐指数
1
解决办法
736
查看次数

AKAudioPlayer:扬声器没有声音,只有耳机

使用AudioKit进行声音管理,我注意到这个非常简单的代码问题(bug?).

import AudioKit

class MainViewController: UIViewController {

var audioFile: AKAudioFile?
var audioPlayer: AKAudioPlayer?

override func viewDidLoad() {
    super.viewDidLoad()
}

@IBAction func onPlayButtonClick(_ sender: Any) {

    do {
        audioFile = try AKAudioFile(forReading: Bundle.main.url(forResource: "3e", withExtension: "mp3")!)

        audioPlayer = try AKAudioPlayer(file: audioFile!)

        AudioKit.output = audioPlayer
        AudioKit.start()

        audioPlayer!.play()


    } catch {
        print(error)
    }
}
}
Run Code Online (Sandbox Code Playgroud)

使用play()方法启动播放时,日志和进程中的所有内容都是正常的(播放器持续时间,currentTime).但是我没有听到扬声器中的音频(只有一种风噪声).一旦我插入耳机并再次点击按钮,我通常会听到音频.然后,我拔下我的耳机并点击按钮,我听不到音频(只有风声).

我在iPhone 5S上面对此问题.

我在iPad5上没有面对这个问题,我在模拟器上没有面对这个问题.我没有其他设备尝试重现.

两种设备:iOS 11.1.2和AudioKit:v4.0.4

注意:我的扬声器与任何其他应用程序正常工作,我已经检查了音量.未插入耳机时,默认outputDevice设置为Speakers.

core-audio audiounit audiokit

2
推荐指数
1
解决办法
548
查看次数

init let变量基于布尔值

我使用Swift 3,我想基于布尔值初始化一个String let变量.我知道如何使用带有var变量但不是单行表达式的标准if语句来完成它.

使用Java我会做:

String str = myBool ? "John" : "Peter";
Run Code Online (Sandbox Code Playgroud)

是否有与Swift 3等效的不使用var并以单行方式?

immutability variable-initialization swift

1
推荐指数
1
解决办法
77
查看次数