:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the AudioStreamPlayer2D.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_AudioStreamPlayer2D: AudioStreamPlayer2D =================== **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Plays audio in 2D. Properties ---------- +---------------------------------------+------------------------------------------------------------------------+ | :ref:`int` | :ref:`area_mask` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`float` | :ref:`attenuation` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`bool` | :ref:`autoplay` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`String` | :ref:`bus` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`float` | :ref:`max_distance` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`float` | :ref:`pitch_scale` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`bool` | :ref:`playing` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`AudioStream` | :ref:`stream` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`bool` | :ref:`stream_paused` | +---------------------------------------+------------------------------------------------------------------------+ | :ref:`float` | :ref:`volume_db` | +---------------------------------------+------------------------------------------------------------------------+ Methods ------- +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_playback_position` **(** **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | :ref:`AudioStreamPlayback` | :ref:`get_stream_playback` **(** **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`float` from_position=0.0 **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`float` to_position **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop` **(** **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_AudioStreamPlayer2D_signal_finished: - **finished** **(** **)** Emitted when the audio stops playing. Description ----------- Plays audio that dampens with distance from screen center. Tutorials --------- - :doc:`../tutorials/audio/audio_streams` Property Descriptions --------------------- .. _class_AudioStreamPlayer2D_property_area_mask: - :ref:`int` **area_mask** +----------+----------------------+ | *Setter* | set_area_mask(value) | +----------+----------------------+ | *Getter* | get_area_mask() | +----------+----------------------+ Areas in which this sound plays. ---- .. _class_AudioStreamPlayer2D_property_attenuation: - :ref:`float` **attenuation** +----------+------------------------+ | *Setter* | set_attenuation(value) | +----------+------------------------+ | *Getter* | get_attenuation() | +----------+------------------------+ Dampens audio over distance with this as an exponent. ---- .. _class_AudioStreamPlayer2D_property_autoplay: - :ref:`bool` **autoplay** +----------+-----------------------+ | *Setter* | set_autoplay(value) | +----------+-----------------------+ | *Getter* | is_autoplay_enabled() | +----------+-----------------------+ If ``true``, audio plays when added to scene tree. Default value: ``false``. ---- .. _class_AudioStreamPlayer2D_property_bus: - :ref:`String` **bus** +----------+----------------+ | *Setter* | set_bus(value) | +----------+----------------+ | *Getter* | get_bus() | +----------+----------------+ Bus on which this audio is playing. ---- .. _class_AudioStreamPlayer2D_property_max_distance: - :ref:`float` **max_distance** +----------+-------------------------+ | *Setter* | set_max_distance(value) | +----------+-------------------------+ | *Getter* | get_max_distance() | +----------+-------------------------+ Maximum distance from which audio is still hearable. ---- .. _class_AudioStreamPlayer2D_property_pitch_scale: - :ref:`float` **pitch_scale** +----------+------------------------+ | *Setter* | set_pitch_scale(value) | +----------+------------------------+ | *Getter* | get_pitch_scale() | +----------+------------------------+ Changes the pitch and the tempo of the audio. ---- .. _class_AudioStreamPlayer2D_property_playing: - :ref:`bool` **playing** +----------+--------------+ | *Getter* | is_playing() | +----------+--------------+ If ``true``, audio is playing. ---- .. _class_AudioStreamPlayer2D_property_stream: - :ref:`AudioStream` **stream** +----------+-------------------+ | *Setter* | set_stream(value) | +----------+-------------------+ | *Getter* | get_stream() | +----------+-------------------+ The :ref:`AudioStream` object to be played. ---- .. _class_AudioStreamPlayer2D_property_stream_paused: - :ref:`bool` **stream_paused** +----------+--------------------------+ | *Setter* | set_stream_paused(value) | +----------+--------------------------+ | *Getter* | get_stream_paused() | +----------+--------------------------+ ---- .. _class_AudioStreamPlayer2D_property_volume_db: - :ref:`float` **volume_db** +----------+----------------------+ | *Setter* | set_volume_db(value) | +----------+----------------------+ | *Getter* | get_volume_db() | +----------+----------------------+ Base volume without dampening. Method Descriptions ------------------- .. _class_AudioStreamPlayer2D_method_get_playback_position: - :ref:`float` **get_playback_position** **(** **)** Returns the position in the :ref:`AudioStream`. ---- .. _class_AudioStreamPlayer2D_method_get_stream_playback: - :ref:`AudioStreamPlayback` **get_stream_playback** **(** **)** ---- .. _class_AudioStreamPlayer2D_method_play: - void **play** **(** :ref:`float` from_position=0.0 **)** Plays the audio from the given position 'from_position', in seconds. ---- .. _class_AudioStreamPlayer2D_method_seek: - void **seek** **(** :ref:`float` to_position **)** Sets the position from which audio will be played, in seconds. ---- .. _class_AudioStreamPlayer2D_method_stop: - void **stop** **(** **)** Stops the audio.