- Fixed default.cbd and Makefile.mingw for current code state.

- New: Pausing the game (through any means, not just the pause key) now pauses
  sound effects as well as music. "PauseMusicInMenus" has been added as a
  MAPINFO flag to also pause the music when a menu or the console are open.


SVN r134 (trunk)
This commit is contained in:
Randy Heit 2006-05-21 02:10:16 +00:00
commit 62b7dd3efc
19 changed files with 115 additions and 35 deletions

View file

@ -75,6 +75,7 @@ struct AltSoundRenderer::Channel
SDWORD LeftVolume;
SDWORD RightVolume;
bool Looping;
bool Paused;
CRITICAL_SECTION CriticalSection;
};
@ -521,6 +522,7 @@ long AltSoundRenderer::StartSound (sfxinfo_t *sfx, int vol, int sep, int pitch,
chan->LeftVolume = left;
chan->RightVolume = right;
chan->Looping = !!looping;
chan->Paused = false;
LeaveCriticalSection (&chan->CriticalSection);
return channel + 1;
@ -541,6 +543,22 @@ void AltSoundRenderer::StopSound (long handle)
chan->Sample = NULL;
}
//==========================================================================
//
// AltSoundRenderer :: SetSfxPaused
//
//==========================================================================
void AltSoundRenderer::SetSfxPaused (bool paused)
{
if (Channels == NULL) return;
for (int i = 0; i < NumChannels; ++i)
{
Channels[i].Paused = paused;
}
}
//==========================================================================
//
// AltSoundRenderer :: IsPlayingSound
@ -857,7 +875,7 @@ void AltSoundRenderer::UpdateSound ()
for (int i = 0; i < NumChannels; ++i)
{
EnterCriticalSection (&Channels[i].CriticalSection);
if (Channels[i].Sample != NULL)
if (Channels[i].Sample != NULL && !Channels[i].Paused)
{
if (Channels[i].Sample->b16bit)
{

View file

@ -30,6 +30,9 @@ public:
// Stops a sound channel.
void StopSound (long handle);
// Pauses or resumes all sound effect channels.
void SetSfxPaused (bool paused);
// Returns true if the channel is still playing a sound.
bool IsPlayingSound (long handle);

View file

@ -739,7 +739,7 @@ long FMODSoundRenderer::StartSound3D (sfxinfo_t *sfx, float vol, int pitch, int
void FMODSoundRenderer::StopSound (long handle)
{
if (!handle ||!ChannelMap)
if (!handle || !ChannelMap)
return;
handle--;
@ -752,6 +752,16 @@ void FMODSoundRenderer::StopSound (long handle)
}
}
void FMODSoundRenderer::SetSfxPaused (bool paused)
{
for (int i = 0; i < NumChannels; ++i)
{
if (ChannelMap[i].soundID != -1)
{
FSOUND_SetPaused (ChannelMap[i].channelID, paused);
}
}
}
bool FMODSoundRenderer::IsPlayingSound (long handle)
{

View file

@ -32,6 +32,9 @@ public:
// Stops a sound channel.
void StopSound (long handle);
// Pauses or resumes all sound effect channels.
void SetSfxPaused (bool paused);
// Returns true if the channel is still playing a sound.
bool IsPlayingSound (long handle);

View file

@ -99,6 +99,9 @@ public:
// Stops a sound channel.
virtual void StopSound (long handle) = 0;
// Pauses or resumes all sound effect channels.
virtual void SetSfxPaused (bool paused) = 0;
// Returns true if the channel is still playing a sound.
virtual bool IsPlayingSound (long handle) = 0;