- Timestamp:
- Nov 30, 2009, 8:50:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/sound/BaseSound.cc
r6127 r6184 109 109 this->volume_ = vol; 110 110 if (alIsSource(this->audioSource_)) 111 alSourcef(this->audioSource_, AL_GAIN, vol); 111 alSourcef(this->audioSource_, AL_GAIN, this->getEffectiveVolume()); 112 } 113 114 void BaseSound::setVolumeGain(float gain) 115 { 116 COUT(1) << "blubb: " << gain << std::endl; 117 if (gain > 1 || gain < 0) 118 { 119 COUT(2) << "Sound warning: volume gain out of range, cropping value." << std::endl; 120 gain = gain > 1 ? 1 : gain; 121 gain = gain < 0 ? 0 : gain; 122 } 123 this->volumeGain_ = gain; 124 if (alIsSource(this->audioSource_)) 125 alSourcef(this->audioSource_, AL_GAIN, this->getEffectiveVolume()); 126 } 127 128 float BaseSound::getEffectiveVolume(void) 129 { 130 return this->volume_*this->volumeGain_; 112 131 } 113 132 … … 181 200 182 201 alSource3f(this->audioSource_, AL_POSITION, 0, 0, 0); 183 alSourcef (this->audioSource_, AL_GAIN, this-> volume_);202 alSourcef (this->audioSource_, AL_GAIN, this->getEffectiveVolume()); 184 203 alSourcei (this->audioSource_, AL_LOOPING, (this->bLoop_ ? AL_TRUE : AL_FALSE)); 185 204 if (this->isPlaying() || this->isPaused())
Note: See TracChangeset
for help on using the changeset viewer.