From 6142f9d79581962dd8c738d68715b8b4a012da22 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Apr 2021 21:13:24 +0200 Subject: [PATCH] - added CHANF_FORCE flag for forcing non-looped sounds to start, even when sound is paused. Blood needs this for its PlayerSound controller, which is run right on map load - so without this it wouldn't start the sound when a map is initiated from the console. --- source/common/audio/sound/i_soundinternal.h | 1 + source/common/audio/sound/s_sound.cpp | 2 +- source/games/blood/src/triggers.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/common/audio/sound/i_soundinternal.h b/source/common/audio/sound/i_soundinternal.h index be3486440..1ef4178d4 100644 --- a/source/common/audio/sound/i_soundinternal.h +++ b/source/common/audio/sound/i_soundinternal.h @@ -31,6 +31,7 @@ enum EChanFlag CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them. CHANF_LOCAL = 16384, // only plays locally for the calling actor CHANF_TRANSIENT = 32768, // Do not record in savegames - used for sounds that get restarted outside the sound system (e.g. ambients in SW and Blood) + CHANF_FORCE = 65536, // Start, even if sound is paused. }; typedef TFlags EChanFlags; diff --git a/source/common/audio/sound/s_sound.cpp b/source/common/audio/sound/s_sound.cpp index 4521ebd90..7fdbd74c6 100644 --- a/source/common/audio/sound/s_sound.cpp +++ b/source/common/audio/sound/s_sound.cpp @@ -528,7 +528,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source, // sound is paused and a non-looped sound is being started. // Such a sound would play right after unpausing which wouldn't sound right. - if (!(chanflags & CHANF_LOOP) && !(chanflags & (CHANF_UI|CHANF_NOPAUSE)) && SoundPaused) + if (!(chanflags & CHANF_LOOP) && !(chanflags & (CHANF_UI|CHANF_NOPAUSE|CHANF_FORCE)) && SoundPaused) { return NULL; } diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 4bbaf9c7f..8da50f7af 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -595,7 +595,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event) break; gMe->restTime = 0; } - sndStartSample(pXSprite->data1, -1, 1, 0); + sndStartSample(pXSprite->data1, -1, 1, 0, CHANF_FORCE); break; case kThingObjectGib: case kThingObjectExplode: