Background Audio in Android w/ ofSoundStream

I’d like to have audio coming from ofSoundStream continue when the app is the background. What would be the best way to do this?

I tried commenting out the appPause() code in OFAndroidSoundStream and while the thread keeps running, the audioOut never makes it to the c++ code.

I guess the real question here is whether oF_Android runs as an Activity or can also become a BackgroundService (which is what the stock app does) …

I actually got it working, but I had to hack OF core. I can write more later about what I did. It doesn’t require a service because background audio is running in it’s own thread and will keep running when the app is paused as long as the thread isn’t stopped.

So essentially, I had to put the code where the audio thread is stopped into it’s own function and remove it from the onPause() function it’s currently in. That way I can manually pick when it stops.

Another method that work, but it causes a 1/2 second break in the audio is to call ofSoundStreamSetup in onPause() of testApp. This will recreate the audio thread after it’s been stopped.

Nice! Can’t wait to see!