Files
Aurora.3/code/game/sound/sound_channels.dm
7d058fc613 Jukebox TGUI update, Earphones autoplay, sound keys refactor (#21630)
V2 of [previous music playing
PR](https://github.com/Aurorastation/Aurora.3/pull/21466). TLDR no
longer uses the connect_range component for implementation because it
turned out a bit too inflexible for overlapping music players.

Removes a NanoUI template for the [TGUI
update](https://github.com/Aurorastation/Aurora.3/pull/21046).

New changelog:
  - refactor: "Ported Jukebox's NanoUI interface to TGUI."
- refactor: "Ported Jukebox audio playing functionality to a component."
- refactor: "Sound keys refactored from singletons to datums, along with
larger breakout of sound.dm to allow for easier SFX updates in future."
  - code_imp: "Expanded track datums to include track lengths."
- code_imp: "Reorganized music file folders for more intuitive access."
  - rscadd: "Earphone status feedback text now includes track length."
  - rscadd: "Added autoplay functionality to earphones."
- bugfix: "Fixed earphones' 'Previous Song' verb not sending you to the
end of the playlist when used while the first track is selected."
- bugfix: "Fixed gain adjustment for 'Konyang-1' (-23 dB -> standard
-9.8 dB)."
- bugfix: "Fixed y-offset of audioconsole-running overlay animation to
line up with the actual screen."

---------

Co-authored-by: VMSolidus <evilexecutive@gmail.com>
2026-01-22 16:54:40 +00:00

62 lines
2.0 KiB
Plaintext

GLOBAL_LIST_INIT(used_sound_channels, list(
CHANNEL_MASTER_VOLUME,
CHANNEL_LOBBYMUSIC,
CHANNEL_ADMIN,
CHANNEL_VOX,
CHANNEL_JUKEBOX,
CHANNEL_HEARTBEAT,
CHANNEL_AMBIENCE,
CHANNEL_BUZZ,
CHANNEL_SOUND_EFFECTS,
CHANNEL_SOUND_FOOTSTEPS,
CHANNEL_WEATHER,
CHANNEL_MACHINERY,
CHANNEL_INSTRUMENTS,
CHANNEL_MOB_SOUNDS,
))
GLOBAL_LIST_INIT(proxy_sound_channels, list(
CHANNEL_SOUND_EFFECTS,
CHANNEL_SOUND_FOOTSTEPS,
CHANNEL_WEATHER,
CHANNEL_MACHINERY,
CHANNEL_INSTRUMENTS,
CHANNEL_MOB_SOUNDS,
))
GLOBAL_DATUM_INIT(cached_mixer_channels, /list, list())
/proc/guess_mixer_channel(soundin)
var/sound_text_string
if(istype(soundin, /sound))
var/sound/bleh = soundin
sound_text_string = "[bleh.file]"
else
sound_text_string = "[soundin]"
if(GLOB.cached_mixer_channels[sound_text_string])
return GLOB.cached_mixer_channels[sound_text_string]
else if(findtext(sound_text_string, "effects/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_SOUND_EFFECTS
else if(findtext(sound_text_string, "machines/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_MACHINERY
else if(findtext(sound_text_string, "creatures/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_MOB_SOUNDS
else if(findtext(sound_text_string, "/ai/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_VOX
else if(findtext(sound_text_string, "chatter/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_MOB_SOUNDS
else if(findtext(sound_text_string, "items/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_SOUND_EFFECTS
else if(findtext(sound_text_string, "weapons/"))
. = GLOB.cached_mixer_channels[sound_text_string] = CHANNEL_SOUND_EFFECTS
else
return FALSE
/mob/proc/stop_sound_channel(chan)
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = chan))
/mob/proc/set_sound_channel_volume(channel, volume)
var/sound/S = sound(null, FALSE, FALSE, channel, volume)
S.status = SOUND_UPDATE
SEND_SOUND(src, S)