If my app is started and I initialise RemoteIO, and then turn on Sound Recognition (say via control centre), the RemoteIO input callback is not called thereafter, until I tear down the audio unit and set it back up. So something like the following:
RemoteIO is initialised and working, can record
Turn on Sound Recognition via Settings or control centre widget
Start recording with already-set up RemoteIO
Recording callback is never again called
Though no input callbacks are seen, kAudioOutputUnitProperty_IsRunning is reported as true, so the audio unit thinks it is active
Tear down audio unit
Set up audio unit again
Buffer size is changed, reflecting some effect on the audio session of the Sound Recognition feature
What could be going on here? Am I not handling a route change properly? There doesn’t seem to be a reliable sequence of events I can catch to know when to reset the audio unit.
The only fix I’ve found here is to hack in a timer that checks for callback activity shortly after starting recording, and resets the audio unit if no callback activity is seen. Better than nothing, but not super reliable.