Plays audio in 2D.
    public class AudioStreamPlayer2D : Node2D

Plays audio that dampens with distance from screen center.

Inheritance Chain


    public AudioStreamPlayer2D()


    "finished" ()

Emitted when the audio stops playing.


    public int AreaMask { get; set; }

Areas in which this sound plays.

    public float Attenuation { get; set; }

Dampens audio over distance with this as an exponent.

    public bool Autoplay { get; set; }

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

    public string Bus { get; set; }

Bus on which this audio is playing.

    public float MaxDistance { get; set; }

Maximum distance from which audio is still hearable.

    public bool Playing { get; set; }

If true audio is playing.

    public AudioStream Stream { get; set; }

The AudioStream object to be played.

    public float VolumeDb { get; set; }

Base volume without dampening.


    public int GetAreaMask()

Getter for AreaMask

    public float GetAttenuation()

Getter for Attenuation

    public string GetBus()

Getter for Bus

    public float GetMaxDistance()

Getter for MaxDistance

    public float GetPlaybackPosition()

Returns the position in the AudioStream.

    public AudioStream GetStream()

Getter for Stream

    public float GetVolumeDb()

Getter for VolumeDb

    public bool IsAutoplayEnabled()

Getter for Autoplay

    public bool IsPlaying()

Getter for Playing

    public void Play(float fromPosition = 0f)

Plays the audio from the given position ‘from_position’, in seconds.

    public void Seek(float toPosition)

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

    public void SetAreaMask(int mask)

Setter for AreaMask

    public void SetAttenuation(float curve)

Setter for Attenuation

    public void SetAutoplay(bool enable)

Setter for Autoplay

    public void SetBus(string bus)

Setter for Bus

    public void SetMaxDistance(float pixels)

Setter for MaxDistance

    public void SetStream(AudioStream stream)

Setter for Stream

    public void SetVolumeDb(float volumeDb)

Setter for VolumeDb

    public void Stop()

Stops the audio.