Ports musical instruments from /tg/

This commit is contained in:
Chompstation Bot
2021-06-01 20:29:51 +00:00
parent 151d317f5c
commit eb03a53185
182 changed files with 2552 additions and 65 deletions

View File

@@ -9,7 +9,7 @@
var/area/area_source = turf_source.loc
//allocate a channel if necessary now so its the same for everyone
channel = channel || open_sound_channel()
channel = channel || SSsounds.random_available_channel()
// Looping through the player list has the added bonus of working for mobs inside containers
var/sound/S = sound(get_sfx(soundin))
@@ -43,7 +43,7 @@
S = sound(get_sfx(soundin))
S.wait = 0 //No queue
S.channel = channel || open_sound_channel()
S.channel = channel || SSsounds.random_available_channel()
// I'm not sure if you can modify S.volume, but I'd rather not try to find out what
// horrible things lurk in BYOND's internals, so we're just gonna do vol *=
@@ -109,15 +109,14 @@
var/mob/MO = M
MO.playsound_local(get_turf(MO), sound, volume, vary, pressure_affected = FALSE)
/proc/open_sound_channel()
var/static/next_channel = 1 //loop through the available 1024 - (the ones we reserve) channels and pray that its not still being used
. = ++next_channel
if(next_channel > CHANNEL_HIGHEST_AVAILABLE)
next_channel = 1
/mob/proc/stop_sound_channel(chan)
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
src << S
/proc/get_rand_frequency()
return rand(32000, 55000) //Frequency stuff only works with 45kbps oggs.