diff --git a/src/event.cxx b/src/event.cxx index cf930e6..a61dc56 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -2974,7 +2974,7 @@ bool CEvent::ChangePhase (Uint32 phase) // FIXME: pause is better if the game is not stop but just interrupted if (m_phase == WM_PHASE_PLAY && m_phase != phase) - m_pSound->StopAllSounds(); + m_pSound->StopAllSounds (false); m_phase = phase; // change de phase m_index = index; diff --git a/src/sound.cxx b/src/sound.cxx index a085b69..cbd75dc 100644 --- a/src/sound.cxx +++ b/src/sound.cxx @@ -9,7 +9,7 @@ // Stops all sounds. -bool CSound::StopAllSounds() +bool CSound::StopAllSounds(bool immediat) { for (Sint32 i = 0; i < MAXSOUND; i ++) { @@ -17,7 +17,12 @@ bool CSound::StopAllSounds() continue; if (Mix_Playing (i + 1) == SDL_TRUE) - Mix_FadeOutChannel (i + 1, 500); + { + if (immediat) + Mix_HaltChannel (i + 1); + else + Mix_FadeOutChannel (i + 1, 500); + } } return true; @@ -114,6 +119,8 @@ void CSound::CacheAll() Sint32 i; char name[50]; + this->StopAllSounds (true); + for (i = 0 ; i < MAXSOUND ; i++) { sprintf (name, "sound%.3d.wav", i); diff --git a/src/sound.h b/src/sound.h index 052ef09..7e6fca5 100644 --- a/src/sound.h +++ b/src/sound.h @@ -43,7 +43,7 @@ public: bool IsStoppedOnDemand(); void AdaptVolumeMusic(); void SetSuspendSkip (Sint32 nb); - bool StopAllSounds(); + bool StopAllSounds(bool immediat); protected: bool m_bState;