Changeset 10765 for code/branches/cpp11_v2/src/orxonox/sound
- Timestamp:
- Nov 4, 2015, 10:25:42 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/orxonox/sound
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/sound/AmbientSound.cc
r10624 r10765 93 93 const std::string& path = "ambient/" + mood + '/' + this->ambientSource_; 94 94 shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path); 95 if (fileInfo != NULL)95 if (fileInfo != nullptr) 96 96 { 97 97 orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming -
code/branches/cpp11_v2/src/orxonox/sound/BaseSound.cc
r10624 r10765 66 66 this->stop(); 67 67 // Release buffer 68 if (this->soundBuffer_ != NULL)68 if (this->soundBuffer_ != nullptr) 69 69 { 70 70 assert(GameMode::playsSound()); … … 84 84 { 85 85 this->state_ = Playing; 86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != NULL)86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr) 87 87 { 88 88 if (!alIsSource(this->audioSource_)) … … 151 151 orxout(internal_warning, context::sound) << "Setting source parameters to 0 failed: " 152 152 << SoundManager::getALErrorString(error) << endl; 153 assert(this->soundBuffer_ != NULL);153 assert(this->soundBuffer_ != nullptr); 154 154 alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer()); 155 155 if (ALuint error = alGetError()) … … 209 209 } 210 210 211 if (this->soundBuffer_ != NULL)211 if (this->soundBuffer_ != nullptr) 212 212 { 213 213 if (this->soundBuffer_->getFilename() == source) … … 233 233 // Get new sound buffer 234 234 this->soundBuffer_ = SoundManager::getInstance().getSoundBuffer(this->source_); 235 if (this->soundBuffer_ == NULL)235 if (this->soundBuffer_ == nullptr) 236 236 return; 237 237 -
code/branches/cpp11_v2/src/orxonox/sound/SoundBuffer.cc
r8858 r10765 45 45 { 46 46 if (this->filename_.empty()) 47 ThrowException(General, "SoundBuffer construction: fileInfo was NULL");47 ThrowException(General, "SoundBuffer construction: fileInfo was nullptr"); 48 48 49 49 // Get resource info 50 50 shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename); 51 if (fileInfo == NULL)51 if (fileInfo == nullptr) 52 52 { 53 53 orxout(internal_error, context::sound) << "Sound file '" << filename << "' not found" << endl; … … 138 138 vorbisCallbacks.seek_func = &seekVorbis; 139 139 vorbisCallbacks.tell_func = &tellVorbis; 140 vorbisCallbacks.close_func = NULL;140 vorbisCallbacks.close_func = nullptr; 141 141 142 142 OggVorbis_File vf; 143 int ret = ov_open_callbacks(dataStream.get(), &vf, NULL, 0, vorbisCallbacks);143 int ret = ov_open_callbacks(dataStream.get(), &vf, nullptr, 0, vorbisCallbacks); 144 144 if (ret < 0) 145 145 { -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
r10624 r10765 83 83 ThrowException(InitialisationAborted, "Sound: Not loading at all"); 84 84 #if !defined(ORXONOX_PLATFORM_APPLE) 85 if (!alutInitWithoutContext( NULL, NULL))85 if (!alutInitWithoutContext(nullptr, nullptr)) 86 86 ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError())); 87 87 Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit); … … 90 90 /* 91 91 // Get list of available sound devices and display them 92 const char* devices = alcGetString( NULL, ALC_DEVICE_SPECIFIER);92 const char* devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER); 93 93 char* device = new char[strlen(devices)+1]; 94 94 strcpy(device, devices); … … 110 110 this->device_ = alcOpenDevice(renderDevice.c_str()); 111 111 */ 112 this->device_ = alcOpenDevice( NULL);113 if (this->device_ == NULL)112 this->device_ = alcOpenDevice(nullptr); 113 if (this->device_ == nullptr) 114 114 ThrowException(InitialisationFailed, "Sound Error: Could not open sound device."); 115 115 Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_); 116 116 117 117 // Create sound context and make it the currently used one 118 this->context_ = alcCreateContext(this->device_, NULL);119 if (this->context_ == NULL)118 this->context_ = alcCreateContext(this->device_, nullptr); 119 if (this->context_ == nullptr) 120 120 ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context"); 121 121 Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_); … … 189 189 190 190 // Relieve context to destroy it 191 if (!alcMakeContextCurrent( NULL))191 if (!alcMakeContextCurrent(nullptr)) 192 192 orxout(internal_error, context::sound) << "Could not unset ALC context" << endl; 193 193 alcDestroyContext(this->context_); … … 350 350 void SoundManager::registerAmbientSound(AmbientSound* newAmbient) 351 351 { 352 if (newAmbient != NULL&& !this->bDestructorCalled_)352 if (newAmbient != nullptr && !this->bDestructorCalled_) 353 353 { 354 354 for (AmbientList::const_iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it) … … 373 373 void SoundManager::unregisterAmbientSound(AmbientSound* oldAmbient) 374 374 { 375 if (oldAmbient == NULL|| ambientSounds_.empty() || this->bDestructorCalled_)375 if (oldAmbient == nullptr || ambientSounds_.empty() || this->bDestructorCalled_) 376 376 return; 377 377 … … 405 405 void SoundManager::pauseAmbientSound(AmbientSound* ambient) 406 406 { 407 if (ambient != NULL)407 if (ambient != nullptr) 408 408 { 409 409 for (AmbientList::iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it) -
code/branches/cpp11_v2/src/orxonox/sound/SoundStreamer.cc
r8858 r10765 45 45 vorbisCallbacks.seek_func = &seekVorbis; 46 46 vorbisCallbacks.tell_func = &tellVorbis; 47 vorbisCallbacks.close_func = NULL;47 vorbisCallbacks.close_func = nullptr; 48 48 49 49 OggVorbis_File vf; 50 int ret = ov_open_callbacks(dataStream.get(), &vf, NULL, 0, vorbisCallbacks);50 int ret = ov_open_callbacks(dataStream.get(), &vf, nullptr, 0, vorbisCallbacks); 51 51 if (ret < 0) 52 52 {
Note: See TracChangeset
for help on using the changeset viewer.