X-Git-Url: http://git.tdb.fi/?p=libs%2Fal.git;a=blobdiff_plain;f=source%2Flistener.cpp;h=00751488f2b44e464cfde234ddc8a4033b73d4b3;hp=74c50c9cc844a480d8195a3478af89a66688e6cf;hb=2964e0cbc2fd4d6b838cc5f0598db1318fb4c529;hpb=641dea4e9e0dad7389d49e70234cf792174ff0e9 diff --git a/source/listener.cpp b/source/listener.cpp index 74c50c9..0075148 100644 --- a/source/listener.cpp +++ b/source/listener.cpp @@ -3,35 +3,51 @@ namespace Msp { namespace AL { +Listener::Listener() +{ + orientation[0] = 0; + orientation[1] = 0; + orientation[2] = -1; + orientation[3] = 0; + orientation[4] = 1; + orientation[5] = 0; +} + Listener &Listener::instance() { static Listener listener; return listener; } -void Listener::attribute(ALenum attr, float v) +void Listener::set_position(float x, float y, float z) { - alListenerf(attr, v); + alListener3f(AL_POSITION, x, y, z); } -void Listener::attribute(ALenum attr, float v0, float v1, float v2) +void Listener::set_forward_direction(float x, float y, float z) { - alListener3f(attr, v0, v1, v2); + orientation[0] = x; + orientation[1] = y; + orientation[2] = z; + alListenerfv(AL_ORIENTATION, orientation); } -void Listener::attribute(ALenum attr, const float *v) +void Listener::set_up_direction(float x, float y, float z) { - alListenerfv(attr, v); + orientation[3] = x; + orientation[4] = y; + orientation[5] = z; + alListenerfv(AL_ORIENTATION, orientation); } -void Listener::set_position(float x, float y, float z) +void Listener::set_velocity(float x, float y, float z) { - attribute(AL_POSITION, x, y, z); + alListener3f(AL_VELOCITY, x, y, z); } void Listener::set_gain(float g) { - attribute(AL_GAIN, g); + alListenerf(AL_GAIN, g); } } // namespace AL