mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Merge pull request #10 from blupi-games/issue/9-sound
Remove fade on jingles (win and lost)
This commit is contained in:
commit
81cd5e2d9b
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <set>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -3031,7 +3032,10 @@ 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 == EV_PHASE_PLAY && m_phase != phase)
|
if (m_phase == EV_PHASE_PLAY && m_phase != phase)
|
||||||
m_pSound->StopAllSounds (false);
|
{
|
||||||
|
static const std::set<Sint32> except = {SOUND_WIN, SOUND_LOST};
|
||||||
|
m_pSound->StopAllSounds (false, &except);
|
||||||
|
}
|
||||||
|
|
||||||
m_phase = phase; // change de phase
|
m_phase = phase; // change de phase
|
||||||
m_index = index;
|
m_index = index;
|
||||||
|
@ -28,13 +28,16 @@
|
|||||||
// Stops all sounds.
|
// Stops all sounds.
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CSound::StopAllSounds (bool immediat)
|
CSound::StopAllSounds (bool immediat, const std::set<Sint32> * except)
|
||||||
{
|
{
|
||||||
for (Sint32 i = 0; i < MAXSOUND; i++)
|
for (Sint32 i = 0; i < MAXSOUND; i++)
|
||||||
{
|
{
|
||||||
if (!m_lpSDL[i])
|
if (!m_lpSDL[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (except && except->find (i) != except->end ())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (Mix_Playing (i + 1) == SDL_TRUE)
|
if (Mix_Playing (i + 1) == SDL_TRUE)
|
||||||
{
|
{
|
||||||
if (immediat)
|
if (immediat)
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL2/SDL_mixer.h>
|
#include <set>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <SDL2/SDL_mixer.h>
|
||||||
|
|
||||||
#include "blupi.h"
|
#include "blupi.h"
|
||||||
|
|
||||||
#define MAXSOUND 100
|
#define MAXSOUND 100
|
||||||
@ -63,7 +65,7 @@ public:
|
|||||||
bool IsStoppedOnDemand ();
|
bool IsStoppedOnDemand ();
|
||||||
void AdaptVolumeMusic ();
|
void AdaptVolumeMusic ();
|
||||||
void SetSuspendSkip (Sint32 nb);
|
void SetSuspendSkip (Sint32 nb);
|
||||||
bool StopAllSounds (bool immediat);
|
bool StopAllSounds (bool immediat, const std::set<Sint32> * except = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_bState;
|
bool m_bState;
|
||||||
@ -78,5 +80,3 @@ protected:
|
|||||||
Sint32 m_lastMidiVolume;
|
Sint32 m_lastMidiVolume;
|
||||||
Sint32 m_nbSuspendSkip;
|
Sint32 m_nbSuspendSkip;
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user