AudioStreamPlayer2D

Inherits: Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

Plays audio in 2D.

Member Functions

float get_playback_position ( )
void play ( float from_position=0.0 )
void seek ( float to_position )
void stop ( )

Signals

  • finished ( )

Emitted when the audio stops playing.

Member Variables

  • int area_mask - Areas in which this sound plays.
  • float attenuation - Dampens audio over distance with this as an exponent.
  • bool autoplay - If true audio plays when added to scene tree. Default value: false.
  • String bus - Bus on which this audio is playing.
  • float max_distance - Maximum distance from which audio is still hearable.
  • float pitch_scale - Changes the pitch and the tempo of the audio.
  • bool playing - If true audio is playing.
  • AudioStream stream - The AudioStream object to be played.
  • float volume_db - Base volume without dampening.

Description

Plays audio that dampens with distance from screen center.

Member Function Description

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