From 29a997dbcff711c7b3236736ed25a0cd019e2dff Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 21 Feb 2024 16:11:14 -0800 Subject: [PATCH] Sound: add Sound_Stop() to make that task more slightly more accessible. --- src/shared/sound.h | 3 +++ src/shared/sound.qc | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/shared/sound.h b/src/shared/sound.h index 13ec1c65..b5719da8 100644 --- a/src/shared/sound.h +++ b/src/shared/sound.h @@ -109,4 +109,7 @@ int Sound_GetID(string sndDef); void Sound_Speak(entity targetEntity, string sentencesEntry); #endif +/** Stops sounds on a given channel, on a target entity. */ +void Sound_Stop(entity target, int chan); + void Sound_DebugList(); \ No newline at end of file diff --git a/src/shared/sound.qc b/src/shared/sound.qc index 788170fe..18316592 100644 --- a/src/shared/sound.qc +++ b/src/shared/sound.qc @@ -577,6 +577,12 @@ Sound_DistancePos(vector pos, string shader) pointsound_proper(pos, argv(r), volume, ATTN_NONE, pitch); } +void +Sound_Stop(entity target, int chan) +{ + sound(target, chan, "common/null.wav", 1.0f, ATTN_NORM, 100, SOUNDFLAG_FOLLOW, 0 ); +} + void Sound_Play(entity target, int chan, string shader) {