AVAudioEngine setManualRenderingInputPCMFormat在iOS 11中不起作用

时间:2017-10-18 08:15:53

标签: ios avfoundation avaudioengine

AVAudioEngine支持在iOS 11中手动渲染,但是inputBlock永远不会在实时模式下调用,任何提示?

self.audioEngine.stop()

try! self.audioEngine.enableManualRenderingMode(.realtime, format: self.audioFormat, maximumFrameCount: 1024)

self.audioEngine.connect(self.audioEngine.inputNode, to: self.audioEngine.mainMixerNode, format: nil)

self.audioEngine.connect(self.audioEngine.mainMixerNode, to: self.audioEngine.outputNode, format: nil)

let result = self.audioEngine.inputNode.setManualRenderingInputPCMFormat(self.audioEngine.manualRenderingFormat, inputBlock: { (frameCount) -> UnsafePointer<AudioBufferList>? in

    print("in inputBlock")

    return nil

})

print(result) // always be true

try! self.audioEngine.start()

0 个答案:

没有答案