Changeset 3196 for code/trunk/src/orxonox/sound
- Timestamp:
- Jun 20, 2009, 9:20:47 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pch (added) merged: 3114-3118,3124-3125,3127-3131,3133,3138-3194
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/sound/CMakeLists.txt
r3078 r3196 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 SoundManager.h3 SoundBase.h4 SoundMainMenu.h5 6 2 SoundManager.cc 7 3 SoundBase.cc -
code/trunk/src/orxonox/sound/SoundBase.cc
r3108 r3196 26 26 * 27 27 */ 28 29 #include "SoundBase.h" 30 31 #include <string> 28 32 #include <vector> 29 33 #include <AL/alut.h> 30 34 #include <vorbis/vorbisfile.h> 31 35 36 #include "util/Math.h" 37 #include "core/Core.h" 32 38 #include "orxonox/objects/worldentities/WorldEntity.h" 33 #include "util/Math.h"34 #include "SoundBase.h"35 39 #include "SoundManager.h" 36 #include "core/Core.h"37 40 38 41 namespace orxonox 39 42 { 40 SoundManager* SoundBase::soundmanager_s = NULL;41 42 43 SoundBase::SoundBase(WorldEntity* entity) 43 44 { 44 if(SoundBase::soundmanager_s == NULL)45 {46 SoundBase::soundmanager_s = new SoundManager();47 }48 49 45 this->source_ = 0; 50 46 this->buffer_ = 0; 51 47 this->entity_ = entity; 52 48 53 Sound Base::soundmanager_s->addSound(this);49 SoundManager::getInstance().addSound(this); 54 50 } 55 51 … … 141 137 filename = Core::getMediaPathString() + "/audio/" + filename; 142 138 143 if(!Sound Base::soundmanager_s->isSoundAvailable())139 if(!SoundManager::getInstance().isSoundAvailable()) 144 140 { 145 141 COUT(3) << "Sound: not available, skipping " << filename << std::endl; … … 179 175 } 180 176 181 ALuint SoundBase::loadOggFile( std::stringfilename)177 ALuint SoundBase::loadOggFile(const std::string& filename) 182 178 { 183 179 char inbuffer[4096]; -
code/trunk/src/orxonox/sound/SoundBase.h
r3078 r3196 26 26 * 27 27 */ 28 #ifndef _SOUNDBASE_H__ 29 #define _SOUNDBASE_H__ 30 31 #include <AL/al.h> 32 #include <string> 28 #ifndef _SoundBase_H__ 29 #define _SoundBase_H__ 33 30 34 31 #include "OrxonoxPrereqs.h" 32 #include <cstring> // define NULL 35 33 36 34 namespace orxonox … … 60 58 61 59 private: 62 ALuint loadOggFile( std::stringfilename);60 ALuint loadOggFile(const std::string& filename); 63 61 ALuint source_; 64 62 ALuint buffer_; … … 66 64 67 65 ALint getSourceState(); 68 69 static SoundManager* soundmanager_s;70 66 }; // class SoundBase 71 67 } // namepsace orxonox 72 68 73 #endif / / _SOUNDBASE_H__69 #endif /* _SoundBase_H__ */ -
code/trunk/src/orxonox/sound/SoundMainMenu.cc
r3078 r3196 28 28 29 29 #include "SoundMainMenu.h" 30 30 31 #include "core/CoreIncludes.h" 31 32 #include "core/ConfigValueIncludes.h" -
code/trunk/src/orxonox/sound/SoundMainMenu.h
r3078 r3196 27 27 */ 28 28 29 #ifndef _SOUNDMAINMENU_H__ 30 #define _SOUNDMAINMENU_H__ 29 #ifndef _SoundMainMenu_H__ 30 #define _SoundMainMenu_H__ 31 32 #include "OrxonoxPrereqs.h" 31 33 32 34 #include <string> 33 34 35 #include "core/OrxonoxClass.h" 35 #include "OrxonoxPrereqs.h"36 36 #include "SoundBase.h" 37 37 … … 48 48 }; 49 49 } 50 #endif 50 51 #endif /* _SoundMainMenu_H__ */ -
code/trunk/src/orxonox/sound/SoundManager.cc
r3108 r3196 27 27 */ 28 28 29 #include "SoundManager.h" 30 29 31 #include <AL/alut.h> 30 32 33 #include "util/Math.h" 31 34 #include "orxonox/CameraManager.h" 32 35 #include "orxonox/objects/worldentities/Camera.h" 33 #include "util/Math.h"34 36 #include "SoundBase.h" 35 #include "SoundManager.h"36 37 37 38 namespace orxonox 38 39 { 40 SoundManager* SoundManager::singletonRef_s = NULL; 39 41 ALCdevice* SoundManager::device_s = NULL; 40 42 … … 44 46 SoundManager::SoundManager() 45 47 { 48 assert(singletonRef_s == NULL); 49 singletonRef_s = this; 50 46 51 this->soundavailable_ = true; 47 52 if(!alutInitWithoutContext(NULL,NULL)) … … 90 95 SoundManager::~SoundManager() 91 96 { 97 assert(singletonRef_s != NULL); 98 singletonRef_s = NULL; 99 92 100 alcDestroyContext(this->context_); 93 101 alcCloseDevice(SoundManager::device_s); -
code/trunk/src/orxonox/sound/SoundManager.h
r3078 r3196 25 25 * ... 26 26 */ 27 #ifndef _SOUNDMANGER_H__ 28 #define _SOUNDMANGER_H__ 29 30 #include <AL/al.h> 31 #include <AL/alc.h> 27 #ifndef _SoundManager_H__ 28 #define _SoundManager_H__ 32 29 33 30 #include "OrxonoxPrereqs.h" 34 #include "orxonox/objects/Tickable.h" 31 32 #include <cassert> 33 #include <list> 34 #include "interfaces/Tickable.h" 35 35 36 36 namespace orxonox … … 49 49 void addSound(SoundBase* sound); 50 50 void removeSound(SoundBase* sound); 51 v irtual void tick(float dt);51 void tick(float dt); 52 52 bool isSoundAvailable(); 53 54 static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 53 55 54 56 private: … … 58 60 bool soundavailable_; 59 61 62 static SoundManager* singletonRef_s; 60 63 }; // class SoundManager 61 64 } // namespace orxonox 62 65 63 #endif / / _SOUNDMANAGER_H__66 #endif /* _SoundManager_H__ */
Note: See TracChangeset
for help on using the changeset viewer.