-
Notifications
You must be signed in to change notification settings - Fork 70
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
Fix for audio problems on Nintendo Switch after resuming from suspend #382
Conversation
…o problems The problem is that audio becomes "crunchy/laggy" as described in Shipwright issue 3317 (HarbourMasters/Shipwright#3317). The specific fix here is somewhat overbroad and reinitializes SDL audio whenever the application gains focus, but I haven't seen any noticable side effects.
7f4b96a
to
ae12006
Compare
Can this get reviewed/merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDLAudioPlayer's destructor should then be the one to call SDL_QuitSubSystem(SDL_INIT_AUDIO);
LUS::Switch::ApplyOverclock(); | ||
// reinitialize audio subsystem to fix audio problems after resuming from sleep | ||
// see https://github.com/HarbourMasters/Shipwright/issues/3317 | ||
LUSLOG_INFO("%s", "restarting SDL audio system to work around audio problems on resume"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LUSLOG_INFO("%s", "restarting SDL audio system to work around audio problems on resume"); | |
SPDLOG_INFO("restarting SDL audio system to work around audio problems on resume"); |
SDL_QuitSubSystem(SDL_INIT_AUDIO); | ||
LUS::Context::GetInstance()->GetAudio()->GetAudioPlayer()->Init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDL_QuitSubSystem(SDL_INIT_AUDIO); | |
LUS::Context::GetInstance()->GetAudio()->GetAudioPlayer()->Init(); | |
LUS::Context::GetInstance()->GetAudio()->SetAudioBackend(AudioBackend::SDL); |
@nusgart Thank you so much for this PR! In order to get this into the next SoH bugfix release it needed to point to the I made sure to list you as a co-author on the commit so you will still have credit in the git history. Thanks again for figuring this one out! It's always wonderful to see people coming up with bugfixes! |
@briaguya-ai No problem, I've been busy with work for the past few days, so thank you for getting this resolved. Honestly, I just wanted the problem fixed and just implemented the suggestions in the linked issue (actually it might have been in one of the dupes). The credit is appreciated but it would have been fine either way. |
The problem is that audio becomes "crunchy/laggy" as described in Shipwright issue 3317 (HarbourMasters/Shipwright#3317). The specific fix here is somewhat overbroad and reinitializes SDL audio whenever the application gains focus, but I haven't seen any noticeable side effects.