iOS / android - 2 questions about audio

Hey there,

I’m writing a game in iOS/android. I’m not using SDL, but was wondering if you ever saw these two issues:

  1. iOS - if the volume is completely down when my app starts, when it is increased, the app still doesn’t play, even though in theory all of the audio is working just fine.

  2. Android - when my app is put in the background - the device closes the audio channel - and I can’t play sounds.

If you’ve handled anything like this with SDL, and have any hints, I would appreciate it. I’ve read through your code base - I notice that the Android basically proxies to the Java, and the iOS doesn’t seem to have any special case code for finding out if the audio is actually muted.

Both are perplexing.

Anyhow,
Thanks!

No, I’ve never seen either of those issues when using SDL2 core audio, it works fine for me in both Android and iOS.

Just to verify- you’ve used it on post iOS 16?

(The bug does not show up until iOS 16.)

-Tim

Yes, sound works fine for me on iOS 17.4.1 (SDL 2.30.0).

It said “great, thanks” was to short a post, so now I write: super awesome great thanks!

Thank you again rtrussell - If anyone hits this forum post while dealing with the volume iOS bug. I can confirm that AudioQueue does not suffer from the volume apple bugs that the AudioUnit does. (Also the AudioQueue implementation is simpler)

If anyone hits this post searching for the android sound in the background issue. I can confirm that the openSL implementation of audio can successfully put sound in the background, with no needed “ForegroundService” and no bridge to Java/Kt. And, yes, the google documentation is slightly incorrect - just like it always is.