【发布时间】:2018-06-02 18:19:55
【问题描述】:
我希望有人可以在这里帮助我。我正在尝试进行基本的录音设置,但 AudioKit 让我崩溃了,我确定这是我的错,而且我做的不对。这是我的设置。在我的viewDidLoad 中,我正在像这样配置 AudioKit:
// Session settings
do {
AKSettings.bufferLength = .short
try AKSettings.setSession(category: .playAndRecord, with: .allowBluetoothA2DP)
} catch {
AKLog("Could not set session category.")
}
AKSettings.defaultToSpeaker = true
// Setup the microphone
micMixer = AKMixer(mic)
micBooster = AKBooster(micMixer)
// Load the test player
let path = Bundle.main.path(forResource: "audio1", ofType: ".wav")
let url = URL(fileURLWithPath: path!)
testPlayer = AKPlayer(url: url)
testPlayer?.isLooping = true
// Setup the test mixer
testMixer = AKMixer(testPlayer)
// Pass the output from the player AND the mic into the recorder
recordingMixer = AKMixer(testMixer, micBooster)
recorder = try? AKNodeRecorder(node: recordingMixer)
// Setup the output mixer - only pass the player NOT the mic
outputMixer = AKMixer(testMixer)
// Pass the output mixer to AudioKit
AudioKit.output = outputMixer
// Start AudioKit
do {
try AudioKit.start()
} catch {
print("AudioKit did not start! \(error)")
}
应用程序构建良好,但一旦我触发recorder.record(),应用程序就会崩溃并显示以下消息:
要求条件为假:mixingDest。
我真的不想将麦克风传递到扬声器输出,但我确实想录制它。
我希望能够通过“testPlayer”播放文件,通过扬声器听到它,同时能够记录“testPlayer”和麦克风的输出,而无需将麦克风通过扬声器。
我确信这是可行的,但我不太了解这些事情应该如何工作以知道我做错了什么。
非常感谢任何帮助!
【问题讨论】: