X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSound.cc;h=4275ea4485900c67e147aeb04165b5f6c2496b30;hp=a6156249add8e0043c2b4f3637336053e4acb574;hb=71bd9dbaf1c1e3c55a9f63392a73865d8aeee7d4;hpb=8a1acac01b444dccf8b57cedf08392ada2e473c1 diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index a615624..4275ea4 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -35,6 +35,7 @@ #include #include +#include "Engine.hh" #include "Exception.hh" #include "Library.hh" #include "Log.hh" @@ -98,15 +99,12 @@ public: { 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); } @@ -137,7 +135,6 @@ public: if (size == 0) { logWarning("decoded no bytes from %s", getName().c_str()); - //throw Exception("file_not_found"); return; } @@ -209,6 +206,9 @@ public: void init() { + // make sure the engine is initialized + Engine::getInstance(); + ALfloat zero[] = {0.0f, 0.0f, 0.0f}; alGenSources(1, &mSource); @@ -273,12 +273,12 @@ public: 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);