Skip to content

Commit

Permalink
- moved sound engine cleanup calls to own function
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Dec 9, 2019
1 parent 430a6f3 commit 5966391
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/sound/s_advsound.cpp
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions src/sound/s_sound.cpp
Expand Up @@ -68,6 +68,20 @@ void SoundEngine::Init(TArray<uint8_t> &curve)
S_SoundCurve = std::move(curve);
}

//==========================================================================
//
// SoundEngine::Clear
//
//==========================================================================

void SoundEngine::Clear()
{
StopAllChannels();
UnloadAllSounds();
GetSounds().Clear();
ClearRandoms();
}

//==========================================================================
//
// S_Shutdown
Expand Down
1 change: 1 addition & 0 deletions src/sound/s_soundinternal.h
Expand Up @@ -277,6 +277,7 @@ class SoundEngine
//
void Init(TArray<uint8_t> &sndcurve);
void InitData();
void Clear();
void Shutdown();

void StopAllChannels(void);
Expand Down

0 comments on commit 5966391

Please sign in to comment.