00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "audioint.h"
00011 #include "listener.h"
00012 using namespace MMAudio;
00013
00014 float Listener::getGain(void) {
00015 ALfloat gain;
00016 audioResetAlErrors();
00017 alGetListenerf(AL_GAIN, &gain);
00018 audioCheckAlErrors();
00019 return gain;
00020 }
00021
00022 void Listener::setGain(float f) {
00023 ALLock lock;
00024 audioResetAlErrors();
00025 alListenerf(AL_GAIN,f);
00026 audioCheckAlErrors();
00027 }
00028
00029 Vector3 Listener::getPosition(void) {
00030 Vector3 pos;
00031 audioResetAlErrors();
00032 alGetListenerfv(AL_POSITION,(ALfloat*)&pos);
00033 audioCheckAlErrors();
00034 return pos;
00035 }
00036
00037 void Listener::setPosition(Vector3 pos) {
00038 ALLock lock;
00039 audioResetAlErrors();
00040 alListenerfv(AL_POSITION,(ALfloat*)&pos);
00041 audioCheckAlErrors();
00042 }
00043
00044 Vector3 Listener::getVelocity(void) {
00045 Vector3 pos;
00046 audioResetAlErrors();
00047 alGetListenerfv(AL_VELOCITY,(ALfloat*)&pos);
00048 audioCheckAlErrors();
00049 return pos;
00050 }
00051
00052 void Listener::setVelocity(Vector3 pos) {
00053 ALLock lock;
00054 audioResetAlErrors();
00055 alListenerfv(AL_VELOCITY,(ALfloat*)&pos);
00056 audioCheckAlErrors();
00057 }
00058
00059 void Listener::getOrientation(Vector3& at, Vector3& up) {
00060 ALfloat ori[6];
00061
00062 audioResetAlErrors();
00063 alGetListenerfv(AL_ORIENTATION,ori);
00064 audioCheckAlErrors();
00065
00066 at.Set(ori[0],ori[1],ori[2]);
00067 up.Set(ori[3],ori[4],ori[5]);
00068 }
00069
00070 void Listener::setOrientation(const Vector3& at, const Vector3& up) {
00071 ALfloat ori[6] = {
00072 at.x, at.y, at.z,
00073 up.x, up.y, up.z,
00074 };
00075 ALLock lock;
00076 audioResetAlErrors();
00077 alListenerfv(AL_ORIENTATION, ori);
00078 audioCheckAlErrors();
00079 }