]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Sound.cc
initial port to win32
[chaz/yoink] / src / Moof / Sound.cc
index 368e9388bca4aee4f3665ae40b1abf1afa71f6cd..a0302fba003aaa6052e7e447f85a97d142ecd781 100644 (file)
@@ -63,6 +63,7 @@ struct Sound::Impl
                Buffer(const std::string& name) :
                        Mippleton<Buffer>(name)
                {
                Buffer(const std::string& name) :
                        Mippleton<Buffer>(name)
                {
+                       sound = 0;
                        objects[0] = 0;
                        objects[1] = 0;
                }
                        objects[0] = 0;
                        objects[1] = 0;
                }
@@ -84,7 +85,7 @@ struct Sound::Impl
 
                        if (!sound)
                        {
 
                        if (!sound)
                        {
-                               logWarning("audio not found: %s", getName().c_str());
+                               logWarning("error while loading sound %s: %s", getName().c_str(), Sound_GetError());
                                throw Exception(Exception::FILE_NOT_FOUND);
                        }
 
                                throw Exception(Exception::FILE_NOT_FOUND);
                        }
 
@@ -93,8 +94,9 @@ struct Sound::Impl
                        unsigned decoded = Sound_DecodeAll(sound);
                        if (decoded == 0)
                        {
                        unsigned decoded = Sound_DecodeAll(sound);
                        if (decoded == 0)
                        {
-                               logWarning("decoded not bytes from %s", getName().c_str());
-                               throw Exception(Exception::FILE_NOT_FOUND);
+                               logWarning("decoded no bytes from %s", getName().c_str());
+                               //throw Exception(Exception::FILE_NOT_FOUND);
+                               return;
                        }
 
                        alGenBuffers(2, objects);
                        }
 
                        alGenBuffers(2, objects);
@@ -207,6 +209,8 @@ Sound::Sound(const std::string& name) :
 
 void Sound::play()
 {
 
 void Sound::play()
 {
+       if (!impl_->buffer_->sound) return;
+
        //alSourceRewind(impl_->source_);
        alSourcePlay(impl_->source_);
        impl_->playing = true;
        //alSourceRewind(impl_->source_);
        alSourcePlay(impl_->source_);
        impl_->playing = true;
This page took 0.017965 seconds and 4 git commands to generate.