- Because setting a DSP unit inactive completely ceases all processing on it, including timing,

sounds queued up while the Channel Group Target Unit is inactive will all play at the same time
  once the unit is made active. To avoid this, it is now only deactivated when the gamestate is
  GS_LEVEL. Otherwise, it just gets muted. Fixes http://forum.zdoom.org/viewtopic.php?f=2&t=33592 "Strife voices overlap"

SVN r3818 (trunk)
This commit is contained in:
Randy Heit 2012-08-10 03:49:50 +00:00
parent 718d3f8d43
commit 3ddac32b4f
5 changed files with 48 additions and 7 deletions

View file

@ -1764,7 +1764,7 @@ void S_SetSoundPaused (int state)
S_ResumeSound(true);
if (GSnd != NULL)
{
GSnd->SetInactive(false);
GSnd->SetInactive(SoundRenderer::INACTIVE_Active);
}
if (!netgame
#ifdef _DEBUG
@ -1783,7 +1783,9 @@ void S_SetSoundPaused (int state)
S_PauseSound(false, true);
if (GSnd != NULL)
{
GSnd->SetInactive(true);
GSnd->SetInactive(gamestate == GS_LEVEL ?
SoundRenderer::INACTIVE_Complete :
SoundRenderer::INACTIVE_Mute);
}
if (!netgame
#ifdef _DEBUG

View file

@ -672,6 +672,7 @@ bool FMODSoundRenderer::Init()
PrevEnvironment = DefaultEnvironments[0];
DSPClock.AsOne = 0;
ChannelGroupTargetUnit = NULL;
ChannelGroupTargetUnitOutput = NULL;
SfxReverbHooked = false;
SfxReverbPlaceholder = NULL;
OutputPlugin = 0;
@ -1155,6 +1156,15 @@ bool FMODSoundRenderer::Init()
{
ChannelGroupTargetUnit = NULL;
}
else
{
FMOD::DSP *dontcare;
result = ChannelGroupTargetUnit->getOutput(0, &dontcare, &ChannelGroupTargetUnitOutput);
if (result != FMOD_OK)
{
ChannelGroupTargetUnitOutput = NULL;
}
}
}
}
@ -2123,11 +2133,33 @@ void FMODSoundRenderer::SetSfxPaused(bool paused, int slot)
//
//==========================================================================
void FMODSoundRenderer::SetInactive(bool inactive)
void FMODSoundRenderer::SetInactive(SoundRenderer::EInactiveState inactive)
{
float mix;
bool active;
if (inactive == INACTIVE_Active)
{
mix = 1;
active = true;
}
else if (inactive == INACTIVE_Complete)
{
mix = 1;
active = false;
}
else // inactive == INACTIVE_Mute
{
mix = 0;
active = true;
}
if (ChannelGroupTargetUnitOutput != NULL)
{
ChannelGroupTargetUnitOutput->setMix(mix);
}
if (ChannelGroupTargetUnit != NULL)
{
ChannelGroupTargetUnit->setActive(!inactive);
ChannelGroupTargetUnit->setActive(active);
}
}

View file

@ -49,7 +49,7 @@ public:
void SetSfxPaused (bool paused, int slot);
// Pauses or resumes *every* channel, including environmental reverb.
void SetInactive (bool inactive);
void SetInactive (EInactiveState inactive);
// Updates the position of a sound channel.
void UpdateSoundParams3D (SoundListener *listener, FISoundChannel *chan, bool areasound, const FVector3 &pos, const FVector3 &vel);
@ -107,6 +107,7 @@ private:
FMOD::ChannelGroup *MusicGroup;
FMOD::DSP *WaterLP, *WaterReverb;
FMOD::DSPConnection *SfxConnection;
FMOD::DSPConnection *ChannelGroupTargetUnitOutput;
FMOD::DSP *ChannelGroupTargetUnit;
FMOD::DSP *SfxReverbPlaceholder;
bool SfxReverbHooked;

View file

@ -199,7 +199,7 @@ public:
}
// Pauses or resumes *every* channel, including environmental reverb.
void SetInactive(bool inactive)
void SetInactive(SoundRenderer::EInactiveState inactive)
{
}

View file

@ -126,7 +126,13 @@ public:
virtual void SetSfxPaused (bool paused, int slot) = 0;
// Pauses or resumes *every* channel, including environmental reverb.
virtual void SetInactive(bool inactive) = 0;
enum EInactiveState
{
INACTIVE_Active, // sound is active
INACTIVE_Complete, // sound is completely paused
INACTIVE_Mute // sound is only muted
};
virtual void SetInactive(EInactiveState inactive) = 0;
// Updates the volume, separation, and pitch of a sound channel.
virtual void UpdateSoundParams3D (SoundListener *listener, FISoundChannel *chan, bool areasound, const FVector3 &pos, const FVector3 &vel) = 0;