Close the old audio device before and not after opening the new.
authorJoerg Mueller <nexyon@gmail.com>
Wed, 26 Aug 2009 10:02:17 +0000 (10:02 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Wed, 26 Aug 2009 10:02:17 +0000 (10:02 +0000)
intern/audaspace/intern/AUD_C-API.cpp

index 9481e2139e8b6f56665c6381fb78f2164275a34e..995d4c5f99e55af79886f74b2d3ac46af1affb95 100644 (file)
@@ -77,6 +77,9 @@ int AUD_init(AUD_DeviceType device, AUD_Specs specs, int buffersize)
 #endif
        AUD_IDevice* dev = NULL;
 
+       if(AUD_device)
+               AUD_exit();
+
        try
        {
                switch(device)
@@ -107,9 +110,6 @@ int AUD_init(AUD_DeviceType device, AUD_Specs specs, int buffersize)
                        return false;
                }
 
-               if(AUD_device)
-                       AUD_exit();
-
                AUD_device = dev;
                if(AUD_device->checkCapability(AUD_CAPS_3D_DEVICE))
                        AUD_3ddevice = dynamic_cast<AUD_I3DDevice*>(AUD_device);