Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Audio

This contains the source code documentation of the class subsystem_Audio.

subsystem_Audio

Inherits: DialogicSubsystem

Subsystem for managing background audio and one-shot sound effects.

Description

This subsystem has many different helper methods for managing audio in your timeline. For instance, you can listen to audio changes via audio_started.

Properties


Methods

ReturnsMethod
voidclear_game_state ( _clear_flag: int = 0 )
voidload_game_state ( load_flag: int = 0 )
voidpause ( )
voidresume ( )
voidupdate_audio ( channel_name: String = "", path: String = "", settings_overrides: Dictionary = {} )
boolis_channel_playing ( channel_name: String )
voidstop_all_channels ( fade: float = 0.0 )
voidstop_all_one_shot_sounds ( )
voidinterpolate_volume_linearly ( value: float, node: AudioStreamPlayer )
boolis_channel_playing_file ( file_path: String, channel_name: String )
boolis_any_channel_playing ( )

Signals

signal audio_started ( info: Dictionary )

Whenever a new audio event is started, this signal is emitted and contains a dictionary with the following keys:

KeyValue TypeValue
pathStringThe path to the audio resource file.
channelStringThe channel name to play the audio on.
volumefloatThe volume in db of the audio resource that will be set to the .
audio_busStringThe audio bus name that the will use.
loopboolWhether the audio resource will loop or not once it finishes playing.

Property Descriptions

var audio_node = new()

Audio node for holding audio players


var one_shot_audio_node = new()

Sound node for holding sound players


var current_audio_channels = {}

Dictionary with info of all current audio channels


Method Descriptions

func clear_game_state ( _clear_flag: int = 0 ) ⇒ void

Clears the state on this subsystem and stops all audio.


func load_game_state ( load_flag: int = 0 ) ⇒ void

Loads the state on this subsystem from the current state info.


func pause ( ) ⇒ void

Pauses playing audio.


func resume ( ) ⇒ void

Resumes playing audio.


func update_audio ( channel_name: String = "", path: String = "", settings_overrides: Dictionary = {} ) ⇒ void

Plays the given file (or nothing) on the given channel. No channel given defaults to the "One-Shot SFX" channel, which does not save audio but can have multiple audios playing simultaneously.


func is_channel_playing ( channel_name: String ) ⇒ bool

Returns true if any audio is playing on the given channel_name.


func stop_all_channels ( fade: float = 0.0 ) ⇒ void

Stops audio on all channels.


func stop_all_one_shot_sounds ( ) ⇒ void

Stops all one-shot sounds.


func interpolate_volume_linearly ( value: float, node: AudioStreamPlayer ) ⇒ void

Converts a linear loudness value to decibel and sets that volume to the given node.


func is_channel_playing_file ( file_path: String, channel_name: String ) ⇒ bool

Returns whether the currently playing audio resource is the same as this event's resource_path, for channel_name.


func is_any_channel_playing ( ) ⇒ bool

Returns true if any channel is playing.