一起使用AKNodeOutputPlot和AKNodeRecorder时崩溃

时间:2019-07-26 02:48:12

标签: audiokit

我正在尝试在显示波形时进行记录。这是我的代码

AudioKit.output = AKBooster(gain: 0)
try! AudioKit.start()


audioInputPlot = EZAudioPlot(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 100))
let plot = AKNodeOutputPlot(mic, frame: audioInputPlot.bounds)
plot.translatesAutoresizingMaskIntoConstraints = false
plot.plotType = .rolling
plot.color = UIColor.blue
audioInputPlot.addSubview(plot)

recorder = try! AKNodeRecorder(node: mic)
try! recorder.record()

我一开始尝试记录,便会崩溃

由于未捕获的异常'com.apple.coreaudio.avfaudio'而终止应用程序,原因:'所需条件为假:nullptr == Tap()'

任何帮助都会很棒!

1 个答案:

答案 0 :(得分:1)

图和记录器均使用抽头功能,每个节点只能抽头一次。如果要记录要绘制的相同内容,请将麦克风发送到调音台,然后在绘制麦克风时将调音台录音出去,反之亦然。

mixer = AKMixer()
...
mic >>> mixer >>> booster
...
recorder = try! AKNodeRecorder(node: mixer)