AudioStreamPlayer

Inherits: Node < Object

Plays back audio non-positionally.

Description

Plays an audio stream non-positionally.

Tutorials

Methods

floatget_playback_position ( )
AudioStreamPlaybackget_stream_playback ( )
voidplay ( float from_position=0.0 )
voidseek ( float to_position )
voidstop ( )

Signals

  • finished ( )

Emitted when the audio stops playing.

Enumerations

enum MixTarget:

  • MIX_TARGET_STEREO = 0 — The audio will be played only on the first channel.
  • MIX_TARGET_SURROUND = 1 — The audio will be played on all surround channels.
  • MIX_TARGET_CENTER = 2 — The audio will be played on the second channel, which is usually the center.

Property Descriptions

Defaultfalse
Setterset_autoplay(value)
Getteris_autoplay_enabled()

If true, audio plays when added to scene tree.


Default"Master"
Setterset_bus(value)
Getterget_bus()

Bus on which this audio is playing.


Default0
Setterset_mix_target(value)
Getterget_mix_target()

If the audio configuration has more than two speakers, this sets the target channels. See MixTarget constants.


Default1.0
Setterset_pitch_scale(value)
Getterget_pitch_scale()

Changes the pitch and the tempo of the audio.


Defaultfalse
Getteris_playing()

If true, audio is playing.


Setterset_stream(value)
Getterget_stream()

The AudioStream object to be played.


Defaultfalse
Setterset_stream_paused(value)
Getterget_stream_paused()

If true, the playback is paused. You can resume it by setting stream_paused to false.


Default0.0
Setterset_volume_db(value)
Getterget_volume_db()

Volume of sound, in dB.

Method Descriptions

  • float get_playback_position ( )

Returns the position in the AudioStream in seconds.


Returns the AudioStreamPlayback object associated with this AudioStreamPlayer.


  • void play ( float from_position=0.0 )

Plays the audio from the given from_position, in seconds.


  • void seek ( float to_position )

Sets the position from which audio will be played, in seconds.


  • void stop ( )

Stops the audio.

doradoro's advice! Getters and Setters will be deprecated! Avoid their use!

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 2020-03-07 at 01:29:37. It's the English Stable version because it's what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.