Changeset 6069 for code/branches/sound3/src/orxonox/sound/BaseSound.cc
- Timestamp:
- Nov 15, 2009, 3:43:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound3/src/orxonox/sound/BaseSound.cc
r6046 r6069 93 93 if (alIsSource(this->audioSource_)) 94 94 return getSourceState() == AL_PAUSED; 95 return true;95 return false; 96 96 } 97 97 … … 103 103 } 104 104 105 void BaseSound::setPlayOnLoad(bool val) 106 { 107 this->bPlayOnLoad_ = val; 108 if(val) 109 { 110 this->play(); 111 } 105 void BaseSound::setVolume(float vol) 106 { 107 if (vol > 1 || vol < 0) 108 { 109 COUT(2) << "Sound warning: volume out of range, cropping value." << std::endl; 110 vol = vol > 1 ? 1 : vol; 111 vol = vol < 0 ? 0 : vol; 112 } 113 this->volume_ = vol; 114 if (alIsSource(this->audioSource_)) 115 alSourcef(this->audioSource_, AL_GAIN, vol); 112 116 } 113 117 … … 178 182 alSource3f(this->audioSource_, AL_POSITION, 0, 0, 0); 179 183 184 this->setVolume(this->volume_); 185 180 186 if (this->bPlayOnLoad_) 181 187 this->play(); 182 }183 184 ALuint BaseSound::getALAudioSource()185 {186 return audioSource_;187 188 } 188 189 … … 275 276 return buffer; 276 277 } 277 278 } // namespace: orxonox 278 }
Note: See TracChangeset
for help on using the changeset viewer.