listener_fmod.cpp

Go to the documentation of this file.
00001 
00033 #include "linden_common.h"
00034 #include "audioengine.h"
00035 
00036 #if LL_FMOD
00037 
00038 #include "listener_fmod.h"
00039 #include "fmod.h"
00040 
00041 //-----------------------------------------------------------------------
00042 // constructor
00043 //-----------------------------------------------------------------------
00044 LLListener_FMOD::LLListener_FMOD()
00045 {
00046         init();
00047 }
00048 
00049 //-----------------------------------------------------------------------
00050 LLListener_FMOD::~LLListener_FMOD()
00051 {
00052 }
00053 
00054 //-----------------------------------------------------------------------
00055 void LLListener_FMOD::init(void)
00056 {
00057         // do inherited
00058         LLListener::init();
00059         mDopplerFactor = 1.0f;
00060         mDistanceFactor = 1.0f;
00061         mRolloffFactor = 1.0f;
00062 }
00063 
00064 //-----------------------------------------------------------------------
00065 void LLListener_FMOD::translate(LLVector3 offset)
00066 {
00067         LLListener::translate(offset);
00068 
00069         FSOUND_3D_Listener_SetAttributes(mPosition.mV, NULL, mListenAt.mV[0],mListenAt.mV[1],mListenAt.mV[2], mListenUp.mV[0],mListenUp.mV[1],mListenUp.mV[2]);
00070 }
00071 
00072 //-----------------------------------------------------------------------
00073 void LLListener_FMOD::setPosition(LLVector3 pos)
00074 {
00075         LLListener::setPosition(pos);
00076 
00077         FSOUND_3D_Listener_SetAttributes(pos.mV, NULL, mListenAt.mV[0],mListenAt.mV[1],mListenAt.mV[2], mListenUp.mV[0],mListenUp.mV[1],mListenUp.mV[2]);
00078 }
00079 
00080 //-----------------------------------------------------------------------
00081 void LLListener_FMOD::setVelocity(LLVector3 vel)
00082 {
00083         LLListener::setVelocity(vel);
00084 
00085         FSOUND_3D_Listener_SetAttributes(NULL, vel.mV, mListenAt.mV[0],mListenAt.mV[1],mListenAt.mV[2], mListenUp.mV[0],mListenUp.mV[1],mListenUp.mV[2]);
00086 }
00087 
00088 //-----------------------------------------------------------------------
00089 void LLListener_FMOD::orient(LLVector3 up, LLVector3 at)
00090 {
00091         LLListener::orient(up, at);
00092 
00093         // Welcome to the transition between right and left
00094         // (coordinate systems, that is)
00095         // Leaving the at vector alone results in a L/R reversal
00096         // since DX is left-handed and we (LL, OpenGL, OpenAL) are right-handed
00097         at = -at;
00098 
00099         FSOUND_3D_Listener_SetAttributes(NULL, NULL, at.mV[0],at.mV[1],at.mV[2], up.mV[0],up.mV[1],up.mV[2]);
00100 }
00101 
00102 //-----------------------------------------------------------------------
00103 void LLListener_FMOD::commitDeferredChanges()
00104 {
00105         FSOUND_Update();
00106 }
00107 
00108 
00109 void LLListener_FMOD::setRolloffFactor(F32 factor)
00110 {
00111         mRolloffFactor = factor;
00112         FSOUND_3D_SetRolloffFactor(factor);
00113 }
00114 
00115 
00116 F32 LLListener_FMOD::getRolloffFactor()
00117 {
00118         return mRolloffFactor;
00119 }
00120 
00121 
00122 void LLListener_FMOD::setDopplerFactor(F32 factor)
00123 {
00124         mDopplerFactor = factor;
00125         FSOUND_3D_SetDopplerFactor(factor);
00126 }
00127 
00128 
00129 F32 LLListener_FMOD::getDopplerFactor()
00130 {
00131         return mDopplerFactor;
00132 }
00133 
00134 
00135 void LLListener_FMOD::setDistanceFactor(F32 factor)
00136 {
00137         mDistanceFactor = factor;
00138         FSOUND_3D_SetDistanceFactor(factor);
00139 }
00140 
00141 
00142 F32 LLListener_FMOD::getDistanceFactor()
00143 {
00144         return mDistanceFactor;
00145 }
00146 
00147 #endif  // LL_FMOD
00148 
00149 

Generated on Thu Jul 1 06:08:17 2010 for Second Life Viewer by  doxygen 1.4.7