I am very new to iOS development and have been experimenting with a simple app over the past week that processes audio from the audio input in real time and then sends it to the output. I have made the app successfully process audio in the background by adding the following to the custom plist field in the introjucer. So far, so good.
<?xml version="1.0" encoding="UTF-8"?>
<plist>
<dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
</dict>
</plist>
Now the methods I describe from here on might not be the recommended way to do things, so please correct me . . .
To process the audio, I initialise a device manager object and register an audioCallback with it. Apple says that we are not allowed to programatically close our application, but the user will not want the application to be processing audio indefinitely. Therefore, I have added a pause button inside the app, and to stop the CPU cooking away and draining the battery, I have made the pause button do a deviceManager.closeAudioDevice () when pushed. When the user wants to restart the processing, the pause button is pushed once again resulting in a deviceManager.restartLastAudioDevice ();
Now, this little setup works just fine when debugging the app on its own, but someone tried to call me in the middle of a testing session the other day causing an app crash and I then realised that more thought was needed.
I tested some simple game apps to see how they handle audio intrusions from other apps. The game that I tested paused itself when there was an incoming phone call or when siri was activated. How would I do similar using Juce? Also, I started some music playing and then opened the game and it mixed its audio with the music in the background. This is the functionality that I’d like. I left the music playing and then started my JUCE app which stopped the music and then crashed the juce app. I guess I’m not exactly doing this correctly.
How is everyone else dealing with this kind of thing? Can anyone nudge me in the right direction? Thanks in advance folks