AudioStreamPlayer2D

Inherits: Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

Plays audio in 2D.

Properties

intarea_mask
floatattenuation
boolautoplay
Stringbus
floatmax_distance
floatpitch_scale
boolplaying
AudioStreamstream
boolstream_paused
floatvolume_db

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.

Description

Plays audio that dampens with distance from screen center.

Tutorials

Property Descriptions

Setterset_area_mask(value)
Getterget_area_mask()

Areas in which this sound plays.


Setterset_attenuation(value)
Getterget_attenuation()

Dampens audio over distance with this as an exponent.


Setterset_autoplay(value)
Getteris_autoplay_enabled()

If true, audio plays when added to scene tree. Default value: false.


Setterset_bus(value)
Getterget_bus()

Bus on which this audio is playing.


Setterset_max_distance(value)
Getterget_max_distance()

Maximum distance from which audio is still hearable.


Setterset_pitch_scale(value)
Getterget_pitch_scale()

Changes the pitch and the tempo of the audio.


Getteris_playing()

If true, audio is playing.


Setterset_stream(value)
Getterget_stream()

The AudioStream object to be played.


Setterset_stream_paused(value)
Getterget_stream_paused()

Setterset_volume_db(value)
Getterget_volume_db()

Base volume without dampening.

Method Descriptions

  • float get_playback_position ( )

Returns the position in the AudioStream.



  • 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.