Changeset 11005 for code/branches/cpp11_v2/src/orxonox/sound
- Timestamp:
- Dec 30, 2015, 10:31:43 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/orxonox/sound
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/sound/BaseSound.cc
r10765 r11005 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 … … 83 83 void BaseSound::doPlay() 84 84 { 85 this->state_ = Playing;85 this->state_ = State::Playing; 86 86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr) 87 87 { … … 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_); … … 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(); -
code/branches/cpp11_v2/src/orxonox/sound/BaseSound.h
r10771 r11005 54 54 virtual void pause() { this->doPause(); } 55 55 56 bool isPlaying() const { return this->state_ == Playing; }57 bool isPaused() const { return this->state_ == Paused; }58 bool isStopped() const { return this->state_ == St opped; }56 bool isPlaying() const { return this->state_ == State::Playing; } 57 bool isPaused() const { return this->state_ == State::Paused; } 58 bool isStopped() const { return this->state_ == State::Stopped; } 59 59 60 60 virtual void setSource(const std::string& source); … … 76 76 77 77 protected: 78 enum State78 enum class State 79 79 { 80 80 Stopped, … … 111 111 float volume_; 112 112 bool bLooping_; 113 uint8_tstate_; // This Variable is actually of type State113 State state_; // This Variable is actually of type State 114 114 float pitch_; 115 115 -
code/branches/cpp11_v2/src/orxonox/sound/WorldSound.cc
r9939 r11005 58 58 registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::loopingChanged)); 59 59 registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::pitchChanged)); 60 registerVariable( (uint8_t&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));60 registerVariable(BaseSound::state_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged)); 61 61 } 62 62
Note: See TracChangeset
for help on using the changeset viewer.