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()