feat(audio): Fix OpenAL auto detection

This commit addresses serveral bugs within the audio service where OpenAL would fail to register the output device to the mapped engine.

- Increase null safety checks for all audio backends (cubeb, sdl2, openal)
- Added failsafe for Device selection

These ensure the audio_renderer can validate calls from the OpenAL engine, Credits to Hayate Yoshida for helping Identify the issue.

Credit: Hayate Yoshida <hayate_yoshida@citron-emu.org>
Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-08-02 20:36:40 +10:00
parent b8039b4b2e
commit 45daff11c9
5 changed files with 323 additions and 106 deletions

View File

@@ -125,7 +125,13 @@ void AudioRenderer::CreateSinkStreams() {
std::string name{fmt::format("ADSP_RenderStream-{}", i)};
streams[i] =
sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render);
streams[i]->SetRingSize(4);
if (streams[i]) {
streams[i]->SetRingSize(4);
LOG_INFO(Service_Audio, "Created sink stream {} successfully", i);
} else {
LOG_ERROR(Service_Audio, "Failed to create sink stream {} - audio may be disabled", i);
}
}
}
@@ -172,6 +178,12 @@ void AudioRenderer::Main(std::stop_token stop_token) {
// Check this buffer is valid, as it may not be used.
if (command_buffer.buffer != 0) {
// Check if stream is valid before using it
if (!streams[index]) {
LOG_WARNING(Service_Audio, "Stream {} is null, skipping audio processing", index);
continue;
}
// If there are no remaining commands (from the previous list),
// this is a new command list, initialize it.
if (command_buffer.remaining_command_count == 0) {