- Timestamp:
- Dec 13, 2009, 12:11:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc
r6270 r6332 33 33 #include <vorbis/vorbisfile.h> 34 34 35 #include "util/Clock.h" 36 #include "core/Game.h" 35 37 #include "util/Exception.h" 36 38 #include "util/StringUtils.h" … … 40 42 namespace orxonox 41 43 { 42 SoundBuffer::SoundBuffer(const std::string& filename )44 SoundBuffer::SoundBuffer(const std::string& filename, std::list<shared_ptr<SoundBuffer> >::iterator poolIterator) 43 45 : filename_(filename) 44 46 , audioBuffer_(AL_NONE) 47 , poolIterator_(poolIterator) 45 48 { 46 49 if (this->filename_.empty()) … … 60 63 if (getLowercase(extension) == "ogg") 61 64 { 65 int before = Game::getInstance().getGameClock().getRealMicroseconds(); 62 66 // Try ogg loader 63 67 this->loadOgg(fileInfo, dataStream); 68 int after = Game::getInstance().getGameClock().getRealMicroseconds(); 69 COUT(0) << filename << ": " << (after - before) << std::endl; 64 70 } 65 71 else … … 80 86 ALint size; 81 87 alGetBufferi(this->audioBuffer_, AL_SIZE, &size); 82 if (!alGetError()) 83 return size; 84 else 85 return 0; 88 return alGetError() ? 0 : size; 86 89 } 87 90 … … 108 111 { 109 112 Ogre::DataStream* stream = static_cast<Ogre::DataStream*>(datasource); 110 int offset_beg = offset; 111 if (whence == SEEK_CUR) 112 offset_beg = stream->tell() + offset; 113 else if (whence == SEEK_END) 114 offset_beg = stream->size() + offset; 115 else if (whence != SEEK_SET) 113 switch (whence) 114 { 115 case SEEK_SET: 116 stream->seek(offset); 117 break; 118 case SEEK_CUR: 119 stream->skip(offset); 120 break; 121 case SEEK_END: 122 stream->seek(stream->size() + offset); 123 break; 124 default: 116 125 return -1; 117 stream->seek(offset_beg);126 } 118 127 return 0; 119 128 }
Note: See TracChangeset
for help on using the changeset viewer.