Changeset 6506 for code/branches/sound5/src/orxonox/sound/SoundManager.cc
- Timestamp:
- Mar 11, 2010, 3:16:12 PM (15 years ago)
- Location:
- code/branches/sound5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound5
- Property svn:mergeinfo changed
/code/branches/sound4 (added) merged: 6435,6476,6504
- Property svn:mergeinfo changed
-
code/branches/sound5/src/orxonox/sound/SoundManager.cc
r6417 r6506 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" … … 52 52 ManageScopedSingleton(SoundManager, ScopeID::Graphics, true); 53 53 54 std::string SoundManager::getALErrorString(ALenum code) 54 // From SoundPrereqs.h 55 std::string getALErrorString(ALenum code) 55 56 { 56 57 switch (code) … … 78 79 79 80 if (!alutInitWithoutContext(NULL, NULL)) 80 ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));81 ThrowException(InitialisationFailed, "Sound: Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError())); 81 82 Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit); 82 83 … … 110 111 COUT(1) << "Sound: Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl; 111 112 #endif 112 ThrowException(InitialisationFailed, "Sound Error: Could not open sound device.");113 ThrowException(InitialisationFailed, "Sound: Error: Could not open sound device."); 113 114 } 114 115 Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_); … … 117 118 this->context_ = alcCreateContext(this->device_, NULL); 118 119 if (this->context_ == NULL) 119 ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context");120 ThrowException(InitialisationFailed, "Sound: Error: Could not create ALC context"); 120 121 Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_); 121 122 if (!alcMakeContextCurrent(this->context_)) 122 ThrowException(InitialisationFailed, "Sound Error: Could not use ALC context");123 ThrowException(InitialisationFailed, "Sound: Error: Could not use ALC context"); 123 124 124 125 GameMode::setPlaysSound(true); … … 133 134 COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl; 134 135 else 135 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; 136 137 137 138 this->mute_[SoundType::All] = 1.0f; … … 147 148 this->availableSoundSources_.push_back(source); 148 149 else 149 ThrowException(InitialisationFailed, "Sound Error: Could not create even a single source");150 ThrowException(InitialisationFailed, "Sound: Error: Could not create even a single source"); 150 151 // Create a few initial sources 151 152 this->createSoundSources(this->minSources_ - 1); … … 168 169 // If there are still used buffers around, well, that's just very bad... 169 170 if (this->soundBuffers_.size() != this->effectsPool_.size()) 170 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; 171 172 // Empty buffer pool and buffer list 172 173 this->effectsPool_.clear(); … … 175 176 // There should not be any sources in use anymore 176 177 if (!this->usedSoundSources_.empty()) 177 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; 178 179 while (!this->availableSoundSources_.empty()) 179 180 { … … 186 187 // Relieve context to destroy it 187 188 if (!alcMakeContextCurrent(NULL)) 188 COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;189 COUT(1) << "Sound: Error: Could not unset ALC context" << std::endl; 189 190 alcDestroyContext(this->context_); 190 191 if (ALCenum error = alcGetError(this->device_)) 191 192 { 192 193 if (error == AL_INVALID_OPERATION) 193 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; 194 195 else 195 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; 196 197 } 197 198 #ifdef AL_VERSION_1_1 198 199 if (!alcCloseDevice(this->device_)) 199 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; 200 201 #else 201 202 alcCloseDevice(this->device_); 202 203 #endif 203 204 if (!alutExit()) 204 COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;205 COUT(1) << "Sound: Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl; 205 206 } 206 207 … … 248 249 if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 ) 249 250 { 250 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; 251 252 ResetConfigValue(crossFadeStep_); 252 253 } … … 257 258 float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f); 258 259 if (clampedVolume != this->volume_[type]) 259 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; 260 261 this->updateVolume(type); 261 262 } … … 349 350 if (it->first == newAmbient) 350 351 { 351 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; 352 353 return; 353 354 } … … 617 618 alDeleteSources(1, &this->availableSoundSources_.back()); 618 619 if (alGetError()) 619 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; 620 621 this->availableSoundSources_.pop_back(); 621 622 }
Note: See TracChangeset
for help on using the changeset viewer.