Using an external mic on an iPod Touch with FMOD recording works fine if the mic is plugged in before the application starts. I’m having some trouble in this situation:
Mic is plugged in and application starts.
– everything is working fine at this point.
User unplugs the mic.
– I capture the event via Apple’s AudioSessionAddPropertyListener function.
– When the event fires, I tell FMOD to disable recording and free record buffers.
– After recording is stopped and buffers are freed, this is printed by FMOD –
FMOD: handleInterruption : Audio has been interrupted by an external event… stopping output.
User plugs the mic back in.
– AudioSessionAddPropertyListener callback fires again.
– I ask FMOD to start recording again. This returns an error.
– This is printed by FMOD –
FMOD: OutputCoreAudio::recordStart : Cannot initialize audio device. (err: 0)
Is there some trick to this or additional information I need to be able to restart recording in this situation?
This is also notable: I can’t roll my device firmware back to test this but I swear this code was working in OS 3.0 beta 5. I recently upgraded to OS 3.0 GM.
- Guile0 asked 8 years ago
I am actually working on this exact situation at the moment. Once I am finished you won’t need to use the property listener. Recording will pause if there is no input device available (i.e. mic was unplugged) then it will resume when the mic is reattached.
I will let you know when this has been finished and is working properly.
Ok I have implemented the changes, they will be available with our next release (probably towards the end of the week). The recording will pause when you unplug a recording device if there are no other recording devices available. It will un-pause when you reinsert a recording cable device. Recording will also pause (not stop) when an interruption occurs now (like a phone call or alarm).
You may still hook the property listener for route change information, just don’t perform any FMOD functions in that callback as it will all be handled now.
I’m playing out of the looping record buffer as well – a live mic that plays its input through the speakers. Will I need to stop playback of the channel when the mic is disconnected and replay it when it is connected or will that be handled automatically?
For my app it’s important to keep the playback latency as low as possible so I may need to reset the playback head when it is reconnected to ensure that.
Please login first to submit.