mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Ensure that all channels are halted before free
This commit is contained in:
parent
1fe84fcdf7
commit
d67010c87a
@ -2974,7 +2974,7 @@ bool CEvent::ChangePhase (Uint32 phase)
|
|||||||
|
|
||||||
// FIXME: pause is better if the game is not stop but just interrupted
|
// FIXME: pause is better if the game is not stop but just interrupted
|
||||||
if (m_phase == WM_PHASE_PLAY && m_phase != phase)
|
if (m_phase == WM_PHASE_PLAY && m_phase != phase)
|
||||||
m_pSound->StopAllSounds();
|
m_pSound->StopAllSounds (false);
|
||||||
|
|
||||||
m_phase = phase; // change de phase
|
m_phase = phase; // change de phase
|
||||||
m_index = index;
|
m_index = index;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
// Stops all sounds.
|
// Stops all sounds.
|
||||||
|
|
||||||
bool CSound::StopAllSounds()
|
bool CSound::StopAllSounds(bool immediat)
|
||||||
{
|
{
|
||||||
for (Sint32 i = 0; i < MAXSOUND; i ++)
|
for (Sint32 i = 0; i < MAXSOUND; i ++)
|
||||||
{
|
{
|
||||||
@ -17,7 +17,12 @@ bool CSound::StopAllSounds()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Mix_Playing (i + 1) == SDL_TRUE)
|
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;
|
return true;
|
||||||
@ -114,6 +119,8 @@ void CSound::CacheAll()
|
|||||||
Sint32 i;
|
Sint32 i;
|
||||||
char name[50];
|
char name[50];
|
||||||
|
|
||||||
|
this->StopAllSounds (true);
|
||||||
|
|
||||||
for (i = 0 ; i < MAXSOUND ; i++)
|
for (i = 0 ; i < MAXSOUND ; i++)
|
||||||
{
|
{
|
||||||
sprintf (name, "sound%.3d.wav", i);
|
sprintf (name, "sound%.3d.wav", i);
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
bool IsStoppedOnDemand();
|
bool IsStoppedOnDemand();
|
||||||
void AdaptVolumeMusic();
|
void AdaptVolumeMusic();
|
||||||
void SetSuspendSkip (Sint32 nb);
|
void SetSuspendSkip (Sint32 nb);
|
||||||
bool StopAllSounds();
|
bool StopAllSounds(bool immediat);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_bState;
|
bool m_bState;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user