Changeset 11071 for code/trunk/src/orxonox/sound/BaseSound.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/sound/BaseSound.cc
r10624 r11071 49 49 , volume_(0.7) 50 50 , bLooping_(false) 51 , state_(St opped)51 , state_(State::Stopped) 52 52 , pitch_ (1.0) 53 53 { … … 63 63 BaseSound::~BaseSound() 64 64 { 65 if (this->state_ != St opped)65 if (this->state_ != State::Stopped) 66 66 this->stop(); 67 67 // Release buffer 68 if (this->soundBuffer_ != NULL)68 if (this->soundBuffer_ != nullptr) 69 69 { 70 70 assert(GameMode::playsSound()); … … 83 83 void BaseSound::doPlay() 84 84 { 85 this->state_ = Playing;86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != NULL)85 this->state_ = State::Playing; 86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr) 87 87 { 88 88 if (!alIsSource(this->audioSource_)) … … 102 102 bool BaseSound::doStop() 103 103 { 104 this->state_ = St opped;104 this->state_ = State::Stopped; 105 105 if (alIsSource(this->audioSource_)) 106 106 { … … 123 123 if (this->isStopped()) 124 124 return; 125 this->state_ = Paused;125 this->state_ = State::Paused; 126 126 if (alIsSource(this->audioSource_)) 127 127 alSourcePause(this->audioSource_); … … 151 151 orxout(internal_warning, context::sound) << "Setting source parameters to 0 failed: " 152 152 << SoundManager::getALErrorString(error) << endl; 153 assert(this->soundBuffer_ != NULL);153 assert(this->soundBuffer_ != nullptr); 154 154 alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer()); 155 155 if (ALuint error = alGetError()) … … 209 209 } 210 210 211 if (this->soundBuffer_ != NULL)211 if (this->soundBuffer_ != nullptr) 212 212 { 213 213 if (this->soundBuffer_->getFilename() == source) … … 233 233 // Get new sound buffer 234 234 this->soundBuffer_ = SoundManager::getInstance().getSoundBuffer(this->source_); 235 if (this->soundBuffer_ == NULL)235 if (this->soundBuffer_ == nullptr) 236 236 return; 237 237 … … 256 256 else // No source acquired so far, but might be set to playing or paused 257 257 { 258 State state = static_cast<State>(this->state_); // save258 State state = this->state_; // save 259 259 if (this->isPlaying() || this->isPaused()) 260 260 doPlay(); 261 if (state == Paused)262 { 263 this->state_ = Paused;261 if (state == State::Paused) 262 { 263 this->state_ = State::Paused; 264 264 doPause(); 265 265 } … … 271 271 switch (this->state_) 272 272 { 273 case Playing:273 case State::Playing: 274 274 this->play(); 275 275 break; 276 case Paused:276 case State::Paused: 277 277 this->pause(); 278 278 break; 279 case St opped:279 case State::Stopped: 280 280 default: 281 281 this->stop();
Note: See TracChangeset
for help on using the changeset viewer.