我正在使用AudioKit创建一个实验性的iOS音频应用程序。 目前,我正在尝试一次仅在一个扬声器(左/右立体声)上录制和播放音频,但是在设置左/右立体声通道后它在两个扬声器上播放(来自设置的滑块平衡控制>一般>辅助功能>滑块左/右声道)。
实际上,我只需要在左侧或右侧Apple Airpods耳机上录制和播放音频。在辅助功能上更改左/右声道设置时。
AKSettings.bufferLength = .medium
do {
try AKSettings.setSession(category: .playAndRecord, with: .allowBluetoothA2DP)
} catch {
AKLog("Could not set session category.")
}
AKSettings.defaultToSpeaker = true
AKSettings.useBluetooth = true
// Patching
inputPlot.node = mic
micMixer = AKMixer(mic)
micBooster = AKBooster(micMixer)
// Will set the level of microphone monitoring
micBooster.gain = 1
recorder = try? AKNodeRecorder(node: micMixer)
if let file = recorder.audioFile {
player = try? AKAudioPlayer(file: file)
}
player.looping = true
player.completionHandler = playingEnded
moogLadder = AKMoogLadder(player)
mainMixer = AKMixer(moogLadder, micBooster)
AudioKit.output = mainMixer
AudioKit.start()