Changeset 3075 for code/trunk/src
- Timestamp:
- May 25, 2009, 9:08:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/sound/SoundBase.cc
r3060 r3075 161 161 alGenSources(1, &this->source_); 162 162 alSourcei(this->source_, AL_BUFFER, this->buffer_); 163 // ALenum 163 164 if(alGetError() != AL_NO_ERROR) { 164 165 COUT(2) << "Sound: OpenAL: Error loading sample file: " << filename << std::endl; … … 179 180 std::vector<char> outbuffer; 180 181 OggVorbis_File vf; 182 vorbis_info* vorbisInfo; 181 183 int eof = false; 182 184 int current_section; 185 ALuint buffer; 186 ALenum format; 183 187 184 188 FILE* f = fopen(filename.c_str(), "rb"); … … 210 214 } 211 215 216 vorbisInfo = ov_info(&vf, -1); 217 if(vorbisInfo->channels == 1) 218 format = AL_FORMAT_MONO16; 219 else 220 format = AL_FORMAT_STEREO16; 221 222 alGenBuffers(1, &buffer); 223 alBufferData(buffer, format, &outbuffer[0], outbuffer.size(), vorbisInfo->rate); 212 224 ov_clear(&vf); 213 225 214 return alutCreateBufferFromFileImage(&outbuffer, outbuffer.size());226 return buffer; 215 227 } 216 228 } // namespace: orxonox
Note: See TracChangeset
for help on using the changeset viewer.