Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[audio] hint openslES as audio driver on android to fix mute screen recording issue (#4397)

xbzk301da63a15de
diff --git a/src/audio_core/sink/sdl3_sink.cpp b/src/audio_core/sink/sdl3_sink.cpp
index 4816b17259..69558eabec 100644
--- a/src/audio_core/sink/sdl3_sink.cpp
+++ b/src/audio_core/sink/sdl3_sink.cpp
@@ -28,10 +28,18 @@ namespace {
//
// Keep in sync with cubeb_sink.cpp name.
SDL_SetHint("SDL_AUDIO_DEVICE_APP_NAME", "yuzu Latency Getter");
+#ifdef __ANDROID__
+ SDL_SetHintWithPriority(SDL_HINT_AUDIO_DRIVER, "openslES", SDL_HINT_OVERRIDE);
if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) {
+ LOG_WARNING(Audio_Sink, "OpenSL ES audio initialization failed: {}; retrying default drivers", SDL_GetError());
+ SDL_ResetHint(SDL_HINT_AUDIO_DRIVER);
+ }
+#endif
+ if (!SDL_WasInit(SDL_INIT_AUDIO) && !SDL_InitSubSystem(SDL_INIT_AUDIO)) {
LOG_CRITICAL(Audio_Sink, "SDL_InitSubSystem audio failed: {}", SDL_GetError());
return false;
}
+ LOG_INFO(Audio_Sink, "SDL audio driver: {}", SDL_GetCurrentAudioDriver());
}
return true;
}