]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Sound.cc
fixed permissions for stlplus files
[chaz/yoink] / src / Moof / Sound.cc
index a6156249add8e0043c2b4f3637336053e4acb574..4275ea4485900c67e147aeb04165b5f6c2496b30 100644 (file)
@@ -35,6 +35,7 @@
 #include <vorbis/codec.h>
 #include <vorbis/vorbisfile.h>
 
+#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);
This page took 0.019095 seconds and 4 git commands to generate.