Skip to content

Commit

Permalink
Fix error in AudioManager::Lose_Focus (#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
xezon authored Feb 15, 2024
1 parent c88c3ac commit 9be05c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/game/common/audio/audiomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,18 @@ Utf8String AudioManager::Prev_Track_Name(Utf8String track) const
*/
void AudioManager::Lose_Focus()
{
// BUGFIX clean up the memory leak
// WB debug printed when it occured but didn't clean up
if (m_savedVolumes != nullptr) {
captainslog_warn("deleting m_savedVolumes to prevent leaking memory!");
// #BUGFIX clean up the memory leak
// WB debug printed when it occurred but didn't clean up
delete[] m_savedVolumes;
}

m_savedVolumes = new float[4];
m_savedVolumes[0] = m_initialMusicVolume;
m_savedVolumes[1] = m_initialSoundVolume;
m_savedVolumes[2] = m_initial3DSoundVolume;
m_savedVolumes[3] = m_initialMusicVolume;
m_savedVolumes[3] = m_initialSpeechVolume;
Set_Volume(0.0f, AUDIOAFFECT_MUSIC | AUDIOAFFECT_SOUND | AUDIOAFFECT_3DSOUND | AUDIOAFFECT_SPEECH | AUDIOAFFECT_BASEVOL);
}

Expand Down

0 comments on commit 9be05c4

Please sign in to comment.