Update of /cvsroot/epfl/tgengine-0.1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21546
Modified Files:
soundmanager.cc soundmanager.h
Log Message:
Ajout d'une methode pour mettre a jour l'orientation et la position du listener
(appelee depuis Game.cc)
Index: soundmanager.cc
===================================================================
RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** soundmanager.cc 16 Oct 2004 14:05:45 -0000 1.8
--- soundmanager.cc 16 Oct 2004 14:38:28 -0000 1.9
***************
*** 2,6 ****
#include "soundmanager.h"
- #include "engine.h"
using std::string;
--- 2,5 ----
***************
*** 23,27 ****
#endif
! init();
}
--- 22,26 ----
#endif
! Init();
}
***************
*** 38,42 ****
// Intialisation
! void SoundManager::init()
{
#ifdef SOUND_DEBUG
--- 37,41 ----
// Intialisation
! void SoundManager::Init()
{
#ifdef SOUND_DEBUG
***************
*** 120,123 ****
--- 119,138 ----
}
+ // Update Listener orientation and position
+ void SoundManager::UpdateListener(Camera* ListenerCam)
+ {
+ #ifdef SOUND_DEBUG
+ //cout << "OpenAL:: UpdateListener" << endl;
+ #endif
+
+ Vector3 ListenerPosition = ListenerCam->GetPosition();
+
+ Vector3 ListenerForward = ListenerCam->GetForward();
+ Vector3 ListenerUp = ListenerCam->GetUp();
+
+ pSoundManager->SetListenerPosition(ListenerPosition.x,ListenerPosition.y,ListenerPosition.z);
+ pSoundManager->SetListenerOrientation(ListenerForward.x,ListenerForward.y,ListenerForward.z,ListenerUp.x,ListenerUp.y,ListenerUp.z);
+ }
+
// Creat a new buffer for a sound
ALuint SoundManager::LoadWavALBuffer(char path[40])
Index: soundmanager.h
===================================================================
RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** soundmanager.h 14 Oct 2004 13:46:47 -0000 1.3
--- soundmanager.h 16 Oct 2004 14:38:28 -0000 1.4
***************
*** 23,26 ****
--- 23,28 ----
#include <vorbis/vorbisfile.h>
+ #include "engine.h"
+
#define BUFFER_SIZE 32768 // 32 KB buffers
***************
*** 51,62 ****
void PlaySound(string name);
void StopSound(string name);
-
int SoundStatus(string name);
void SetSoundVolume(string name, float x);
-
void SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz);
void SetListenerPosition(float x, float y, float z);
void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz);
void KillALData();
--- 53,64 ----
void PlaySound(string name);
void StopSound(string name);
int SoundStatus(string name);
void SetSoundVolume(string name, float x);
void SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz);
+
void SetListenerPosition(float x, float y, float z);
void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz);
+ void UpdateListener(Camera* ListenerCam);
void KillALData();
***************
*** 69,74 ****
int endian; // 0 for Little-Endian, 1 for Big-Endian
! void init();
!
string GetALErrorString(ALenum err);
string GetALCErrorString(ALenum err);
--- 71,76 ----
int endian; // 0 for Little-Endian, 1 for Big-Endian
! void Init();
!
string GetALErrorString(ALenum err);
string GetALCErrorString(ALenum err);
|