.. index:: pair: class; EE::Audio::Listener .. _doxid-class_e_e_1_1_audio_1_1_listener: class EE::Audio::Listener ========================= .. toctree:: :hidden: Overview ~~~~~~~~ The audio listener is the point in the scene from where all the sounds are heard. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Listener { public: // methods static void :ref:`setGlobalVolume`(float volume); static float :ref:`getGlobalVolume`(); static void :ref:`setPosition`(float x, float y, float z); static void :ref:`setPosition`(const :ref:`Vector3f`& position); static :ref:`Vector3f` :ref:`getPosition`(); static void :ref:`setDirection`(float x, float y, float z); static void :ref:`setDirection`(const :ref:`Vector3f`& direction); static :ref:`Vector3f` :ref:`getDirection`(); static void :ref:`setUpVector`(float x, float y, float z); static void :ref:`setUpVector`(const :ref:`Vector3f`& upVector); static :ref:`Vector3f` :ref:`getUpVector`(); }; .. _details-class_e_e_1_1_audio_1_1_listener: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ The audio listener is the point in the scene from where all the sounds are heard. The audio listener defines the global properties of the audio environment, it defines where and how sounds and musics are heard. If View is the eyes of the user, then :ref:`Listener ` is his ears (by the way, they are often linked together same position, orientation, etc.). :ref:`Listener ` is a simple interface, which allows to setup the listener in the 3D audio environment (position, direction and up vector), and to adjust the global volume. Because the listener is unique in the scene, :ref:`Listener ` only contains static functions and doesn't have to be instantiated. Usage example: .. ref-code-block:: cpp // Move the listener to the position (1, 0, -5) Listener::setPosition(1, 0, -5); // Make it face the right axis (1, 0, 0) Listener::setDirection(1, 0, 0); // Reduce the global volume Listener::setGlobalVolume(50); Methods ------- .. index:: pair: function; setGlobalVolume .. _doxid-class_e_e_1_1_audio_1_1_listener_1aaf0228b0301d74e1c7e7da88816fe843: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setGlobalVolume(float volume) Change the global volume of all the sounds and musics. The volume is a number between 0 and 100; it is combined with the individual volume of each sound / music. The default value for the volume is 100 (maximum). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - volume - New global volume, in the range [0, 100] .. rubric:: See also: :ref:`getGlobalVolume ` .. index:: pair: function; getGlobalVolume .. _doxid-class_e_e_1_1_audio_1_1_listener_1a97cef64376f46709811aa224d641dfab: .. ref-code-block:: cpp :class: doxyrest-title-code-block static float getGlobalVolume() Get the current value of the global volume. .. rubric:: Returns: Current global volume, in the range [0, 100] .. rubric:: See also: :ref:`setGlobalVolume ` .. index:: pair: function; setPosition .. _doxid-class_e_e_1_1_audio_1_1_listener_1a4213f772e1785825862553f19f455a97: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setPosition(float x, float y, float z) Set the position of the listener in the scene. The default listener's position is (0, 0, 0). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - X coordinate of the listener's position * - y - Y coordinate of the listener's position * - z - Z coordinate of the listener's position .. rubric:: See also: :ref:`getPosition `, :ref:`setDirection ` .. index:: pair: function; setPosition .. _doxid-class_e_e_1_1_audio_1_1_listener_1acee1cdf28813bc359b6c4da1d35bd74c: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setPosition(const :ref:`Vector3f`& position) Set the position of the listener in the scene. The default listener's position is (0, 0, 0). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - position - New listener's position .. rubric:: See also: :ref:`getPosition `, :ref:`setDirection ` .. index:: pair: function; getPosition .. _doxid-class_e_e_1_1_audio_1_1_listener_1aebf6b7b6c89ef048edd08824b2a63701: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`Vector3f` getPosition() Get the current position of the listener in the scene. .. rubric:: Returns: :ref:`Listener ` 's position .. rubric:: See also: :ref:`setPosition ` .. index:: pair: function; setDirection .. _doxid-class_e_e_1_1_audio_1_1_listener_1a3a99b41ccf02bba37d7617b1518ef5d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setDirection(float x, float y, float z) Set the forward vector of the listener in the scene. The direction (also called "at vector") is the vector pointing forward from the listener's perspective. Together with the up vector, it defines the 3D orientation of the listener in the scene. The direction vector doesn't have to be normalized. The default listener's direction is (0, 0, -1). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - X coordinate of the listener's direction * - y - Y coordinate of the listener's direction * - z - Z coordinate of the listener's direction .. rubric:: See also: :ref:`getDirection `, :ref:`setUpVector `, :ref:`setPosition ` .. index:: pair: function; setDirection .. _doxid-class_e_e_1_1_audio_1_1_listener_1a0fa85d9818c41bbb9d86f9c46376a26e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setDirection(const :ref:`Vector3f`& direction) Set the forward vector of the listener in the scene. The direction (also called "at vector") is the vector pointing forward from the listener's perspective. Together with the up vector, it defines the 3D orientation of the listener in the scene. The direction vector doesn't have to be normalized. The default listener's direction is (0, 0, -1). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - direction - New listener's direction .. rubric:: See also: :ref:`getDirection `, :ref:`setUpVector `, :ref:`setPosition ` .. index:: pair: function; getDirection .. _doxid-class_e_e_1_1_audio_1_1_listener_1aa3539f9e8d11d85fc85548fd88eecd63: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`Vector3f` getDirection() Get the current forward vector of the listener in the scene. .. rubric:: Returns: :ref:`Listener ` 's forward vector (not normalized) .. rubric:: See also: :ref:`setDirection ` .. index:: pair: function; setUpVector .. _doxid-class_e_e_1_1_audio_1_1_listener_1a03b604f86c304329e2a2c52be3b0ddb2: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setUpVector(float x, float y, float z) Set the upward vector of the listener in the scene. The up vector is the vector that points upward from the listener's perspective. Together with the direction, it defines the 3D orientation of the listener in the scene. The up vector doesn't have to be normalized. The default listener's up vector is (0, 1, 0). It is usually not necessary to change it, especially in 2D scenarios. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - X coordinate of the listener's up vector * - y - Y coordinate of the listener's up vector * - z - Z coordinate of the listener's up vector .. rubric:: See also: :ref:`getUpVector `, :ref:`setDirection `, :ref:`setPosition ` .. index:: pair: function; setUpVector .. _doxid-class_e_e_1_1_audio_1_1_listener_1ab2237ff686f88e3be92fda5ccac12aee: .. ref-code-block:: cpp :class: doxyrest-title-code-block static void setUpVector(const :ref:`Vector3f`& upVector) Set the upward vector of the listener in the scene. The up vector is the vector that points upward from the listener's perspective. Together with the direction, it defines the 3D orientation of the listener in the scene. The up vector doesn't have to be normalized. The default listener's up vector is (0, 1, 0). It is usually not necessary to change it, especially in 2D scenarios. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - upVector - New listener's up vector .. rubric:: See also: :ref:`getUpVector `, :ref:`setDirection `, :ref:`setPosition ` .. index:: pair: function; getUpVector .. _doxid-class_e_e_1_1_audio_1_1_listener_1a47dd0dec219251bf2ee91dae0dabffb3: .. ref-code-block:: cpp :class: doxyrest-title-code-block static :ref:`Vector3f` getUpVector() Get the current upward vector of the listener in the scene. .. rubric:: Returns: :ref:`Listener ` 's upward vector (not normalized) .. rubric:: See also: :ref:`setUpVector `