Sound channel assignment stuff (#21845)

Fixes https://github.com/Aurorastation/Aurora.3/issues/21806

Headphones using the PlayNonloopingSound proc meant that in
datum/sound_token/New(), it wasnt being dynamically assigned its own
channel and so the associated sound.channel was defaulting to zero. This
broke a bunch of stupid sound stuff when the headphones were A.) playing
while onscreen but not within range of a listener and B.) stopping songs
while other SFX happened to be playing and C.) probably other cases.

PlayNonloopingSound is not used anywhere else in the repo at this time.
This commit is contained in:
Batrachophreno
2026-02-11 16:53:52 +00:00
committed by GitHub
parent 1bf7a822f4
commit 8b0bcae27a
3 changed files with 71 additions and 18 deletions
+2
View File
@@ -35,6 +35,8 @@ GLOBAL_DATUM_INIT(sound_player, /singleton/sound_player, new)
return PlaySoundDatum(source, sound_id, S, range, prefer_mute, sound_type)
/// The 'repeat = FALSE' here seems to cause scattered sound cutoff issues due to any /sounds created reverting to the default channel zero. Refer to https://github.com/Aurorastation/Aurora.3/pull/21845.
/// This suggests that further work needs to be done with managing channels when a sound gets assigned default channel 0.
/singleton/sound_player/proc/PlayNonloopingSound(atom/source, sound_id, sound, volume, range, falloff = 1, echo, frequency, prefer_mute, sound_type = ASFX_AMBIENCE)
var/sound/S = istype(sound, /sound) ? sound : new(sound)
S.environment = 0 // Ensures a 3D effect even if x/y offset happens to be 0 the first time it's played