diff options
Diffstat (limited to 'intern/audaspace/intern/AUD_C-API.cpp')
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.cpp | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index d2c8e94c949..7a624aa53fd 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -25,6 +25,7 @@ #include "AUD_NULLDevice.h" #include "AUD_I3DDevice.h" +#include "AUD_FileFactory.h" #include "AUD_StreamBufferFactory.h" #include "AUD_DelayFactory.h" #include "AUD_LimiterFactory.h" @@ -48,7 +49,6 @@ #endif #ifdef WITH_FFMPEG -#include "AUD_FFMPEGFactory.h" extern "C" { #include <libavformat/avformat.h> } @@ -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,16 +110,13 @@ 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); return true; } - catch(AUD_Exception e) + catch(AUD_Exception) { return false; } @@ -187,21 +187,13 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound* sound) AUD_Sound* AUD_load(const char* filename) { assert(filename); -#ifdef WITH_FFMPEG - return new AUD_FFMPEGFactory(filename); -#else - return NULL; -#endif + return new AUD_FileFactory(filename); } AUD_Sound* AUD_loadBuffer(unsigned char* buffer, int size) { assert(buffer); -#ifdef WITH_FFMPEG - return new AUD_FFMPEGFactory(buffer, size); -#else - return NULL; -#endif + return new AUD_FileFactory(buffer, size); } AUD_Sound* AUD_bufferSound(AUD_Sound* sound) @@ -212,7 +204,7 @@ AUD_Sound* AUD_bufferSound(AUD_Sound* sound) { return new AUD_StreamBufferFactory(sound); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -226,7 +218,7 @@ AUD_Sound* AUD_delaySound(AUD_Sound* sound, float delay) { return new AUD_DelayFactory(sound, delay); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -240,7 +232,7 @@ extern AUD_Sound* AUD_limitSound(AUD_Sound* sound, float start, float end) { return new AUD_LimiterFactory(sound, start, end); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -254,7 +246,7 @@ AUD_Sound* AUD_pingpongSound(AUD_Sound* sound) { return new AUD_PingPongFactory(sound); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -268,7 +260,7 @@ AUD_Sound* AUD_loopSound(AUD_Sound* sound) { return new AUD_LoopFactory(sound); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -286,7 +278,7 @@ int AUD_stopLoop(AUD_Handle* handle) { return AUD_device->sendMessage(handle, message); } - catch(AUD_Exception e) + catch(AUD_Exception) { } } @@ -307,7 +299,7 @@ AUD_Handle* AUD_play(AUD_Sound* sound, int keep) { return AUD_device->play(sound, keep); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -368,7 +360,7 @@ AUD_Handle* AUD_play3D(AUD_Sound* sound, int keep) else return AUD_device->play(sound, keep); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -384,7 +376,7 @@ int AUD_updateListener(AUD_3DData* data) if(AUD_3ddevice) return AUD_3ddevice->updateListener(*data); } - catch(AUD_Exception e) + catch(AUD_Exception) { } return false; @@ -399,7 +391,7 @@ int AUD_set3DSetting(AUD_3DSetting setting, float value) if(AUD_3ddevice) return AUD_3ddevice->setSetting(setting, value); } - catch(AUD_Exception e) + catch(AUD_Exception) { } return false; @@ -414,7 +406,7 @@ float AUD_get3DSetting(AUD_3DSetting setting) if(AUD_3ddevice) return AUD_3ddevice->getSetting(setting); } - catch(AUD_Exception e) + catch(AUD_Exception) { } return 0.0; @@ -432,7 +424,7 @@ int AUD_update3DSource(AUD_Handle* handle, AUD_3DData* data) if(AUD_3ddevice) return AUD_3ddevice->updateSource(handle, *data); } - catch(AUD_Exception e) + catch(AUD_Exception) { } } @@ -451,7 +443,7 @@ int AUD_set3DSourceSetting(AUD_Handle* handle, if(AUD_3ddevice) return AUD_3ddevice->setSourceSetting(handle, setting, value); } - catch(AUD_Exception e) + catch(AUD_Exception) { } } @@ -469,7 +461,7 @@ float AUD_get3DSourceSetting(AUD_Handle* handle, AUD_3DSourceSetting setting) if(AUD_3ddevice) return AUD_3ddevice->getSourceSetting(handle, setting); } - catch(AUD_Exception e) + catch(AUD_Exception) { } } @@ -489,7 +481,7 @@ int AUD_setSoundVolume(AUD_Handle* handle, float volume) { return AUD_device->setCapability(AUD_CAPS_SOURCE_VOLUME, &caps); } - catch(AUD_Exception e) {} + catch(AUD_Exception) {} } return false; } @@ -507,7 +499,7 @@ int AUD_setSoundPitch(AUD_Handle* handle, float pitch) { return AUD_device->setCapability(AUD_CAPS_SOURCE_PITCH, &caps); } - catch(AUD_Exception e) {} + catch(AUD_Exception) {} } return false; } @@ -518,7 +510,7 @@ AUD_Device* AUD_openReadDevice(AUD_Specs specs) { return new AUD_ReadDevice(specs); } - catch(AUD_Exception e) + catch(AUD_Exception) { return NULL; } @@ -533,7 +525,7 @@ int AUD_playDevice(AUD_Device* device, AUD_Sound* sound) { return device->play(sound) != NULL; } - catch(AUD_Exception e) + catch(AUD_Exception) { return false; } @@ -548,7 +540,7 @@ int AUD_readDevice(AUD_Device* device, sample_t* buffer, int length) { return device->read(buffer, length); } - catch(AUD_Exception e) + catch(AUD_Exception) { return false; } @@ -562,7 +554,7 @@ void AUD_closeReadDevice(AUD_Device* device) { delete device; } - catch(AUD_Exception e) + catch(AUD_Exception) { } } |