AudioStreamPlayer2D

    Plays audio in 2D.

    Plays audio that dampens with distance from screen center.

    Tutorials

    Methods

    get_playback_position ( )
    get_stream_playback ( )
    void ( float from_position=0.0 )
    void ( float to_position )
    void ( )
    • finished ( )

    Emitted when the audio stops playing.

    Property Descriptions

    Default1
    Setterset_area_mask(value)
    Getterget_area_mask()

    Areas in which this sound plays.


    • attenuation
    Default1.0
    Setterset_attenuation(value)
    Getterget_attenuation()

    Dampens audio over distance with this as an exponent.



    • bus
    Default“Master”
    Setterset_bus(value)
    Getterget_bus()

    Bus on which this audio is playing.


    Default2000.0
    Setterset_max_distance(value)
    Getterget_max_distance()

    Maximum distance from which audio is still hearable.


    • pitch_scale
    Default1.0
    Setterset_pitch_scale(value)
    Getterget_pitch_scale()

    The pitch and the tempo of the audio, as a multiplier of the audio sample’s sample rate.


    If true, audio is playing.


    Setterset_stream(value)
    Getterget_stream()

    The object to be played.


    Defaultfalse
    Setterset_stream_paused(value)
    Getterget_stream_paused()

    • volume_db
    Default0.0
    Setterset_volume_db(value)
    Getterget_volume_db()

    Base volume without dampening.

    • float get_playback_position ( )

    Returns the position in the .


    Returns the object associated with this AudioStreamPlayer2D.


    • void play ( float from_position=0.0 )

    Plays the audio from the given position , in seconds.


    • void seek ( to_position )

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