PopochiuAudioManager
Extends: Node
Description
Constants Descriptions
SETTINGS_PATH
const SETTINGS_PATH: String = "user://audio_settings.save"
Specifies the path where the volume configuration for the audio buses used in the game is stored.
TEMP_PLAYER
const TEMP_PLAYER: String = "temporal"
Used to mark stream players created at runtime that should be [method Node.free] when they are no longer needed.
Property Descriptions
twelfth_root_of_two
var twelfth_root_of_two: float = 1.0594630943593
Used to convert the value of the pitch set on [member PopochiuAudioCue.pitch] to the corresponding value needed for the [code]pitch_scale[/code] property of the audio stream players.
volume_settings
var volume_settings: Dictionary
Stores the volume values for each of the audio buses used by the game.
Method Descriptions
play_sound_cue
func play_sound_cue(cue_name: String = "", position_2d: Vector2 = "(0, 0)", wait_to_end = null) -> Node
Searches for the PopochiuAudioCue among the cues that are NOT part of the music group and plays it. You can set a [param position_2d] to play it positionally. If [param wait_to_end] is set to [code]true[/code], the function will pause until the audio finishes.
play_music_cue
func play_music_cue(cue_name: String, fade_duration: float = 0, music_position: float = 0) -> Node
Searches for the PopochiuAudioCue among the cues that are part of the music group and plays it. It can fade for [param fade_duration] seconds, and you can start playing it from a given [param music_position] in seconds.
play_fade_cue
func play_fade_cue(cue_name: String = "", duration: float = 1, from: float = -80, to: float = inf, position_2d: Vector2 = "(0, 0)", wait_to_end = null) -> Node
Plays the PopochiuAudioCue using a fade that will last [param duration] seconds. Specify the starting volume with [param from] and the target volume with [param to]. You can play the audio positionally with [param position_2d] and wait for it to finish if [param wait_to_end] is set to [code]true[/code].
stop
func stop(cue_name: String, fade_duration: float = 0) -> void
Stops the PopochiuAudioCue. It can use a fade effect that will last [param fade_duration] seconds.
get_cue_playback_position
func get_cue_playback_position(cue_name: String) -> float
Returns the playback position of the PopochiuAudioCue.
change_cue_pitch
func change_cue_pitch(cue_name: String, pitch: float = 0) -> void
Changes the [code]pitch_scale[/code] of the [PopochiuAudioCue] identified by [param cue_name] to the value set (in semitones) in [param pitch].
change_cue_volume
func change_cue_volume(cue_name: String, volume: float = 0) -> void
Changes the [code]volume_db[/code] of the [PopochiuAudioCue] identified by [param cue_name] to the value set in [param volume].
set_bus_volume_db
func set_bus_volume_db(bus_name: String, value: float) -> void
Sets [param value] as the volume of the audio bus identified with [param bus_name].
save_sound_settings
func save_sound_settings()
Saves in the file at [constant SETTINGS_PATH] the volume values of all the audio buses.
load_sound_settings
func load_sound_settings()
Loads the volume values stored at [constant SETTINGS_PATH] for all the audio buses.
is_playing_cue
func is_playing_cue(cue_name: String) -> bool
Returns [code]true[/code] if the [PopochiuAudioCue] identified by [param cue_name] is playing.