Changeset 6202 for code/branches/presentation2/src/orxonox/sound
- Timestamp:
- Dec 2, 2009, 4:52:42 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
r6190 r6202 50 50 RegisterRootObject(BaseSound); 51 51 52 this->volume_ = 1; 53 this->pitch_ = 1; 54 52 55 if (GameMode::playsSound()) 53 56 { … … 129 132 if (GameMode::playsSound()) 130 133 alSourcei(this->audioSource_, AL_LOOPING, (val ? AL_TRUE : AL_FALSE)); 134 } 135 136 void BaseSound::setPitch(float pitch) 137 { 138 if (pitch > 2 || pitch < 0.5) 139 { 140 COUT(2) << "Sound warning: pitch out of range, cropping value." << std::endl; 141 pitch = pitch > 2 ? 2 : pitch; 142 pitch = pitch < 0.5 ? 0.5 : pitch; 143 } 144 this->pitch_ = pitch; 145 if (GameMode::playsSound()) 146 alSourcei(this->audioSource_, AL_PITCH, pitch); 131 147 } 132 148 … … 194 210 alSource3f(this->audioSource_, AL_POSITION, 0, 0, 0); 195 211 this->updateVolume(); 212 this->setPitch(this->getPitch()); 196 213 alSourcei (this->audioSource_, AL_LOOPING, (this->bLoop_ ? AL_TRUE : AL_FALSE)); 197 214 if (this->isPlaying() || this->isPaused()) -
code/branches/presentation2/src/orxonox/sound/BaseSound.h
r6188 r6202 74 74 void setLooping(bool val); 75 75 76 float getPitch() const { return this->pitch_; } 77 void setPitch(float pitch); 78 76 79 //ALuint getALAudioSource(void); 77 80 … … 92 95 std::string source_; 93 96 float volume_; 97 float pitch_; 94 98 bool bLoop_; 95 99 State state_;
Note: See TracChangeset
for help on using the changeset viewer.