Changeset 5695 for code/trunk/src/orxonox/sound
- Timestamp:
- Aug 30, 2009, 2:22:00 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/resource2 (added) merged: 3373-3374,5594,5597,5610-5611,5614,5624,5641,5644-5646,5650-5664,5667-5672,5682-5684,5688-5691,5694
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/sound/SoundBase.cc
r3370 r5695 36 36 #include "util/Math.h" 37 37 #include "core/Core.h" 38 #include "core/Resource.h" 38 39 #include "orxonox/objects/worldentities/WorldEntity.h" 39 40 #include "SoundManager.h" … … 134 135 } 135 136 136 bool SoundBase::loadFile(std::string filename) { 137 filename = Core::getMediaPathString() + "/audio/" + filename; 138 137 bool SoundBase::loadFile(const std::string& filename) { 139 138 if(!SoundManager::getInstance().isSoundAvailable()) 140 139 { … … 144 143 145 144 COUT(3) << "Sound: OpenAL ALUT: loading file " << filename << std::endl; 146 this->buffer_ = alutCreateBufferFromFile(filename.c_str()); 145 // Get DataStream from the resources 146 shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename); 147 if (fileInfo == NULL) { 148 COUT(2) << "Warning: Sound file '" << filename << "' not found" << std::endl; 149 return false; 150 } 151 DataStreamPtr stream = Resource::open(filename); 152 // Read everything into a temporary buffer 153 char* buffer = new char[fileInfo->size]; 154 stream->read(buffer, fileInfo->size); 155 156 this->buffer_ = alutCreateBufferFromFileImage(buffer, fileInfo->size); 157 delete[] buffer; 158 147 159 if(this->buffer_ == AL_NONE) { 148 160 COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl; -
code/trunk/src/orxonox/sound/SoundBase.h
r5693 r5695 55 55 bool isStopped(); 56 56 57 bool loadFile( std::stringfilename);57 bool loadFile(const std::string& filename); 58 58 59 59 private:
Note: See TracChangeset
for help on using the changeset viewer.