Changeset 6504 for code/branches/sound4
- Timestamp:
- Mar 11, 2010, 3:12:37 PM (15 years ago)
- Location:
- code/branches/sound4/src/orxonox/sound
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound4/src/orxonox/sound/AmbientSound.cc
r6476 r6504 172 172 173 173 this->soundstreamthread_ = boost::thread(SoundStreamer(), this->audioSource_, dataStream); 174 this->initialiseSource(); 175 } 176 177 void AmbientSound::doStop() 178 { 179 SUPER(AmbientSound, doStop); 180 this->soundstreamthread_.interrupt(); 174 181 } 175 182 } -
code/branches/sound4/src/orxonox/sound/AmbientSound.h
r6476 r6504 73 73 ~AmbientSound() { } 74 74 75 void doPlay(); 76 void doStop(); 77 75 78 private: 76 79 void preDestroy(); -
code/branches/sound4/src/orxonox/sound/BaseSound.cc
r6435 r6504 141 141 alSource3f(this->audioSource_, AL_DIRECTION, 0, 0, 0); 142 142 if (ALint error = alGetError()) 143 COUT(2) << "Sound Warning: Setting source parameters to 0 failed: " << getALErrorString(error) << std::endl;143 COUT(2) << "Sound: Warning: Setting source parameters to 0 failed: " << getALErrorString(error) << std::endl; 144 144 assert(this->soundBuffer_ != NULL); 145 145 alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer()); 146 146 if (ALuint error = alGetError()) 147 COUT(1) << "Sound Error: Could not set buffer \"" << this->source_ << "\": " << getALErrorString(error) << std::endl;147 COUT(1) << "Sound: Error: Could not set buffer \"" << this->source_ << "\": " << getALErrorString(error) << std::endl; 148 148 } 149 149 … … 152 152 this->volume_ = clamp(vol, 0.0f, 1.0f); 153 153 if (this->volume_ != vol) 154 COUT(2) << "Sound warning: volume out of range, clamping value." << std::endl;154 COUT(2) << "Sound: Warning: volume out of range, clamping value." << std::endl; 155 155 this->updateVolume(); 156 156 } … … 178 178 if (pitch > 2 || pitch < 0.5) 179 179 { 180 COUT(2) << "Sound warning: pitch out of range, cropping value." << std::endl;180 COUT(2) << "Sound: Warning: pitch out of range, cropping value." << std::endl; 181 181 pitch = pitch > 2 ? 2 : pitch; 182 182 pitch = pitch < 0.5 ? 0.5 : pitch; … … 232 232 if (ALuint error = alGetError()) 233 233 { 234 COUT(1) << "Sound Error: Could not set buffer \"" << source << "\": " << getALErrorString(error) << std::endl;234 COUT(1) << "Sound: Error: Could not set buffer \"" << source << "\": " << getALErrorString(error) << std::endl; 235 235 return; 236 236 } -
code/branches/sound4/src/orxonox/sound/SoundManager.cc
r6435 r6504 43 43 #include "core/ScopedSingletonManager.h" 44 44 #include "core/Resource.h" 45 #include "SoundBuffer.h" 45 #include "SoundBuffer.h": 46 46 #include "BaseSound.h" 47 47 #include "AmbientSound.h" … … 79 79 80 80 if (!alutInitWithoutContext(NULL, NULL)) 81 ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));81 ThrowException(InitialisationFailed, "Sound: Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError())); 82 82 Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit); 83 83 … … 111 111 COUT(1) << "Sound: Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl; 112 112 #endif 113 ThrowException(InitialisationFailed, "Sound Error: Could not open sound device.");113 ThrowException(InitialisationFailed, "Sound: Error: Could not open sound device."); 114 114 } 115 115 Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_); … … 118 118 this->context_ = alcCreateContext(this->device_, NULL); 119 119 if (this->context_ == NULL) 120 ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context");120 ThrowException(InitialisationFailed, "Sound: Error: Could not create ALC context"); 121 121 Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_); 122 122 if (!alcMakeContextCurrent(this->context_)) 123 ThrowException(InitialisationFailed, "Sound Error: Could not use ALC context");123 ThrowException(InitialisationFailed, "Sound: Error: Could not use ALC context"); 124 124 125 125 GameMode::setPlaysSound(true); … … 134 134 COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl; 135 135 else 136 COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;136 COUT(2) << "Sound: Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl; 137 137 138 138 this->mute_[SoundType::All] = 1.0f; … … 148 148 this->availableSoundSources_.push_back(source); 149 149 else 150 ThrowException(InitialisationFailed, "Sound Error: Could not create even a single source");150 ThrowException(InitialisationFailed, "Sound: Error: Could not create even a single source"); 151 151 // Create a few initial sources 152 152 this->createSoundSources(this->minSources_ - 1); … … 169 169 // If there are still used buffers around, well, that's just very bad... 170 170 if (this->soundBuffers_.size() != this->effectsPool_.size()) 171 COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;171 COUT(1) << "Sound: Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl; 172 172 // Empty buffer pool and buffer list 173 173 this->effectsPool_.clear(); … … 176 176 // There should not be any sources in use anymore 177 177 if (!this->usedSoundSources_.empty()) 178 COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;178 COUT(1) << "Sound: Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl; 179 179 while (!this->availableSoundSources_.empty()) 180 180 { … … 187 187 // Relieve context to destroy it 188 188 if (!alcMakeContextCurrent(NULL)) 189 COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;189 COUT(1) << "Sound: Error: Could not unset ALC context" << std::endl; 190 190 alcDestroyContext(this->context_); 191 191 if (ALCenum error = alcGetError(this->device_)) 192 192 { 193 193 if (error == AL_INVALID_OPERATION) 194 COUT(1) << "Sound Error: Could not destroy ALC context because it is the current one" << std::endl;194 COUT(1) << "Sound: Error: Could not destroy ALC context because it is the current one" << std::endl; 195 195 else 196 COUT(1) << "Sound Error: Could not destroy ALC context because it is invalid" << std::endl;196 COUT(1) << "Sound: Error: Could not destroy ALC context because it is invalid" << std::endl; 197 197 } 198 198 #ifdef AL_VERSION_1_1 199 199 if (!alcCloseDevice(this->device_)) 200 COUT(1) << "Sound Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;200 COUT(1) << "Sound: Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl; 201 201 #else 202 202 alcCloseDevice(this->device_); 203 203 #endif 204 204 if (!alutExit()) 205 COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;205 COUT(1) << "Sound: Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl; 206 206 } 207 207 … … 249 249 if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 ) 250 250 { 251 COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl;251 COUT(2) << "Sound: Warning: fade step out of range, ignoring change." << std::endl; 252 252 ResetConfigValue(crossFadeStep_); 253 253 } … … 258 258 float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f); 259 259 if (clampedVolume != this->volume_[type]) 260 COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl;260 COUT(2) << "Sound: Warning: Volume setting (" << type << ") out of range, clamping." << std::endl; 261 261 this->updateVolume(type); 262 262 } … … 350 350 if (it->first == newAmbient) 351 351 { 352 COUT(2) << "Sound warning: Will not play an AmbientSound twice." << std::endl;352 COUT(2) << "Sound: Warning: Will not play an AmbientSound twice." << std::endl; 353 353 return; 354 354 } … … 618 618 alDeleteSources(1, &this->availableSoundSources_.back()); 619 619 if (alGetError()) 620 COUT(1) << "Sound Error: Failed to delete a source --> lost forever" << std::endl;620 COUT(1) << "Sound: Error: Failed to delete a source --> lost forever" << std::endl; 621 621 this->availableSoundSources_.pop_back(); 622 622 }
Note: See TracChangeset
for help on using the changeset viewer.