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
Name | Type | Default |
---|---|---|
audio_node | Node | new() |
one_shot_audio_node | Node | new() |
current_audio_channels | Dictionary | {} |
Methods
Returns | Method |
---|---|
void | clear_game_state ( _clear_flag : int = 0 ) |
void | load_game_state ( load_flag : int = 0 ) |
void | pause ( ) |
void | resume ( ) |
void | update_audio ( channel_name : String = "" , path : String = "" , settings_overrides : Dictionary = {} ) |
bool | is_channel_playing ( channel_name : String ) |
void | stop_all_channels ( fade : float = 0.0 ) |
void | stop_all_one_shot_sounds ( ) |
void | interpolate_volume_linearly ( value : float, node : AudioStreamPlayer ) |
bool | is_channel_playing_file ( file_path : String, channel_name : String ) |
bool | is_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:
Key | Value Type | Value |
---|---|---|
path | String | The path to the audio resource file. |
channel | String | The channel name to play the audio on. |
volume | float | The volume in db of the audio resource that will be set to the . |
audio_bus | String | The audio bus name that the will use. |
loop | bool | Whether the audio resource will loop or not once it finishes playing. |
Property Descriptions
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.
Pauses playing audio.
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.