Skip to content

class_audio_playstack

gl326 edited this page Dec 14, 2021 · 1 revision

A class_audio_playstack() tracks multiple "tiers" of input containers. At any given time, 1 playstack will only play 1 container, but by tracking more than one container it is able to smartly transition between them or resume an old one when one finishes playing. We use these internally to control or music and ambience systems. You can learn about their functionality by looking at the Music/Ambience state functions.

These methods exist for instances of class_audio_playstack:

.destroy()

By default, class_audio_playstacks are permanently trackedby a global array. Calling this is the only way to remove them from memory.

.play = function(_container_name,tier=0,fadeOutTime=2,leaveOldPaused=false)

Adds a new container into the system and updates the current play state accordingly, just like music_set().

.pause()

Pauses the playstack

.unpause()

Unpauses the playstack

.set_playback_gap(timeInSeconds)

Sets the default silence gap that is added when transitioning between two containers. Depending on your needs, it can be good to have a default gap of silence between music, for example. In Chicory our overworld music always has a 2 second gap when changing from one track to another.

.get_playing()

Gets the string name of the container that is currently playing, or 0 if it is set to be silent, or -1 if there are not currently any instructions

.get_playing_tier()

Gets the integer tier of the currently playing container.

.reset()

Clears all instructions and stops all sounds, returning it to its state as if it were newly created with no containers attached.

Clone this wiki locally