mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 07:20:09 +01:00
Revenge Of The Instruments (#22213)
Take 2 <img width="320" height="149" alt="image" src="https://github.com/user-attachments/assets/21e45078-ef69-4b3c-8b50-208800b82558" /> It somehow got even worse over time. <img width="311" height="164" alt="image" src="https://github.com/user-attachments/assets/882d9a8e-16f1-4172-9c7b-f741d5bede8d" /> And now I have finished fixing it by hand and testing to verify that my fixes work. https://github.com/user-attachments/assets/0106593b-4b3f-4e7d-88f0-86c4b22571ff --------- Signed-off-by: VMSolidus <evilexecutive@gmail.com> Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
This commit is contained in:
@@ -142,7 +142,11 @@ GLOBAL_DATUM_INIT(sound_player, /singleton/sound_player, new)
|
||||
|
||||
/datum/sound_token/Destroy()
|
||||
Stop()
|
||||
. = ..()
|
||||
source = null
|
||||
if (listeners)
|
||||
listeners.Cut()
|
||||
sound = null
|
||||
return ..()
|
||||
|
||||
/datum/sound_token/proc/SetVolume(new_volume)
|
||||
new_volume = clamp(new_volume, 0, 100)
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
var/list/samples = list() // Write here however many samples, follow this syntax: "%note num%"='%sample file%' eg. "27"='synthesizer/e2.ogg'. Key must never be lower than 0 and higher than 127
|
||||
var/list/datum/sample_pair/sample_map = list() // Used to modulate sounds, don't fill yourself
|
||||
|
||||
/datum/instrument/Destroy()
|
||||
samples.Cut()
|
||||
QDEL_LIST_ASSOC_VAL(sample_map)
|
||||
return ..()
|
||||
|
||||
/datum/instrument/proc/create_full_sample_deviation_map()
|
||||
// Obtain samples
|
||||
|
||||
@@ -203,8 +203,17 @@
|
||||
|
||||
|
||||
/datum/real_instrument/Destroy()
|
||||
if (islist(instruments))
|
||||
var/list/aslist = instruments
|
||||
QDEL_LIST_ASSOC_VAL(aslist)
|
||||
else
|
||||
QDEL_NULL(instruments)
|
||||
QDEL_NULL(player)
|
||||
QDEL_NULL(song_editor)
|
||||
QDEL_NULL(usage_info)
|
||||
owner = null
|
||||
QDEL_NULL(env_editor)
|
||||
QDEL_NULL(echo_editor)
|
||||
return ..()
|
||||
|
||||
/obj/structure/synthesized_instrument
|
||||
@@ -225,14 +234,9 @@
|
||||
src.real_instrument = new /datum/real_instrument(src, new sound_player(src, instruments[pick(instruments)]), instruments)
|
||||
|
||||
/obj/structure/synthesized_instrument/Destroy()
|
||||
QDEL_NULL(src.real_instrument)
|
||||
if (islist(instruments))
|
||||
var/list/as_list = instruments
|
||||
for (var/key in as_list)
|
||||
qdel(as_list[key])
|
||||
instruments = null
|
||||
. = ..()
|
||||
|
||||
QDEL_NULL(real_instrument)
|
||||
QDEL_LIST(instruments)
|
||||
return ..()
|
||||
|
||||
/obj/structure/synthesized_instrument/attack_hand(mob/user)
|
||||
src.interact(user)
|
||||
|
||||
@@ -31,7 +31,10 @@
|
||||
available_channels = GLOB.musical_config.channels_per_instrument
|
||||
|
||||
/datum/synthesized_song/Destroy()
|
||||
playing = null
|
||||
player.event_manager.deactivate()
|
||||
player = null
|
||||
instrument_data = null
|
||||
return ..()
|
||||
|
||||
/datum/synthesized_song/proc/sanitize_tempo(new_tempo) // Identical to datum/song
|
||||
|
||||
@@ -28,12 +28,11 @@
|
||||
GLOB.instrument_synchronizer.register_global(src, .proc/check_wait)
|
||||
|
||||
/datum/sound_player/Destroy()
|
||||
src.song.playing = FALSE
|
||||
src.actual_instrument = null
|
||||
src.instrument = null
|
||||
actual_instrument = null
|
||||
instrument = null
|
||||
QDEL_NULL(song)
|
||||
QDEL_NULL(event_manager)
|
||||
tokens = null
|
||||
QDEL_LIST(tokens)
|
||||
GLOB.instrument_synchronizer.unregister_global(src, .proc/check_wait)
|
||||
wait = null
|
||||
. = ..()
|
||||
@@ -59,7 +58,7 @@
|
||||
/datum/sound_player/proc/unsubscribe(datum/sound_token/instrument/oldtoken)
|
||||
if(!istype(oldtoken))
|
||||
CRASH("Non token type passed to unsubscribe function.")
|
||||
tokens -= oldtoken
|
||||
tokens.Remove(oldtoken)
|
||||
|
||||
|
||||
/datum/sound_player/proc/apply_modifications(sound/what, note_num, which_line, which_note) // You don't need to override this
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
/datum/sound_token/instrument/Stop()
|
||||
if(player)
|
||||
player.unsubscribe(src)
|
||||
player = null
|
||||
. = ..()
|
||||
|
||||
/datum/sound_token/instrument/Destroy()
|
||||
player = null
|
||||
return ..()
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
author: Hellfirejag
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
|
||||
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- bugfix: "Made a 2nd attempt to fix the instruments memory leak."
|
||||
Reference in New Issue
Block a user