Changeset 8858 for code/trunk/src/orxonox/sound/SoundManager.cc
- Timestamp:
- Aug 23, 2011, 12:45:53 AM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/orxonox/sound/SoundManager.cc
r8521 r8858 71 71 RegisterRootObject(SoundManager); 72 72 73 orxout(user_status) << "Loading sound" << endl; 74 73 75 this->bDestructorCalled_ = false; 74 76 … … 89 91 std::string renderDevice; 90 92 SetConfigValue(renderDevice, std::string(device)).description("Sound device used for rendering"); 91 COUT(4) << "Sound: Available devices: ";93 orxout(verbose, context::sound) << "Sound: Available devices: "; 92 94 while (true) 93 95 { 94 96 this->deviceNames_.push_back(devices); 95 COUT(4) << '"' << devices << "\", ";97 orxout(verbose, context::sound) << '"' << devices << "\", "; 96 98 devices += strlen(devices) + 1; 97 99 if (*devices == '\0') 98 100 break; 99 101 } 100 COUT(4) << std::endl;102 orxout(verbose, context::sound) << endl; 101 103 102 104 // Open the selected device 103 COUT(3) << "Sound: Opening device \"" << renderDevice << '\' << std::endl;105 orxout(internal_info, context::sound) << "Sound: Opening device \"" << renderDevice << '\' << endl; 104 106 this->device_ = alcOpenDevice(renderDevice.c_str()); 105 107 */ … … 122 124 // Get some information about the sound 123 125 if (const char* version = alGetString(AL_VERSION)) 124 COUT(4) << "Sound: --- OpenAL Version: " << version << std::endl;126 orxout(internal_info, context::sound) << "Sound: --- OpenAL Version: " << version << endl; 125 127 if (const char* vendor = alGetString(AL_VENDOR)) 126 COUT(4) << "Sound: --- OpenAL Vendor : " << vendor << std::endl;128 orxout(internal_info, context::sound) << "Sound: --- OpenAL Vendor : " << vendor << endl; 127 129 if (const char* types = alutGetMIMETypes(ALUT_LOADER_BUFFER)) 128 COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl;130 orxout(internal_info, context::sound) << "Sound: --- Supported MIME Types: " << types << endl; 129 131 else 130 COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;132 orxout(internal_warning, context::sound) << "MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << endl; 131 133 132 134 this->mute_[SoundType::All] = 1.0f; … … 152 154 resetPlaysSoundGuard.Dismiss(); 153 155 154 COUT(4) << "Sound: Initialisation complete" << std::endl;156 orxout(internal_status, context::sound) << "Sound: Initialisation complete" << endl; 155 157 } 156 158 … … 164 166 // If there are still used buffers around, well, that's just very bad... 165 167 if (this->soundBuffers_.size() != this->effectsPool_.size()) 166 COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;168 orxout(internal_error, context::sound) << "Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << endl; 167 169 // Empty buffer pool and buffer list 168 170 this->effectsPool_.clear(); … … 171 173 // There should not be any sources in use anymore 172 174 if (!this->usedSoundSources_.empty()) 173 COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;175 orxout(internal_error, context::sound) << "Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << endl; 174 176 while (!this->availableSoundSources_.empty()) 175 177 { … … 182 184 // Relieve context to destroy it 183 185 if (!alcMakeContextCurrent(NULL)) 184 COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;186 orxout(internal_error, context::sound) << "Could not unset ALC context" << endl; 185 187 alcDestroyContext(this->context_); 186 188 if (ALCenum error = alcGetError(this->device_)) 187 189 { 188 190 if (error == AL_INVALID_OPERATION) 189 COUT(1) << "Sound Error: Could not destroy ALC context because it is the current one" << std::endl;191 orxout(internal_error, context::sound) << "Could not destroy ALC context because it is the current one" << endl; 190 192 else 191 COUT(1) << "Sound Error: Could not destroy ALC context because it is invalid" << std::endl;193 orxout(internal_error, context::sound) << "Could not destroy ALC context because it is invalid" << endl; 192 194 } 193 195 #ifdef AL_VERSION_1_1 194 196 if (!alcCloseDevice(this->device_)) 195 COUT(1) << "Sound Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;197 orxout(internal_error, context::sound) << "Could not destroy ALC device. This might be because there are still buffers in use!" << endl; 196 198 #else 197 199 alcCloseDevice(this->device_); 198 200 #endif 199 201 if (!alutExit()) 200 COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;202 orxout(internal_error, context::sound) << "Closing ALUT failed: " << alutGetErrorString(alutGetError()) << endl; 201 203 } 202 204 … … 244 246 if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 ) 245 247 { 246 COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl;248 orxout(internal_warning, context::sound) << "Fade step out of range, ignoring change." << endl; 247 249 ResetConfigValue(crossFadeStep_); 248 250 } … … 253 255 float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f); 254 256 if (clampedVolume != this->volume_[type]) 255 COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl;257 orxout(internal_warning, context::sound) << "Volume setting (" << type << ") out of range, clamping." << endl; 256 258 this->updateVolume(type); 257 259 } … … 321 323 if (error == AL_INVALID_VALUE) 322 324 // @TODO: Follow this constantly appearing, nerve-racking warning 323 COUT(2) << "Sound: OpenAL: Invalid listener position" << std::endl;325 orxout(internal_error, context::sound) << "OpenAL: Invalid listener position" << endl; 324 326 } 325 327 … … 335 337 ALenum error = alGetError(); 336 338 if (error == AL_INVALID_VALUE) 337 COUT(2) << "Sound: OpenAL: Invalid listener orientation" << std::endl;339 orxout(internal_error, context::sound) << "OpenAL: Invalid listener orientation" << endl; 338 340 } 339 341 … … 346 348 if (it->first == newAmbient) 347 349 { 348 COUT(2) << "Sound warning: Will not play an AmbientSound twice." << std::endl;350 orxout(internal_warning, context::sound) << "Will not play an AmbientSound twice." << endl; 349 351 return; 350 352 } … … 520 522 catch (const std::exception& ex) 521 523 { 522 COUT(1) << ex.what() << std::endl;524 orxout(internal_error, context::sound) << ex.what() << endl; 523 525 return buffer; 524 526 } … … 614 616 alDeleteSources(1, &this->availableSoundSources_.back()); 615 617 if (alGetError()) 616 COUT(1) << "Sound Error: Failed to delete a source --> lost forever" << std::endl;618 orxout(internal_error, context::sound) << "Failed to delete a source --> lost forever" << endl; 617 619 this->availableSoundSources_.pop_back(); 618 620 }
Note: See TracChangeset
for help on using the changeset viewer.