:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Listener2D.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Listener2D: Listener2D ========== **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` Overrides the location sounds are heard from. Description ----------- Once added to the scene tree and enabled using :ref:`make_current`, this node will override the location sounds are heard from. Only one ``Listener2D`` can be current. Using :ref:`make_current` will disable the previous ``Listener2D``. If there is no active ``Listener2D`` in the current :ref:`Viewport`, center of the screen will be used as a hearing point for the audio. ``Listener2D`` needs to be inside :ref:`SceneTree` to function. Methods ------- +-------------------------+---------------------------------------------------------------------------+ | void | :ref:`clear_current` **(** **)** | +-------------------------+---------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_current` **(** **)** |const| | +-------------------------+---------------------------------------------------------------------------+ | void | :ref:`make_current` **(** **)** | +-------------------------+---------------------------------------------------------------------------+ Method Descriptions ------------------- .. _class_Listener2D_method_clear_current: - void **clear_current** **(** **)** Disables the ``Listener2D``. If it's not set as current, this method will have no effect. ---- .. _class_Listener2D_method_is_current: - :ref:`bool` **is_current** **(** **)** |const| Returns ``true`` if this ``Listener2D`` is currently active. ---- .. _class_Listener2D_method_make_current: - void **make_current** **(** **)** Makes the ``Listener2D`` active, setting it as the hearing point for the sounds. If there is already another active ``Listener2D``, it will be disabled. This method will have no effect if the ``Listener2D`` is not added to :ref:`SceneTree`. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`