- Blood: unpositioned sounds must be limited to one per channel.

This commit is contained in:
Christoph Oelckers 2021-05-16 11:51:51 +02:00
parent 98ca5d5db4
commit 60fe1d32fb
3 changed files with 6 additions and 10 deletions

View file

@ -929,12 +929,7 @@ void SoundEngine::StopSound(int sourcetype, const void* actor, int channel, int
void SoundEngine::StopActorSounds(int sourcetype, const void* actor, int chanmin, int chanmax) void SoundEngine::StopActorSounds(int sourcetype, const void* actor, int chanmin, int chanmax)
{ {
const bool all = (chanmin == 0 && chanmax == 0); const bool all = (chanmin == 0 && chanmax == 0);
if (!all && chanmax > chanmin) if (chanmax < chanmin) std::swap(chanmin, chanmax);
{
const int temp = chanmax;
chanmax = chanmin;
chanmin = temp;
}
FSoundChan* chan = Channels; FSoundChan* chan = Channels;
while (chan != nullptr) while (chan != nullptr)

View file

@ -1192,10 +1192,10 @@ void S_SetSoundPaused(int state)
if (paused == 0) if (paused == 0)
{ {
S_ResumeSound(true); S_ResumeSound(true);
if (GSnd != nullptr) }
{ if (GSnd != nullptr)
GSnd->SetInactive(SoundRenderer::INACTIVE_Active); {
} GSnd->SetInactive(SoundRenderer::INACTIVE_Active);
} }
} }
else else

View file

@ -181,6 +181,7 @@ void sndStartSample(unsigned int nSound, int nVolume, int nChannel, bool bLoop,
else nVolume = 255; else nVolume = 255;
} }
if (bLoop) chanflags |= CHANF_LOOP; if (bLoop) chanflags |= CHANF_LOOP;
soundEngine->StopActorSounds(SOURCE_None, nullptr, nChannel + 1, nChannel + 1);
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, (nChannel + 1), chanflags, snd, nVolume / 255.f, ATTN_NONE); soundEngine->StartSound(SOURCE_None, nullptr, nullptr, (nChannel + 1), chanflags, snd, nVolume / 255.f, ATTN_NONE);
} }
} }