Changeset 5962 for code/branches/sound3/src
- Timestamp:
- Oct 16, 2009, 7:10:03 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound3/src/orxonox/sound/BaseSound.cc
r5957 r5962 111 111 void BaseSound::setSource(const std::string& source) 112 112 { 113 if (!GameMode::playsSound() )113 if (!GameMode::playsSound() || source == this->source_) 114 114 { 115 115 this->source_ = source; … … 117 117 } 118 118 119 if (this->source_ != source && alIsSource(this->audioSource_)) 120 { 121 // Unload sound 119 if (alIsSource(this->audioSource_)) 120 { 121 this->stop(); 122 // Unload old sound first 122 123 alSourcei(this->audioSource_, AL_BUFFER, 0); 123 124 alDeleteSources(1, &this->audioSource_); 125 this->audioSource_ = 0; 124 126 alDeleteBuffers(1, &this->audioBuffer_); 127 this->audioBuffer_ = 0; 125 128 } 126 129 127 130 this->source_ = source; 128 129 if(source_.empty()) 130 { 131 return; 132 } 131 if (source_.empty()) 132 return; 133 133 134 134 COUT(3) << "Sound: OpenAL ALUT: loading file " << source << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.