C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/SoundManager.h

Go to the documentation of this file.
00001 #ifndef SOUND_MANAGER_H
00002 #define SOUND_MANAGER_H
00003 
00004 #include "GameEnginePrerequisites.h"
00005 #include "Vector3.h"
00006 #include "Quaternion.h"
00007 #include "Process.h"
00008 #include "GameApp.h"
00009 #include "Singleton.h"
00010 #include "al.h"
00011 #include "alc.h"
00012 #include "AL/alut.h"
00013 #include <conio.h>
00014 #include <stdlib.h>
00015 
00016 // These values are dependant on hardware avaiable
00017 // TODO - Check for hardware for correct values!
00018 #define MAX_NUM_BUFFERS 64
00019 #define MAX_NUM_SOURCES 40
00020 
00021 
00022 namespace GameEngine {
00023 
00024         class GameApp;
00025         
00038         class ENGINE_DECL SoundManager: public Process, public GameEngine::Singleton<SoundManager> {
00039         public:
00044                 SoundManager(GameApp* application);
00045                 
00048                 virtual ~SoundManager();
00049 
00050                 
00051                 
00056                 bool init();
00057 
00058 
00059 
00064                 void setListenerNode(Ogre::SceneNode* listenerNode);
00065 
00066                 
00067                 
00074                 bool loadSound(std::string fileName, ALuint *bufferId);
00075                 
00085                 bool playSound(ALuint bufId, ALuint* soundId, bool loop, Vector3 position, Vector3 velocity);
00086 
00087                 
00088                 
00094                 bool stopSound(ALuint soundId);
00095                 
00100                 bool stopAllSounds();
00101 
00102 
00103                 
00109                 void update(const double& dt);
00110 
00111                 
00112         private:
00113                 GameApp* mApplication;
00114 
00115                 ALCdevice* mAudioDevice;
00116                 ALCcontext* mAudioContext;
00117 
00118                 ALuint mAudioBuffers[MAX_NUM_BUFFERS];
00119                 bool mBufferInUse[MAX_NUM_BUFFERS];
00120                 ALuint mBuffersUsed;
00121 
00122                 ALuint mAudioSources[MAX_NUM_SOURCES];
00123                 bool mSourceInUse[MAX_NUM_SOURCES];
00124                 ALuint mSourcesUsed;
00125 
00126                 Ogre::SceneNode* mListenerNode;
00127 
00130                 bool loadWavFile(std::string fileName, ALuint destAudioBuffId);
00131                 
00134                 bool loadOggFile(std::string fileName, ALuint destAudioBuffId);
00135 
00136 
00144                 bool setListenerPos( Vector3 pos, Vector3 vel, Quaternion ori );
00145 
00146         };
00147 
00148 }
00149 
00150 #endif

Generated on Thu Apr 19 09:47:02 2007 for GameEngine by  doxygen 1.5.2