29 #include "nomlib/audio/AL/Listener.hpp"
34 Listener::Listener (
void )
36 NOM_LOG_TRACE ( NOM );
39 ALfloat position[] = { 0.0, 0.0, 0.0 };
40 ALfloat velocity[] = { 0.0, 0.0, 0.0 };
42 ALfloat direction[] = { 0.0, 0.0, -1.0, 0.0, 1.0, 0.0 };
48 AL_CHECK_ERR ( alListenerf ( AL_GAIN, gain ) );
49 AL_CHECK_ERR ( alListenerfv ( AL_POSITION, position ) );
50 AL_CHECK_ERR ( alListenerfv ( AL_VELOCITY, velocity ) );
51 AL_CHECK_ERR ( alListenerfv ( AL_ORIENTATION, direction ) );
54 Listener::~Listener (
void )
56 NOM_LOG_TRACE ( NOM );
63 ALfloat master_volume;
65 AL_CHECK_ERR ( alGetListenerf ( AL_GAIN, &master_volume ) );
67 return master_volume * 100.f;
74 AL_CHECK_ERR ( alGetListener3f ( AL_POSITION, &position.x, &position.y, &position.z ) );
83 AL_CHECK_ERR ( alGetListener3f ( AL_VELOCITY, &velocity.x, &velocity.y, &velocity.z ) );
92 AL_CHECK_ERR ( alGetListener3f ( AL_ORIENTATION, &direction.x, &direction.y, &direction.z ) );
99 AL_CHECK_ERR ( alListener3f ( AL_POSITION, x, y, z ) );
104 this->
setPosition ( position.x, position.y, position.z );
109 AL_CHECK_ERR ( alListener3f ( AL_VELOCITY, x, y, z ) );
114 this->
setVelocity ( velocity.x, velocity.y, velocity.z );
119 AL_CHECK_ERR ( alListener3f ( AL_ORIENTATION, x, y, z ) );
124 this->
setDirection ( direction.x, direction.y, direction.z );
129 AL_CHECK_ERR ( alListenerf ( AL_GAIN, gain * 0.01f ) );
const Point3f getDirection(void) const
Obtain direction.
const Point3f getVelocity(void) const
Obtain velocity.
void setVelocity(float x, float y, float z)
Set velocity.
const Point3f getPosition(void) const
Obtain position.
float getVolume(void) const
void setPosition(float x, float y, float z)
Set position.
void setVolume(float gain)
void setDirection(float x, float y, float z)
Set direction.