Hi CoreAudio,
I’m still quite new to Core Audio and iOS programming in general so please be merciful if this seems trivial :)
I have an app that correctly initializes, starts and use the remoteIO audio unit when the application starts (iOS 8.3). Eventually, when either leaving the active state (through the app delegate applicationWillResignActive) or
upon receiving a ‘ begin’ interruption notification (FaceTime call for example), the app stops and uninitializes the remoteIO audio unit. When the app becomes active again (through the app delegate applicationDidBecomeActive) or when the ‘end’ interruption
notification is received, the remoteIO audio unit is re initialized and started.
Everything works as expected when using this uninitialize/initialize sequence using PlayAndRecord or Playback audio
session categories, but when I use either ambient or solo ambient category, I always receive errors on the Xcode console : ERROR: [0x19946c310] >aurioc> 806: failed: '!pla' (enable 2, outf< 2 ch, 32000 Hz,
Float32, non-inter> inf< 2 ch, 0 Hz, Float32, non-inter>) when calling the AudioUnitInitialize() method on my audio unit during the ‘end’ interruption notification re initialization sequence before receiving
the delegate call applicationDidBecomeActive().
After some trials and errors I’ve found that if I add a 500ms delay just before the call to AudioUnitInitialize(), everything is fine suddenly no matter what audio session is used. I’m not exactly sure why this delay
is required in my case, and why this is only an issue with Ambient/Solo Ambient. I initially taught this might be related to the ability for app using only PlayAndRecord/Playback audio session to be able to use background audio support but here the app never
enters background mode during the ‘begin’ and ‘end’ interruptions, it only switches between active and inactive states.
Is there any known restrictions concerning calling AudioUnit API too quickly after an interruption notification or during an app inactive state when using certain audio session categories ? I tried to look in the CoreAudio
API for some way to ‘know’ if it’s ready to be used at a given time but came out empty handed.
Thanks in advance,
Arnaud
|