Changeset 3184 for code/branches/pch/src/orxonox/sound
- Timestamp:
- Jun 15, 2009, 11:45:29 PM (15 years ago)
- Location:
- code/branches/pch/src/orxonox/sound
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/orxonox/sound/SoundBase.cc
r3157 r3184 41 41 namespace orxonox 42 42 { 43 SoundManager* SoundBase::soundmanager_s = NULL;44 45 43 SoundBase::SoundBase(WorldEntity* entity) 46 44 { 47 if(SoundBase::soundmanager_s == NULL)48 {49 SoundBase::soundmanager_s = new SoundManager();50 }51 52 45 this->source_ = 0; 53 46 this->buffer_ = 0; 54 47 this->entity_ = entity; 55 48 56 Sound Base::soundmanager_s->addSound(this);49 SoundManager::getInstance().addSound(this); 57 50 } 58 51 … … 144 137 filename = Core::getMediaPathString() + "/audio/" + filename; 145 138 146 if(!Sound Base::soundmanager_s->isSoundAvailable())139 if(!SoundManager::getInstance().isSoundAvailable()) 147 140 { 148 141 COUT(3) << "Sound: not available, skipping " << filename << std::endl; -
code/branches/pch/src/orxonox/sound/SoundBase.h
r3167 r3184 64 64 65 65 ALint getSourceState(); 66 67 static SoundManager* soundmanager_s;68 66 }; // class SoundBase 69 67 } // namepsace orxonox -
code/branches/pch/src/orxonox/sound/SoundManager.cc
r3133 r3184 38 38 namespace orxonox 39 39 { 40 SoundManager* SoundManager::singletonRef_s = NULL; 40 41 ALCdevice* SoundManager::device_s = NULL; 41 42 … … 45 46 SoundManager::SoundManager() 46 47 { 48 assert(singletonRef_s == NULL); 49 singletonRef_s = this; 50 47 51 this->soundavailable_ = true; 48 52 if(!alutInitWithoutContext(NULL,NULL)) … … 91 95 SoundManager::~SoundManager() 92 96 { 97 assert(singletonRef_s != NULL); 98 singletonRef_s = NULL; 99 93 100 alcDestroyContext(this->context_); 94 101 alcCloseDevice(SoundManager::device_s); -
code/branches/pch/src/orxonox/sound/SoundManager.h
r3177 r3184 30 30 #include "OrxonoxPrereqs.h" 31 31 32 #include <cassert> 32 33 #include <list> 33 34 #include "interfaces/Tickable.h" … … 51 52 bool isSoundAvailable(); 52 53 54 static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 55 53 56 private: 54 57 static ALCdevice* device_s; … … 57 60 bool soundavailable_; 58 61 62 static SoundManager* singletonRef_s; 59 63 }; // class SoundManager 60 64 } // namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.