- Timestamp:
- Dec 12, 2009, 8:36:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound3/src/orxonox/sound/BaseSound.cc
r6102 r6331 149 149 } 150 150 dataStream_ = Resource::open(source); 151 // Read everything into a temporary buffer 152 char* buffer = new char[fileInfo->size]; 153 dataStream_->read(buffer, fileInfo->size); 154 dataStream_->seek(0); 155 156 this->audioBuffer_ = alutCreateBufferFromFileImage(buffer, fileInfo->size); 157 delete[] buffer; 151 152 if (source.find("ogg", 0) != std::string::npos) 153 { 154 COUT(2) << "Sound: Ogg file found, trying ogg loader" << std::endl; 155 this->audioBuffer_ = this->loadOggFile(); 156 if(this->audioBuffer_ == AL_NONE) 157 { 158 COUT(2) << "Sound: Ogg loader failed" << std::endl; 159 dataStream_->seek(0); 160 } 161 } 158 162 159 163 if (this->audioBuffer_ == AL_NONE) 160 164 { 165 // Read everything into a temporary buffer 166 char* buffer = new char[fileInfo->size]; 167 dataStream_->read(buffer, fileInfo->size); 168 169 this->audioBuffer_ = alutCreateBufferFromFileImage(buffer, fileInfo->size); 170 delete[] buffer; 171 } 172 173 if (this->audioBuffer_ == AL_NONE) 174 { 161 175 COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl; 162 if (source.find("ogg", 0) != std::string::npos)163 {164 COUT(2) << "Sound: Trying fallback ogg loader" << std::endl;165 this->audioBuffer_ = this->loadOggFile();166 }167 168 if (this->audioBuffer_ == AL_NONE)169 {170 COUT(2) << "Sound: fallback ogg loader failed: " << alutGetErrorString(alutGetError()) << std::endl;171 return;172 }173 176 } 174 177
Note: See TracChangeset
for help on using the changeset viewer.