X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSound.cc;fp=src%2FMoof%2FSound.cc;h=a0302fba003aaa6052e7e447f85a97d142ecd781;hp=368e9388bca4aee4f3665ae40b1abf1afa71f6cd;hb=8ad81a8282ce6e9e488a453e6bcd05fbc09715dc;hpb=50c1239917f5e443b8ec91773c85ceb3db7da67b diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index 368e938..a0302fb 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -63,6 +63,7 @@ struct Sound::Impl Buffer(const std::string& name) : Mippleton(name) { + sound = 0; objects[0] = 0; objects[1] = 0; } @@ -84,7 +85,7 @@ struct Sound::Impl 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); } @@ -93,8 +94,9 @@ struct Sound::Impl 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); @@ -207,6 +209,8 @@ Sound::Sound(const std::string& name) : void Sound::play() { + if (!impl_->buffer_->sound) return; + //alSourceRewind(impl_->source_); alSourcePlay(impl_->source_); impl_->playing = true;