- logDebug("buffer size: %d", sound->buffer_size);
- logDebug(" channels: %d", sound->actual.channels);
- logDebug(" format: %d", sound->actual.format);
- logDebug(" frequency: %d", sound->actual.rate);
+ int result = ov_open(soundFile, &oggStream, NULL, 0);
+
+ if (result < 0)
+ {
+ fclose(soundFile);
+ soundFile = 0;
+
+ logWarning("error while loading oggvorbis stream %s",
+ getName().c_str());
+ throw Exception(Exception::BAD_AUDIO_FORMAT);
+ }
+
+ vorbis_info* vorbisInfo = ov_info(&oggStream, -1);
+ audioFormat = getAudioFormat(vorbisInfo);
+ audioFreq = vorbisInfo->rate;
+
+ logDebug(" version: %d", vorbisInfo->version);
+ logDebug(" channels: %d", vorbisInfo->channels);
+ logDebug(" frequency: %d", vorbisInfo->rate);