mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 09:39:33 +01:00
Android: Use OpenSL ES for audio on TVs, add audio API and MMAP settings
An Android 11 TV played nothing over a Bluetooth headset since the switch to Oboe, while its speakers worked. Testing on it showed AAudio with MMAP is silent there and AAudio without MMAP works, as does OpenSL ES (also when the headset is connected mid-game), whatever the stream usage. MMAP should never be used for a Bluetooth route, so it's a firmware bug. Audio settings get an Audio API choice and a Low-latency audio (MMAP) checkbox, with hints, so other devices with the same kind of bug can be worked around. The API defaults to OpenSL ES on TVs and before Android 8.1, where the choice isn't offered, and AAudio elsewhere. Changing them reopens the streams right away. System Information shows the output stream that got opened (API, MMAP or not, rate, buffers, device) and any audio error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b438655479
commit
a5c90b61df
8 files changed
+129
-12
No files matched your search
@@ -792,6 +792,23 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
CheckBox *extraAudio = audioBackendSettings->Add(new CheckBox(&g_Config.bExtraAudioBuffering, a->T("AudioBufferingForBluetooth", "Bluetooth-friendly buffer (slower)")));
|
||||
|
||||
auto restartAudio = [](UI::EventParams &) {
|
||||
AndroidAudio_Restart(g_audioState);
|
||||
};
|
||||
// AAudio isn't stable before Android 8.1, so there it's always OpenSL ES.
|
||||
if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 27) {
|
||||
static const char *audioApis[] = { "AAudio", "OpenSL ES" };
|
||||
PopupMultiChoice *audioApi = audioBackendSettings->Add(new PopupMultiChoice(&g_Config.iAndroidAudioApi, a->T("Audio API"), audioApis, 0, ARRAY_SIZE(audioApis), I18NCat::AUDIO, screenManager()));
|
||||
audioApi->OnChoice.Add(restartAudio);
|
||||
audioBackendSettings->Add(new SettingHint(a->T("AudioApiHint", "Try the other one if you have no sound or other audio problems."), audioApi));
|
||||
|
||||
CheckBox *mmap = audioBackendSettings->Add(new CheckBox(&g_Config.bAndroidAudioMMap, a->T("Low-latency audio (MMAP)")));
|
||||
mmap->OnClick.Add(restartAudio);
|
||||
mmap->SetEnabledFunc([]() {
|
||||
return g_Config.iAndroidAudioApi == (int)AndroidAudioApi::AAUDIO;
|
||||
});
|
||||
audioBackendSettings->Add(new SettingHint(a->T("AudioMMapHint", "Lowest audio delay. On some devices, it causes silence over Bluetooth or other connected audio devices. Turn it off if you get no sound."), mmap));
|
||||
}
|
||||
// Show Oboe debug info
|
||||
const std::string audioErrorStr = AndroidAudio_GetErrorString(g_audioState);
|
||||
if (!audioErrorStr.empty()) {
|
||||
|
||||
Reference in new issue
Block a user