-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL backend broken on Android #1021
Comments
Btw. I tried
but it doesn't make any difference. |
Currently the SDL backend doesn't allow changing the output rate, since the output is created when the device is opened, before getting configuration info, and isn't able to be reset during context creation so it stays with the configuration it had. This can be fixed to reopen the device with a new configuration, but risks causing a failure if the device can't be reopened for some reason, as the device it had would be closed and it couldn't keep the old configuration. What do you mean by the sound being "broken"? It doesn't open/initialize? It's completely garbled? Occasional clicking? OpenAL Soft does open the device with the flags indicating the sample rate can be changed if needed, so it shouldn't fail for an unsupported sample rate. |
Here are two recorded videos. The only difference is default output rate 44100 vs 48000. It does initialize and plays something but it's not what should be played. It's more like a crackling sounds. 44100.mp448000.mp4 |
The underlying issue would likely be an SDL or phone problem. OpenAL Soft requests a particular sample rate, and specifies the sample rate can be changed as needed. SDL succeeds and reports it set the requested sample rate, indicating either the underlying device accepted the requested sample rate, or SDL put its own resampler in between OpenAL Soft and the underlying device, in which case the audio problems stem from there. That said, with commit efd2e8f the SDL backend should try to reopen the device when trying to reconfigure the device, so specifying a frequency during context creation should make it try to use the requested rate. You'd need to query it afterward from the device to tell what was actually set in case it needed to be changed. |
I just checked and with current git openal it works fine when I set ALC_FREQUENCY to 44100 during context creation. Hard to tell if it's a problem with a phone or with SDL. I tried with two phones:
Maybe SDL doesn't check supported frequencies or ignores requested frequency or so... I never looked at this part of SDL code. |
We use OpenAL + SDL in MultiCraft on Android. In current OpenAL version the sound is broken. I need manually change DEFAULT_OUTPUT_RATE to 44100 to make it working.
I wonder if it's possible to change output rate with some functions during openal initialization?
Tested with OpenAL 1.23.1 and SDL 2.30.3. With OpenAL 1.22.2 it works fine without any changes.
The text was updated successfully, but these errors were encountered: