Audaspace:
authorJoerg Mueller <nexyon@gmail.com>
Mon, 16 Aug 2010 13:13:05 +0000 (13:13 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Mon, 16 Aug 2010 13:13:05 +0000 (13:13 +0000)
* Fix for uncached exception whith invalid audio file.
* Includes fix for windows.

intern/audaspace/Python/AUD_PyAPI.cpp
intern/audaspace/intern/AUD_C-API.cpp

index 4b1298b04a4db2c6be34e7cd21c3189458fce874..b0c55d5856eb6e9a92e97ae19f90db65d0b067e5 100644 (file)
@@ -58,9 +58,6 @@
 #include "AUD_JackDevice.h"
 #endif
 
-#include <cstdlib>
-#include <unistd.h>
-
 // ====================================================================
 
 typedef enum
index 40cbbd92d93c97885adac8e5b59d19b561761d64..a12478ab4777dd0588b5ece84e314ad03c2d5487 100644 (file)
@@ -244,20 +244,23 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
 {
        assert(sound);
 
-       AUD_IReader* reader = sound->createReader();
-
        AUD_SoundInfo info;
+       info.specs.channels = AUD_CHANNELS_INVALID;
+       info.specs.rate = AUD_RATE_INVALID;
+       info.length = 0.0f;
 
-       if(reader)
+       try
        {
-               info.specs = reader->getSpecs();
-               info.length = reader->getLength() / (float) info.specs.rate;
+               AUD_IReader* reader = sound->createReader();
+
+               if(reader)
+               {
+                       info.specs = reader->getSpecs();
+                       info.length = reader->getLength() / (float) info.specs.rate;
+               }
        }
-       else
+       catch(AUD_Exception&)
        {
-               info.specs.channels = AUD_CHANNELS_INVALID;
-               info.specs.rate = AUD_RATE_INVALID;
-               info.length = 0.0f;
        }
 
        return info;