X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSound.cc;h=ffa270e9e9876768669cd7ca3bdf850d46b5b09c;hp=c78b35c613b972d919b51de87db0c4cbc215d503;hb=90b2c7fb10b244b781b84965a0d36f1f323ee94d;hpb=8148b51f1bec8f662672d3ca36eea1784991e5cc diff --git a/src/Moof/Sound.cc b/src/Moof/Sound.cc index c78b35c..ffa270e 100644 --- a/src/Moof/Sound.cc +++ b/src/Moof/Sound.cc @@ -75,12 +75,14 @@ public: mOggStream.datasource = 0; } - std::string path = Sound::getPath(name); - int result = ov_fopen((char*)path.c_str(), &mOggStream); + std::string path(name); + if (!Sound::getPath(path)) + { + Error(Error::RESOURCE_NOT_FOUND, path).raise(); + } - if (result < 0) + if (ov_fopen((char*)path.c_str(), &mOggStream) < 0) { - logWarning << "couldn't load sound: " << path << std::endl; Error(Error::UNKNOWN_AUDIO_FORMAT, path).raise(); } @@ -572,19 +574,9 @@ void Sound::setListenerOrientation(const Vector3& forward, } -std::string Sound::getPath(const std::string& name) +bool Sound::getPath(std::string& name) { - if (boost::find_last(name, ".ogg")) - { - return Resource::getPath(name); - } - else - { - std::string path("sounds/"); - path += name; - path += ".ogg"; - return Resource::getPath(path); - } + return Resource::getPath(name, "sounds/", "ogg"); }