Changeset 2998
- Timestamp:
- May 20, 2009, 8:31:23 PM (16 years ago)
- Location:
- code/branches/sound/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound/src/orxonox/objects/items/Engine.cc
r2982 r2998 226 226 this->ship_ = ship; 227 227 228 if(this->sound_ != NULL)229 this->sound_->attachToEntity(ship);230 231 228 if (ship) 232 229 { … … 240 237 this->boostBlur_ = 0; 241 238 } 239 240 if(this->sound_ != NULL) 241 this->sound_->attachToEntity(ship); 242 242 } 243 243 } -
code/branches/sound/src/orxonox/sound/SoundBase.cc
r2984 r2998 134 134 bool SoundBase::loadFile(std::string filename) { 135 135 filename = Core::getMediaPathString() + "/audio/" + filename; 136 137 if(!SoundBase::soundmanager_s->isSoundAvailable()) 138 { 139 COUT(3) << "Sound: not available, skipping " << filename << std::endl; 140 return false; 141 } 142 136 143 COUT(3) << "Sound: OpenAL ALUT: loading file " << filename << std::endl; 137 144 this->buffer_ = alutCreateBufferFromFile(filename.c_str()); -
code/branches/sound/src/orxonox/sound/SoundManager.cc
r2984 r2998 44 44 SoundManager::SoundManager() 45 45 { 46 this->soundavailable_ = true; 46 47 if(!alutInitWithoutContext(NULL,NULL)) 47 48 { 48 49 COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl; 50 this->soundavailable_ = false; 49 51 } 50 52 else … … 61 63 { 62 64 COUT(2) << "Sound: OpenAL: Could not open sound device" << std::endl; 65 this->soundavailable_ = false; 63 66 } 64 67 else … … 69 72 { 70 73 COUT(2) << "Sound: OpenAL: Could not create sound context" << std::endl; 74 this->soundavailable_ = false; 71 75 } 72 76 else … … 146 150 (*i)->update(); 147 151 } 152 153 /** 154 * Check if sound is available 155 */ 156 bool SoundManager::isSoundAvailable() 157 { 158 return this->soundavailable_; 159 } 148 160 } -
code/branches/sound/src/orxonox/sound/SoundManager.h
r2966 r2998 50 50 void addSound(SoundBase* sound); 51 51 void removeSound(SoundBase* sound); 52 53 52 virtual void tick(float dt); 53 bool isSoundAvailable(); 54 54 55 55 private: … … 57 57 ALCcontext* context_; 58 58 std::list<SoundBase*> soundlist_; 59 bool soundavailable_; 59 60 60 61 }; // class SoundManager
Note: See TracChangeset
for help on using the changeset viewer.