]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Sound.hh
better logging (maybe) and exception handling
[chaz/yoink] / src / Moof / Sound.hh
index 23979db4aa019423573fbb8e73a59f5a49a6cc89..bc669bcd5df6dcf629ab26a97b564b23e6151b3a 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <boost/shared_ptr.hpp>
 
 
 #include <boost/shared_ptr.hpp>
 
+#include <Moof/Exception.hh>
 #include <Moof/Math.hh>
 #include <Moof/Resource.hh>
 
 #include <Moof/Math.hh>
 #include <Moof/Resource.hh>
 
@@ -58,10 +59,30 @@ public:
 
        static std::string getPath(const std::string& name);
 
 
        static std::string getPath(const std::string& name);
 
-       struct Exception : std::runtime_error
+       struct Exception : public Mf::Exception
        {
        {
-               explicit Exception(const std::string& what_arg) :
-                       std::runtime_error(what_arg) {}
+               enum
+               {
+                       BAD_AUDIO_FORMAT        = 1024
+               };
+
+               explicit Exception(unsigned error) :
+                       Mf::Exception(error) {}
+
+               void raise()
+               {
+                       throw *this;
+               }
+
+               const char* what() const throw()
+               {
+                       switch (code)
+                       {
+                               case BAD_AUDIO_FORMAT:
+                                       return "unknown audio format";
+                       }
+                       return Mf::Exception::what();
+               }
        };
 
 protected:
        };
 
 protected:
This page took 0.017245 seconds and 4 git commands to generate.