diff --git a/code/datums/audio/_audio.dm b/code/datums/audio/_audio.dm index 66a389e1582e9..f5958e849801a 100644 --- a/code/datums/audio/_audio.dm +++ b/code/datums/audio/_audio.dm @@ -1,20 +1,30 @@ /singleton/audio - var/source //Path to file source - var/display //A display title we use in the game - var/volume //If present, a `normal` volume - var/title //The real title + /// Path to file source + var/source + + /// The real (ie, artist's) audio title + var/title + + /// The display title to use in game, if different + var/display + + /// The normal volume to play the audio at, if set + var/volume + + /// The artist's name var/author + + /// The collection (eg album) the audio belongs to var/collection - var/singleton/license/license - var/url + /// The license under which the audio was made available + var/singleton/license/license -//Repository scopes -/singleton/audio/effect -/singleton/audio/track + /// A link to the audio's source, if available + var/url -/singleton/audio/New() +/singleton/audio/Initialize() . = ..() license = GET_SINGLETON(license) @@ -22,6 +32,7 @@ /singleton/audio/VV_static() return ..() + vars + /singleton/audio/proc/get_info(with_meta = TRUE) . = SPAN_GOOD("[title][!author?"":" by [author]"][!collection?"":" ([collection])"]") if (with_meta) @@ -29,11 +40,11 @@ /singleton/audio/proc/get_sound(channel) - var/sound/S = sound(source, FALSE, FALSE, channel, volume || 100) - return S + var/sound/sound = sound(source, FALSE, FALSE, channel, volume || 100) + return sound /singleton/audio/track/get_sound(channel = GLOB.lobby_sound_channel) - var/sound/S = ..() - S.repeat = TRUE - return S + var/sound/sound = ..() + sound.repeat = TRUE + return sound diff --git a/code/datums/audio/jukebox.dm b/code/datums/audio/jukebox.dm index a4170b6619569..f3a4a5f7c3265 100644 --- a/code/datums/audio/jukebox.dm +++ b/code/datums/audio/jukebox.dm @@ -1,4 +1,4 @@ -/jukebox //abstraction of music player behavior for jukeboxes, headphones, etc +/datum/jukebox var/atom/owner var/sound_id var/datum/sound_token/token @@ -17,7 +17,7 @@ var/playing -/jukebox/New(atom/_owner, _template, _ui_title, _ui_width, _ui_height) +/datum/jukebox/New(atom/_owner, _template, _ui_title, _ui_width, _ui_height) . = ..() if (QDELETED(_owner) || !isatom(_owner)) qdel(src) @@ -27,30 +27,30 @@ for (var/path in GLOB.jukebox_tracks) var/singleton/audio/track/track = GET_SINGLETON(path) AddTrack(track.display || track.title, track.source) - sound_id = "[/jukebox]_[sequential_id(/jukebox)]" + sound_id = "[/datum/jukebox]_[sequential_id(/datum/jukebox)]" template = _template ui_title = _ui_title ui_width = _ui_width ui_height = _ui_height -/jukebox/Destroy() +/datum/jukebox/Destroy() QDEL_NULL_LIST(tracks) QDEL_NULL(token) owner = null - . = ..() + return ..() -/jukebox/proc/AddTrack(title = "Track [length(tracks) + 1]", source) - tracks += new /jukebox_track (title, source) +/datum/jukebox/proc/AddTrack(title = "Track [length(tracks) + 1]", source) + tracks += new /datum/jukebox_track (title, source) -/jukebox/proc/ClearTracks() +/datum/jukebox/proc/ClearTracks() QDEL_NULL_LIST(tracks) tracks = list() -/jukebox/proc/Next() +/datum/jukebox/proc/Next() if (++index > length(tracks)) index = 1 if (playing) @@ -58,7 +58,7 @@ Play() -/jukebox/proc/Last() +/datum/jukebox/proc/Last() if (--index < 1) index = length(tracks) if (playing) @@ -66,7 +66,7 @@ Play() -/jukebox/proc/Track(_index) +/datum/jukebox/proc/Track(_index) _index = text2num(_index) if (!IsInteger(_index)) return @@ -76,16 +76,16 @@ Play() -/jukebox/proc/Stop() +/datum/jukebox/proc/Stop() playing = FALSE QDEL_NULL(token) owner.queue_icon_update() -/jukebox/proc/Play() +/datum/jukebox/proc/Play() if (playing) return - var/jukebox_track/track = tracks[index] + var/datum/jukebox_track/track = tracks[index] if (!track.source) return playing = TRUE @@ -94,7 +94,7 @@ owner.queue_icon_update() -/jukebox/proc/Volume(_volume) +/datum/jukebox/proc/Volume(_volume) _volume = text2num(_volume) if (!isfinite(_volume)) return @@ -108,16 +108,16 @@ token.SetVolume(volume) -/jukebox/nano_host() +/datum/jukebox/nano_host() return owner -/jukebox/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui, force_open = TRUE, datum/topic_state/state = GLOB.default_state)//, datum/topic_state/state = GLOB.jukebox_state) +/datum/jukebox/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui, force_open = TRUE, datum/topic_state/state = GLOB.default_state) var/list/data_tracks = list() for (var/i = 1 to length(tracks)) - var/jukebox_track/track = tracks[i] + var/datum/jukebox_track/track = tracks[i] data_tracks += list(list("track" = track.title, "index" = i)) - var/jukebox_track/track = tracks[index] + var/datum/jukebox_track/track = tracks[index] var/list/data = list( "track" = track.title, "playing" = playing, @@ -131,24 +131,30 @@ ui.open() -/jukebox/Topic(href, href_list) +/datum/jukebox/Topic(href, href_list) switch ("[href_list["act"]]") - if ("next") Next() - if ("last") Last() - if ("stop") Stop() - if ("play") Play() - if ("volume") Volume("[href_list["dat"]]") - if ("track") Track("[href_list["dat"]]") + if ("next") + Next() + if ("last") + Last() + if ("stop") + Stop() + if ("play") + Play() + if ("volume") + Volume("[href_list["dat"]]") + if ("track") + Track("[href_list["dat"]]") return TOPIC_REFRESH -/jukebox_track +/datum/jukebox_track var/title var/source -/jukebox_track/New(_title, _source, _volume) +/datum/jukebox_track/New(_title, _source) title = _title source = _source diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index c44a0fcc08d52..2b746b17aa769 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -13,7 +13,7 @@ obj_flags = OBJ_FLAG_ANCHORABLE layer = ABOVE_WINDOW_LAYER - var/jukebox/jukebox + var/datum/jukebox/jukebox /obj/machinery/jukebox/Initialize() diff --git a/code/game/objects/items/devices/boombox.dm b/code/game/objects/items/devices/boombox.dm index f16b3ba979994..d3759a68bc8e8 100644 --- a/code/game/objects/items/devices/boombox.dm +++ b/code/game/objects/items/devices/boombox.dm @@ -11,7 +11,7 @@ w_class = ITEM_SIZE_HUGE //forbid putting something that emits loud sounds forever into a backpack origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1) - var/jukebox/jukebox + var/datum/jukebox/jukebox var/boombox_flags diff --git a/code/modules/clothing/ears/headphones.dm b/code/modules/clothing/ears/headphones.dm index 4d08aca156e1b..b1db917266d59 100644 --- a/code/modules/clothing/ears/headphones.dm +++ b/code/modules/clothing/ears/headphones.dm @@ -6,7 +6,7 @@ item_state = "headphones_off" slot_flags = SLOT_EARS | SLOT_TWOEARS volume_multiplier = 0.5 - var/jukebox/jukebox + var/datum/jukebox/jukebox /obj/item/clothing/ears/headphones/Initialize() diff --git a/code/unit_tests/music_test.dm b/code/unit_tests/music_test.dm index a185d025a9afb..44e40189f6ac7 100644 --- a/code/unit_tests/music_test.dm +++ b/code/unit_tests/music_test.dm @@ -37,9 +37,9 @@ /datum/unit_test/jukebox_validate/start_test() var/list/failed = list() - for (var/jukebox/jukebox) + for (var/datum/jukebox/jukebox) for (var/entry in jukebox.tracks) - var/jukebox_track/track = entry + var/datum/jukebox_track/track = entry if (!track.title || !isfile(track.source)) log_bad("Invalid Jukebox Track: [log_info_line(jukebox)]") failed += jukebox diff --git a/mods/jukebox_tapes/code/jukebox.dm b/mods/jukebox_tapes/code/jukebox.dm index c15c3f691f597..fd79316c86fd4 100644 --- a/mods/jukebox_tapes/code/jukebox.dm +++ b/mods/jukebox_tapes/code/jukebox.dm @@ -11,7 +11,7 @@ if(tape) jukebox.Stop() - for(var/jukebox_track/T in jukebox.tracks) + for(var/datum/jukebox_track/T in jukebox.tracks) if(T == tape.track) jukebox.tracks -= T jukebox.Last() @@ -104,12 +104,12 @@ // SIERRA TODO: Move to corecode or override -/jukebox/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui, force_open = TRUE, datum/topic_state/state = GLOB.default_state)//, datum/topic_state/state = GLOB.jukebox_state) +/datum/jukebox/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui, force_open = TRUE, datum/topic_state/state = GLOB.default_state)//, datum/topic_state/state = GLOB.jukebox_state) var/list/data_tracks = list() for (var/i = 1 to length(tracks)) - var/jukebox_track/track = tracks[i] + var/datum/jukebox_track/track = tracks[i] data_tracks += list(list("track" = track.title, "index" = i)) - var/jukebox_track/track = tracks[index] + var/datum/jukebox_track/track = tracks[index] var/list/data = list( "track" = track.title, "playing" = playing, @@ -125,7 +125,7 @@ ui.set_initial_data(data) ui.open() -/jukebox/Topic(href, href_list) +/datum/jukebox/Topic(href, href_list) switch ("[href_list["act"]]") if ("next") Next() if ("last") Last() diff --git a/mods/music_player/code/music_tape.dm b/mods/music_player/code/music_tape.dm index 47e8cb65ec287..f651bba0e2e0c 100644 --- a/mods/music_player/code/music_tape.dm +++ b/mods/music_player/code/music_tape.dm @@ -18,7 +18,7 @@ var/ruined = 0 var/rewrites_left = 2 - var/jukebox_track/track + var/datum/jukebox_track/track var/uploader_ckey /obj/item/music_tape/Initialize() diff --git a/mods/music_player/code/music_writer.dm b/mods/music_player/code/music_writer.dm index 3f59856e76e75..4ff73ab334ae4 100644 --- a/mods/music_player/code/music_writer.dm +++ b/mods/music_player/code/music_writer.dm @@ -159,7 +159,7 @@ if(disk.track) //Removing old datum disk if there one qdel(disk.track) - var/jukebox_track/T = new(new_name, new_sound_file) + var/datum/jukebox_track/T = new(new_name, new_sound_file) if(T) disk.track = T diff --git a/mods/music_player/code/subtypes_tape.dm b/mods/music_player/code/subtypes_tape.dm index 43e7d61a2b66c..88274b7104a17 100644 --- a/mods/music_player/code/subtypes_tape.dm +++ b/mods/music_player/code/subtypes_tape.dm @@ -23,6 +23,6 @@ SetName("tape - \"[new_name]\"") if(new_sound && new_name && !track) - track = new /jukebox_track(new_name, new_sound) + track = new /datum/jukebox_track(new_name, new_sound) return TRUE return FALSE