diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index d3c79c54c..d2f7ba0f5 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -742,12 +742,7 @@ void FPlayerSoundHashTable::MarkUsed() void S_ClearSoundData() { if (soundEngine) - { - soundEngine->StopAllChannels(); - soundEngine->UnloadAllSounds(); - soundEngine->GetSounds().Clear(); - soundEngine->ClearRandoms(); - } + soundEngine->Clear(); Ambients.Clear(); while (MusicVolumes != NULL) diff --git a/src/sound/s_sound.cpp b/src/sound/s_sound.cpp index 4fba205dc..45524533b 100644 --- a/src/sound/s_sound.cpp +++ b/src/sound/s_sound.cpp @@ -68,6 +68,20 @@ void SoundEngine::Init(TArray &curve) S_SoundCurve = std::move(curve); } +//========================================================================== +// +// SoundEngine::Clear +// +//========================================================================== + +void SoundEngine::Clear() +{ + StopAllChannels(); + UnloadAllSounds(); + GetSounds().Clear(); + ClearRandoms(); +} + //========================================================================== // // S_Shutdown diff --git a/src/sound/s_soundinternal.h b/src/sound/s_soundinternal.h index 17cf55e5b..b05c1cdd4 100644 --- a/src/sound/s_soundinternal.h +++ b/src/sound/s_soundinternal.h @@ -277,6 +277,7 @@ public: // void Init(TArray &sndcurve); void InitData(); + void Clear(); void Shutdown(); void StopAllChannels(void);