/datum/looping_sound
A datum for sounds that need to loop, with a high amount of configurability.
Vars | |
chance | Chance per loop to play a mid_sound. |
---|---|
direct | If true, plays directly to provided atoms instead of from them. |
end_sound | (soundfile) The sound played after the main loop has concluded. |
end_volume | Override for volume of end sound. |
extra_range | The extra range of the sound in tiles, defaults to 0. |
loop_started | Has the looping started yet? |
max_loops | The max amount of loops to run for. |
mid_length | The length of time to wait between playing mid_sounds. |
mid_sounds | (list or soundfile) Since this can be either a list or a single soundfile you can have random sounds. May contain further lists but must contain a soundfile at the end. |
parent | The source of the sound, or the recipient of the sound. |
skip_starting_sounds | Do we skip the starting sounds? |
start_length | How long to wait before starting the main loop after playing start_sound. |
start_sound | (soundfile) Played before starting the mid_sounds loop. |
start_volume | Override for volume of start sound. |
timer_id | The ID of the timer that's used to loop the sounds. |
vary | Whether or not the sounds will vary in pitch when played. |
volume | Sound output volume. |
Procs | |
get_sound | Returns the sound we should now be playing. |
handle_parent_del | A simple proc to handle the deletion of the parent, so that it does not force it to hard-delete. |
is_active | A simple proc that lets us know whether the sounds are currently active or not. |
on_start | A proc that's there to handle delaying the main sounds if there's a start_sound, and simply starting the sound loop in general. |
on_stop | Simple proc that's executed when the looping sound is stopped, so that the end_sound can be played, if there's one. |
play | The proc that handles actually playing the sound. |
set_parent | A simple proc to change who our parent is set to, also handling registering and unregistering the QDELETING signals on the parent. |
sound_loop | A simple proc handling the looping of the sound itself. |
start | The proc to actually kickstart the whole sound sequence. This is what you should call to start the looping_sound . |
start_sound_loop | The proc that handles starting the actual core sound loop. |
stop | The proc to call to stop the sound loop. |
Var Details
chance
Chance per loop to play a mid_sound.
direct
If true, plays directly to provided atoms instead of from them.
end_sound
(soundfile) The sound played after the main loop has concluded.
end_volume
Override for volume of end sound.
extra_range
The extra range of the sound in tiles, defaults to 0.
loop_started
Has the looping started yet?
max_loops
The max amount of loops to run for.
mid_length
The length of time to wait between playing mid_sounds.
mid_sounds
(list or soundfile) Since this can be either a list or a single soundfile you can have random sounds. May contain further lists but must contain a soundfile at the end.
parent
The source of the sound, or the recipient of the sound.
skip_starting_sounds
Do we skip the starting sounds?
start_length
How long to wait before starting the main loop after playing start_sound.
start_sound
(soundfile) Played before starting the mid_sounds loop.
start_volume
Override for volume of start sound.
timer_id
The ID of the timer that's used to loop the sounds.
vary
Whether or not the sounds will vary in pitch when played.
volume
Sound output volume.
Proc Details
get_sound
Returns the sound we should now be playing.
handle_parent_del
A simple proc to handle the deletion of the parent, so that it does not force it to hard-delete.
is_active
A simple proc that lets us know whether the sounds are currently active or not.
on_start
A proc that's there to handle delaying the main sounds if there's a start_sound, and simply starting the sound loop in general.
on_stop
Simple proc that's executed when the looping sound is stopped, so that the end_sound
can be played, if there's one.
play
The proc that handles actually playing the sound.
Arguments:
- soundfile - The soundfile we want to play.
- volume_override - The volume we want to play the sound at, overriding the
volume
variable.
set_parent
A simple proc to change who our parent is set to, also handling registering and unregistering the QDELETING signals on the parent.
sound_loop
A simple proc handling the looping of the sound itself.
Arguments:
- start_time - The time at which the
mid_sounds
started being played (so we know when to stop looping).
start
The proc to actually kickstart the whole sound sequence. This is what you should call to start the looping_sound
.
Arguments:
- on_behalf_of - The new object to set as a parent.
start_sound_loop
The proc that handles starting the actual core sound loop.
stop
The proc to call to stop the sound loop.
Arguments:
- null_parent - Whether or not we should set the parent to null (useful when destroying the
looping_sound
itself). Defaults to FALSE.