diff --git a/UnleashedRecomp/apu/driver/sdl2_driver.cpp b/UnleashedRecomp/apu/driver/sdl2_driver.cpp index 5c85e25..f487620 100644 --- a/UnleashedRecomp/apu/driver/sdl2_driver.cpp +++ b/UnleashedRecomp/apu/driver/sdl2_driver.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include static PPCFunc* g_clientCallback{}; @@ -29,6 +30,9 @@ static void CreateAudioDevice() g_audioDevice = SDL_OpenAudioDevice(nullptr, 0, &desired, &obtained, 0); } + if (!g_audioDevice) + LOGFN_ERROR("Failed to open audio device: {}", SDL_GetError()); + g_downMixToStereo = (obtained.channels == 2); } @@ -36,7 +40,13 @@ void XAudioInitializeSystem() { SDL_SetHint(SDL_HINT_AUDIO_CATEGORY, "playback"); SDL_SetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME, "Unleashed Recompiled"); - SDL_InitSubSystem(SDL_INIT_AUDIO); + + if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) + { + LOGFN_ERROR("Failed to init audio subsystem: {}", SDL_GetError()); + return; + } + CreateAudioDevice(); }