sf::Listener Class Reference

The audio listener is the point in the scene from where all the sounds are heard. More...

#include <Listener.hpp>

List of all members.

Static Public Member Functions

static void SetGlobalVolume (float volume)
 Change the global volume of all the sounds and musics.
static float GetGlobalVolume ()
 Get the current value of the global volume.
static void SetPosition (float x, float y, float z)
 Set the position of the listener in the scene.
static void SetPosition (const Vector3f &position)
 Set the position of the listener in the scene.
static Vector3f GetPosition ()
 Get the current position of the listener in the scene.
static void SetDirection (float x, float y, float z)
 Set the orientation of the listener in the scene.
static void SetDirection (const Vector3f &direction)
 Set the orientation of the listener in the scene.
static Vector3f GetDirection ()
 Get the current orientation of the listener in the scene.

Detailed Description

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 sf::View is the eyes of the user, then sf::Listener is his ears (by the way, they are often linked together -- same position, orientation, etc.).

sf::Listener is a simple interface, which allows to setup the listener in the 3D audio environment (position and direction), and to adjust the global volume.

Because the listener is unique in the scene, sf::Listener only contains static functions and doesn't have to be instanciated.

Usage example:

 // Move the listener to the position (1, 0, -5)
 sf::Listener::SetPosition(1, 0, -5);

 // Make it face the right axis (1, 0, 0)
 sf::Listener::SetDirection(1, 0, 0);

 // Reduce the global volume
 sf::Listener::SetGlobalVolume(50);

Definition at line 42 of file Listener.hpp.


Member Function Documentation

Vector3f sf::Listener::GetDirection (  )  [static]

Get the current orientation of the listener in the scene.

Returns:
Listener's orientation
See also:
SetDirection

Definition at line 101 of file Listener.cpp.

float sf::Listener::GetGlobalVolume (  )  [static]

Get the current value of the global volume.

Returns:
Current global volume, in the range [0, 100]
See also:
SetGlobalVolume

Definition at line 44 of file Listener.cpp.

Vector3f sf::Listener::GetPosition (  )  [static]

Get the current position of the listener in the scene.

Returns:
Listener's position
See also:
SetPosition

Definition at line 72 of file Listener.cpp.

void sf::Listener::SetDirection ( const Vector3f direction  )  [static]

Set the orientation of the listener in the scene.

The orientation defines the 3D axes of the listener (left, up, front) in the scene. The orientation vector doesn't have to be normalized. The default listener's orientation is (0, 0, -1).

Parameters:
direction New listener's orientation
See also:
GetDirection, SetPosition

Definition at line 94 of file Listener.cpp.

void sf::Listener::SetDirection ( float  x,
float  y,
float  z 
) [static]

Set the orientation of the listener in the scene.

The orientation defines the 3D axes of the listener (left, up, front) in the scene. The orientation vector doesn't have to be normalized. The default listener's orientation is (0, 0, -1).

Parameters:
x X coordinate of the listener's orientation
y Y coordinate of the listener's orientation
z Z coordinate of the listener's orientation
See also:
GetDirection, SetPosition

Definition at line 84 of file Listener.cpp.

void sf::Listener::SetGlobalVolume ( float  volume  )  [static]

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).

Parameters:
volume New global volume, in the range [0, 100]
See also:
GetGlobalVolume

Definition at line 35 of file Listener.cpp.

void sf::Listener::SetPosition ( const Vector3f position  )  [static]

Set the position of the listener in the scene.

The default listener's position is (0, 0, 0).

Parameters:
position New listener's position
See also:
GetPosition, SetDirection

Definition at line 65 of file Listener.cpp.

void sf::Listener::SetPosition ( float  x,
float  y,
float  z 
) [static]

Set the position of the listener in the scene.

The default listener's position is (0, 0, 0).

Parameters:
x X coordinate of the listener's position
y Y coordinate of the listener's position
z Z coordinate of the listener's position
See also:
GetPosition, SetDirection

Definition at line 56 of file Listener.cpp.


The documentation for this class was generated from the following files: