AudioStreamPlayer¶
Category: Core
Brief Description¶
Plays back audio.
Properties¶
bool | autoplay |
String | bus |
MixTarget | mix_target |
float | pitch_scale |
bool | playing |
AudioStream | stream |
bool | stream_paused |
float | volume_db |
Methods¶
float | get_playback_position ( ) |
AudioStreamPlayback | get_stream_playback ( ) |
void | play ( float from_position=0.0 ) |
void | seek ( float to_position ) |
void | stop ( ) |
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.
Description¶
Plays background audio.
Tutorials¶
Property Descriptions¶
- bool autoplay
Setter | set_autoplay(value) |
Getter | is_autoplay_enabled() |
If true
, audio plays when added to scene tree. Default value: false
.
- String bus
Setter | set_bus(value) |
Getter | get_bus() |
Bus on which this audio is playing.
- MixTarget mix_target
Setter | set_mix_target(value) |
Getter | get_mix_target() |
If the audio configuration has more than two speakers, this sets the target channels. See MIX_TARGET_*
constants.
- float pitch_scale
Setter | set_pitch_scale(value) |
Getter | get_pitch_scale() |
Changes the pitch and the tempo of the audio.
- bool playing
Getter | is_playing() |
If true
, audio is playing.
- AudioStream stream
Setter | set_stream(value) |
Getter | get_stream() |
The AudioStream object to be played.
- bool stream_paused
Setter | set_stream_paused(value) |
Getter | get_stream_paused() |
- float volume_db
Setter | set_volume_db(value) |
Getter | get_volume_db() |
Volume of sound, in dB.
Method Descriptions¶
- float get_playback_position ( )
Returns the position in the AudioStream in seconds.
- AudioStreamPlayback get_stream_playback ( )
- void play ( float from_position=0.0 )
Plays the audio from the given position ‘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.