Index · Object → RefCounted → AudioStreamPlayback

AudioStreamPlayback

Meta class for playing back audio.

Inherited by (5): AudioStreamPlaybackInteractiveAudioStreamPlaybackPlaylistAudioStreamPlaybackPolyphonicAudioStreamPlaybackResampledAudioStreamPlaybackSynchronized
Class Description

Can play, loop, pause a scroll through audio. See AudioStream and AudioStreamOggVorbis for usage.

Methods

func _get_loop_count() -> int

Overridable method. Should return how many times this audio stream has looped. Most built-in playbacks always return 0.

func _get_parameter(name: StringName) -> Variant

Return the current value of a playback parameter by name (see AudioStream._get_parameter_list()).

func _get_playback_position() -> float

Overridable method. Should return the current progress along the audio stream, in seconds.

func _is_playing() -> bool

Overridable method. Should return true if this playback is active and playing its audio stream.

func _mix(buffer: AudioFrame*, rate_scale: float, frames: int) -> int

Override this method to customize how the audio stream is mixed. This method is called even if the playback is not active.

Note: It is not useful to override this method in GDScript or C#. Only GDExtension can take advantage of it.

func _seek(position: float) -> void

Override this method to customize what happens when seeking this audio stream at the given position, such as by calling AudioStreamPlayer.seek().

func _set_parameter(name: StringName, value: Variant) -> void

Set the current value of a playback parameter by name (see AudioStream._get_parameter_list()).

func _start(from_pos: float) -> void

Override this method to customize what happens when the playback starts at the given position, such as by calling AudioStreamPlayer.play().

func _stop() -> void

Override this method to customize what happens when the playback is stopped, such as by calling AudioStreamPlayer.stop().

func _tag_used_streams() -> void

Overridable method. Called whenever the audio stream is mixed if the playback is active and AudioServer.set_enable_tagging_used_audio_streams() has been set to true. Editor plugins may use this method to "tag" the current position along the audio stream and display it in a preview.

func get_loop_count() -> int

Returns the number of times the stream has looped.

func get_playback_position() -> float

Returns the current position in the stream, in seconds.

func get_sample_playback() -> AudioSamplePlayback

Returns the AudioSamplePlayback associated with this AudioStreamPlayback for playing back the audio sample of this stream.

func is_playing() -> bool

Returns true if the stream is playing.

func mix_audio(rate_scale: float, frames: int) -> PackedVector2Array

Mixes up to frames of audio from the stream from the current position, at a rate of rate_scale, advancing the stream.

Returns a PackedVector2Array where each element holds the left and right channel volume levels of each frame.

Note: Can return fewer frames than requested, make sure to use the size of the return value.

func seek(time: float = 0.0) -> void

Seeks the stream at the given time, in seconds.

func set_sample_playback(playback_sample: AudioSamplePlayback) -> void

Associates AudioSamplePlayback to this AudioStreamPlayback for playing back the audio sample of this stream.

func start(from_pos: float = 0.0) -> void

Starts the stream from the given from_pos, in seconds.

func stop() -> void

Stops the stream.

Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)