Changeset 6340 for code/branches
- Timestamp:
- Dec 13, 2009, 5:39:22 PM (15 years ago)
- Location:
- code/branches/presentation2/src/orxonox/sound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/sound/BaseSound.cc
r6327 r6340 224 224 225 225 this->source_ = source; 226 // Don't load "" 226 227 if (source_.empty()) 227 228 return; 228 229 230 // Get new sound buffer 229 231 this->soundBuffer_ = SoundManager::getInstance().getSoundBuffer(this->source_); 230 232 if (this->soundBuffer_ == NULL) 231 233 return; 232 234 233 if (alIsSource(this->audioSource_)) 234 { 235 if (alIsSource(this->audioSource_)) // already playing or paused 236 { 237 // Set new buffer 235 238 alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer()); 236 239 if (ALuint error = alGetError()) … … 240 243 } 241 244 242 if (this->isPlaying() || this->isPaused()) 243 { 244 alSourcePlay(this->audioSource_); 245 if (int error = alGetError()) 246 COUT(2) << "Sound: Error playing sound: " << SoundManager::getALErrorString(error) << std::endl; 247 } 245 // Sound was already playing or paused because there was a source acquired 246 assert(this->isPlaying() || this->isPaused()); 247 alSourcePlay(this->audioSource_); 248 if (int error = alGetError()) 249 COUT(2) << "Sound: Error playing sound: " << SoundManager::getALErrorString(error) << std::endl; 248 250 if (this->isPaused()) 249 251 alSourcePause(this->audioSource_); 252 } 253 else // No source acquired so far, but might be set to playing or paused 254 { 255 State state = this->state_; // save 256 if (this->isPlaying() || this->isPaused()) 257 BaseSound::play(); 258 if (state == Paused) 259 { 260 this->state_ = Paused; 261 BaseSound::pause(); 262 } 250 263 } 251 264 } -
code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc
r6332 r6340 33 33 #include <vorbis/vorbisfile.h> 34 34 35 #include "util/Clock.h"36 #include "core/Game.h"37 35 #include "util/Exception.h" 38 36 #include "util/StringUtils.h" … … 63 61 if (getLowercase(extension) == "ogg") 64 62 { 65 int before = Game::getInstance().getGameClock().getRealMicroseconds();66 63 // Try ogg loader 67 64 this->loadOgg(fileInfo, dataStream); 68 int after = Game::getInstance().getGameClock().getRealMicroseconds();69 COUT(0) << filename << ": " << (after - before) << std::endl;70 65 } 71 66 else
Note: See TracChangeset
for help on using the changeset viewer.