- moved sound engine cleanup calls to own function

https://forum.zdoom.org/viewtopic.php?t=66605#p1127457
This commit is contained in:
alexey.lysiuk 2019-12-09 16:06:41 +02:00
parent 430a6f3247
commit 5966391108
3 changed files with 16 additions and 6 deletions

View file

@ -742,12 +742,7 @@ void FPlayerSoundHashTable::MarkUsed()
void S_ClearSoundData() void S_ClearSoundData()
{ {
if (soundEngine) if (soundEngine)
{ soundEngine->Clear();
soundEngine->StopAllChannels();
soundEngine->UnloadAllSounds();
soundEngine->GetSounds().Clear();
soundEngine->ClearRandoms();
}
Ambients.Clear(); Ambients.Clear();
while (MusicVolumes != NULL) while (MusicVolumes != NULL)

View file

@ -68,6 +68,20 @@ void SoundEngine::Init(TArray<uint8_t> &curve)
S_SoundCurve = std::move(curve); S_SoundCurve = std::move(curve);
} }
//==========================================================================
//
// SoundEngine::Clear
//
//==========================================================================
void SoundEngine::Clear()
{
StopAllChannels();
UnloadAllSounds();
GetSounds().Clear();
ClearRandoms();
}
//========================================================================== //==========================================================================
// //
// S_Shutdown // S_Shutdown

View file

@ -277,6 +277,7 @@ public:
// //
void Init(TArray<uint8_t> &sndcurve); void Init(TArray<uint8_t> &sndcurve);
void InitData(); void InitData();
void Clear();
void Shutdown(); void Shutdown();
void StopAllChannels(void); void StopAllChannels(void);