#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
+#include "Engine.hh"
#include "Exception.hh"
#include "Library.hh"
#include "Log.hh"
{
logWarning("error while loading sound %s",
getName().c_str());
- throw Exception(ErrorCode::UNKNOWN_AUDIO_FORMAT);
+ throw Exception(ErrorCode::UNKNOWN_AUDIO_FORMAT, getName());
}
vorbis_info* vorbisInfo = ov_info(&mOggStream, -1);
mFormat = getAudioFormat(vorbisInfo);
mFreq = vorbisInfo->rate;
-
- logDebug(" channels: %d", vorbisInfo->channels);
- logDebug(" frequency: %d", vorbisInfo->rate);
}
if (size == 0)
{
logWarning("decoded no bytes from %s", getName().c_str());
- //throw Exception("file_not_found");
return;
}
void init()
{
+ // make sure the engine is initialized
+ Engine::getInstance();
+
ALfloat zero[] = {0.0f, 0.0f, 0.0f};
alGenSources(1, &mSource);
void beginStream()
{
ALuint buffer;
- for (int i = mBufferObjects.size(); i < 4; ++i)
+ for (int i = mBufferObjects.size(); i < 8; ++i)
{
alGenBuffers(1, &buffer);
mBufferObjects.push_back(buffer);
}
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < 8; ++i)
{
buffer = mBufferObjects[i];
mQueue.front()->stream(buffer);