- Timestamp:
- Mar 1, 2011, 5:16:52 AM (13 years ago)
- Location:
- code/branches/usability
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/usability
- Property svn:mergeinfo changed
/code/branches/sound4 removed /code/branches/sound5 removed
- Property svn:mergeinfo changed
-
code/branches/usability/src/orxonox/sound/SoundManager.cc
r8005 r8006 22 22 * Author: 23 23 * Erwin 'vaiursch' Herrsche 24 *25 * Co-authors:26 24 * Kevin Young 27 25 * Reto Grieder 26 * Co-authors: 27 * ... 28 28 * 29 29 */ … … 52 52 ManageScopedSingleton(SoundManager, ScopeID::Graphics, true); 53 53 54 // From SoundPrereqs.h 55 std::string getALErrorString(ALenum code) 54 std::string SoundManager::getALErrorString(ALenum code) 56 55 { 57 56 switch (code) … … 81 80 82 81 if (!alutInitWithoutContext(NULL, NULL)) 83 ThrowException(InitialisationFailed, "Sound :Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));82 ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError())); 84 83 Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit); 85 84 … … 113 112 COUT(1) << "Sound: Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl; 114 113 #endif 115 ThrowException(InitialisationFailed, "Sound :Error: Could not open sound device.");114 ThrowException(InitialisationFailed, "Sound Error: Could not open sound device."); 116 115 } 117 116 Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_); 118 117 119 118 // Create sound context and make it the currently used one 120 const ALint contattr[] = {ALC_SYNC, 1, 0}; 121 this->context_ = alcCreateContext(this->device_, contattr); 119 this->context_ = alcCreateContext(this->device_, NULL); 122 120 if (this->context_ == NULL) 123 ThrowException(InitialisationFailed, "Sound :Error: Could not create ALC context");121 ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context"); 124 122 Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_); 125 123 if (!alcMakeContextCurrent(this->context_)) 126 ThrowException(InitialisationFailed, "Sound :Error: Could not use ALC context");124 ThrowException(InitialisationFailed, "Sound Error: Could not use ALC context"); 127 125 128 126 GameMode::setPlaysSound(true); … … 137 135 COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl; 138 136 else 139 COUT(2) << "Sound :Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;137 COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl; 140 138 141 139 this->mute_[SoundType::All] = 1.0f; … … 151 149 this->availableSoundSources_.push_back(source); 152 150 else 153 ThrowException(InitialisationFailed, "Sound :Error: Could not create even a single source");151 ThrowException(InitialisationFailed, "Sound Error: Could not create even a single source"); 154 152 // Create a few initial sources 155 153 this->createSoundSources(this->minSources_ - 1); … … 173 171 // If there are still used buffers around, well, that's just very bad... 174 172 if (this->soundBuffers_.size() != this->effectsPool_.size()) 175 COUT(1) << "Sound :Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;173 COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl; 176 174 // Empty buffer pool and buffer list 177 175 this->effectsPool_.clear(); … … 180 178 // There should not be any sources in use anymore 181 179 if (!this->usedSoundSources_.empty()) 182 COUT(1) << "Sound :Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;180 COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl; 183 181 while (!this->availableSoundSources_.empty()) 184 182 { … … 191 189 // Relieve context to destroy it 192 190 if (!alcMakeContextCurrent(NULL)) 193 COUT(1) << "Sound :Error: Could not unset ALC context" << std::endl;191 COUT(1) << "Sound Error: Could not unset ALC context" << std::endl; 194 192 alcDestroyContext(this->context_); 195 193 if (ALCenum error = alcGetError(this->device_)) 196 194 { 197 195 if (error == AL_INVALID_OPERATION) 198 COUT(1) << "Sound :Error: Could not destroy ALC context because it is the current one" << std::endl;196 COUT(1) << "Sound Error: Could not destroy ALC context because it is the current one" << std::endl; 199 197 else 200 COUT(1) << "Sound :Error: Could not destroy ALC context because it is invalid" << std::endl;198 COUT(1) << "Sound Error: Could not destroy ALC context because it is invalid" << std::endl; 201 199 } 202 200 #ifdef AL_VERSION_1_1 203 201 if (!alcCloseDevice(this->device_)) 204 COUT(1) << "Sound :Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;202 COUT(1) << "Sound Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl; 205 203 #else 206 204 alcCloseDevice(this->device_); 207 205 #endif 208 206 if (!alutExit()) 209 COUT(1) << "Sound :Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;207 COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl; 210 208 } 211 209 … … 253 251 if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 ) 254 252 { 255 COUT(2) << "Sound : Warning: fade step out of range, ignoring change." << std::endl;253 COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl; 256 254 ResetConfigValue(crossFadeStep_); 257 255 } … … 262 260 float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f); 263 261 if (clampedVolume != this->volume_[type]) 264 COUT(2) << "Sound : Warning: Volume setting (" << type << ") out of range, clamping." << std::endl;262 COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl; 265 263 this->updateVolume(type); 266 264 } … … 354 352 if (it->first == newAmbient) 355 353 { 356 COUT(2) << "Sound : Warning: Will not play an AmbientSound twice." << std::endl;354 COUT(2) << "Sound warning: Will not play an AmbientSound twice." << std::endl; 357 355 return; 358 356 } … … 622 620 alDeleteSources(1, &this->availableSoundSources_.back()); 623 621 if (alGetError()) 624 COUT(1) << "Sound :Error: Failed to delete a source --> lost forever" << std::endl;622 COUT(1) << "Sound Error: Failed to delete a source --> lost forever" << std::endl; 625 623 this->availableSoundSources_.pop_back(); 626 624 }
Note: See TracChangeset
for help on using the changeset viewer.