-
Notifications
You must be signed in to change notification settings - Fork 321
Description
On iOS, miniaudio attempts to set the AudioSession to the rather aggressive value of PlayAndRecord during initialization, failling back to Playback if no microphone permission has been declared.
Either of these modes cause any other media apps such as spotify to be interrupted, which can be undesirable for players. We're able to change the category after, but the damage has already been done.
The miniaudio config allows customising which session category should be set, or if it should just be left alone. I don't think soloud needs to concern itself with exposing all the options, but it would be very useful to be able to turn off this behaviour.
I tried it out locally and it's enough to simply do this before the ma_device_init call:
ma_context_config context_config = ma_context_config_init();
context_config.coreaudio.sessionCategory = ma_ios_session_category_none;
ma_context context;
if (ma_context_init(NULL, 0, &context_config, &context) != MA_SUCCESS) {
return UNKNOWN_ERROR;
}
if (ma_device_init(&context, &config, &gDevice) != MA_SUCCESS)I strongly believe this has no other side effects, as ma_device_init seems to just craft its own default ma_context_config if one isn't passed (like the existing behaviour).
I'm happy to throw this in a PR, but we shouldn't change the default option and I'm not sure what the preferred method of passing config options into soloud is when they only apply to one optional backend (I'm using it via soloud_flutter).