mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-10 03:01:56 -04:00
Shutdown audio system upon exit (#2416)
* Shutdown audio system upon exit * Don't re-init audio unless already initialized
This commit is contained in:
@@ -107,11 +107,21 @@ void dusk::audio::Initialize() {
|
||||
}
|
||||
|
||||
void dusk::audio::Reinitialize() {
|
||||
if (InitSDL3Output()) {
|
||||
// don't re-init unless we've initialized first (using PlaybackStream being set as proxy)
|
||||
if (PlaybackStream && InitSDL3Output()) {
|
||||
SDL_ResumeAudioStreamDevice(PlaybackStream);
|
||||
}
|
||||
}
|
||||
|
||||
void dusk::audio::Shutdown() {
|
||||
if (PlaybackStream) {
|
||||
SDL_DestroyAudioStream(PlaybackStream);
|
||||
PlaybackStream = nullptr;
|
||||
}
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
|
||||
void dusk::audio::SetMasterVolume(const f32 value) {
|
||||
JASCriticalSection section;
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace dusk::audio {
|
||||
|
||||
void Reinitialize();
|
||||
|
||||
void Shutdown();
|
||||
|
||||
void SetEnableReverb(bool value);
|
||||
|
||||
void SetMasterVolume(f32 value);
|
||||
|
||||
@@ -975,6 +975,7 @@ int game_main(int argc, char* argv[]) {
|
||||
#if BOREALIS_HAS_DISCORD
|
||||
dusk::discord::shutdown();
|
||||
#endif
|
||||
dusk::audio::Shutdown();
|
||||
dusk::ui::shutdown();
|
||||
dusk::texture_replacements::shutdown();
|
||||
dusk::config::shutdown();
|
||||
|
||||
Reference in New Issue
Block a user