looping_sound

A datum for sounds that need to loop, with a high amount of configurability.
Vars | |
audio_index | The index of the current song we're playing in the mid_sounds list, only used if in_order is used This is immediately set to 1, so we start the index at 0 |
---|---|
chance | Chance per loop to play a mid_sound. |
cut_list | If we're using cut_mid, this is the list we cut from |
direct | If true, plays directly to provided atoms instead of from them. |
each_once | If we should always play each sound once per loop of all sounds. Weights here only really effect order, and could be disgarded |
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. |
falloff_distance | The falloff distance of the sound, |
falloff_exponent | How much the sound will be affected by falloff per tile. |
ignore_walls | Are we ignoring walls? Defaults to TRUE. |
in_order | Whether if the sounds should be played in order or not. Defaults to FALSE. |
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_length_vary | Amount of time to add/take away from the mid length, randomly |
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. |
pressure_affected | Are the sounds affected by pressure? Defaults to TRUE. |
skip_starting_sounds | Do we skip the starting sounds? |
sound_channel | Sound channel to play on, random if not provided |
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. |
use_reverb | Are the sounds subject to reverb? Defaults to TRUE. |
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_mid_length | Applies a new mid length to 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. |
stop_current | Stops sound playing on current channel, if specified |
Var Details
audio_index

The index of the current song we're playing in the mid_sounds list, only used if in_order is used This is immediately set to 1, so we start the index at 0
chance

Chance per loop to play a mid_sound.
cut_list

If we're using cut_mid, this is the list we cut from
direct

If true, plays directly to provided atoms instead of from them.
each_once

If we should always play each sound once per loop of all sounds. Weights here only really effect order, and could be disgarded
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.
falloff_distance

The falloff distance of the sound,
falloff_exponent

How much the sound will be affected by falloff per tile.
ignore_walls

Are we ignoring walls? Defaults to TRUE.
in_order

Whether if the sounds should be played in order or not. Defaults to FALSE.
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_length_vary

Amount of time to add/take away from the mid length, randomly
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.
pressure_affected

Are the sounds affected by pressure? Defaults to TRUE.
skip_starting_sounds

Do we skip the starting sounds?
sound_channel

Sound channel to play on, random if not provided
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.
use_reverb

Are the sounds subject to reverb? Defaults to TRUE.
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_mid_length
Applies a new mid length to 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.
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.
stop_current
Stops sound playing on current channel, if specified