mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 13:05:44 +01:00
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:
@@ -1,20 +1,13 @@
|
||||
/*
|
||||
Earphones that use our sound_player system to play sounds from a music cartridge to their wearer.
|
||||
|
||||
Current Features:
|
||||
- All earphones have a cartridge slot. Cartridges can be inserted by clicking an earphone, and removed via an eject_music_cartridge() verb.
|
||||
- Inserting a cartridge will load a playlist containing /datum/tracks, where track names and sound files are loaded.
|
||||
- Alt+Clicking will Start/Stop a playlist, creating or deleting an active sound_player token.
|
||||
- attack_self will eject the music cartridge. Ejecting a music cartridge also terminates the sound_player token.
|
||||
- Volume controllable via verb.
|
||||
|
||||
Missing features i am too weak to figure out:
|
||||
- There is no auto—next song, and a user must manually use next_song() or previous_song() verbs to iterate through a playlist.
|
||||
- Part and parcel with no auto-next: Tracks automatically loop due to using the PlayLoopingSound() proc. Ideally, tracks should not loop.
|
||||
- There is no accomodation for user-uploaded sound files.
|
||||
- There are no UI implementations of earphone controls, which could be more user friendly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Earphones that use our sound_player system to play sounds from a music cartridge to their wearer.
|
||||
*
|
||||
* Current Features:
|
||||
* - All earphones have a cartridge slot. Cartridges can be inserted by clicking an earphone, and removed via an eject_music_cartridge() verb.
|
||||
* - Inserting a cartridge will load a playlist containing /datum/tracks, where track names and sound files are loaded.
|
||||
* - Alt+Clicking will Start/Stop a playlist, creating or deleting an active sound_player token.
|
||||
* - attack_self will eject the music cartridge. Ejecting a music cartridge also terminates the sound_player token.
|
||||
* - Volume controllable via verb.
|
||||
*/
|
||||
/obj/item/clothing/ears/earphones
|
||||
name = "earphones"
|
||||
desc = "A pair of wireless earphones. Includes a little slot for a music cartridge."
|
||||
@@ -135,7 +128,7 @@
|
||||
if(!soundplayer_token)
|
||||
if(current_playlist && (current_playlist.len > 0))
|
||||
var/sound/sound_to_play = current_playlist[playlist_index].song_path
|
||||
soundplayer_token = GLOB.sound_player.PlayNonloopingSound(src, src, sound_to_play, volume, range, 20, prefer_mute = FALSE, sound_type = ASFX_MUSIC)
|
||||
soundplayer_token = GLOB.sound_player.PlayLoopingSound(src, src, sound_to_play, volume, range, 20, prefer_mute = FALSE, sound_type = ASFX_MUSIC)
|
||||
|
||||
// Queue the next_song() proc when the current song ends. Clean up handled under next_song() which also calls stopplaying() to end this token
|
||||
autoplay_timeleft = current_playlist[playlist_index].song_length
|
||||
|
||||
Reference in New Issue
Block a user