I use two AUGraphs in my iOS application, one for recording audio and one for playing audio. I use only one at a time. This works great if I create AUGraph instances every time I start using them.
I am trying to reuse these AUGraphs instead of creating and initializing a new instance each time every time I switch between recording and playback.
I am having problems with this because when I perform the following steps, I get an error message the next time I try to get microphone data from the I / O unit:
- schedule recording
- initialize recording schedule
- start recording schedule
- stop recording schedule
- schedule playback
- initialize the playback schedule
- start of playback schedule
- stop playback schedule
- start recording schedule
And then the call that causes the error, return code -50 (this statement works fine when you recreate the AUGraph every time):
OSStatus status = AudioUnitRender( remoteIoUnit, ioActionFlags, inTimeStamp, CB_remoteIoUnitInputElement, inNumberFrames, ioData );
Is reuse of AUGraphs even possible, and if so, how?
source share