问题
I've been working on an app that makes an audio pipeline through AVAudioEngine
and then renders to a file.
I've been using this code example's approach, adapted for my own needs. The problem is that if headphones are connected to the device, the output audio file is silent. You can observe this by running that project with headphones connected.
The only idea I have is that maybe iPhone usually has a mono outputNode
, but headphones give it a stereo format. I find this stuff quite hard to debug, so any pointers are appreciated.
I got that sample code from here, which may give further context on the problem.
Thanks
回答1:
Looks like the session is set for playback. Try setting it to AVAudioSessionCategoryAudioProcessing.
来源:https://stackoverflow.com/questions/34144456/avaudioengine-offline-render-silent-output-only-when-headphones-connected