diff options
Diffstat (limited to 'intern/audaspace/intern/AUD_C-API.cpp')
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index aa82e1da678..45d72ccb50e 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -46,6 +46,7 @@ #include <cstring> #include <cmath> #include <sstream> +#include <iostream> #include "AUD_NULLDevice.h" #include "AUD_I3DDevice.h" @@ -75,6 +76,7 @@ #include "AUD_MutexLock.h" #ifdef WITH_SDL +#include <SDL.h> #include "AUD_SDLDevice.h" #endif @@ -143,8 +145,14 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize) break; #ifdef WITH_SDL case AUD_SDL_DEVICE: - dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize)); - break; + if (SDL_Init == (void *)0) { + printf("Warning: SDL libraries are not installed\n"); + // No break, fall through to default, to return false + } + else { + dev = boost::shared_ptr<AUD_IDevice>(new AUD_SDLDevice(specs, buffersize)); + break; + } #endif #ifdef WITH_OPENAL case AUD_OPENAL_DEVICE: @@ -162,7 +170,7 @@ int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize) else #endif if (!AUD_jack_supported()) { - printf("Warning: Jack cllient not installed\n"); + printf("Warning: Jack client not installed\n"); // No break, fall through to default, to return false } else { @@ -310,8 +318,9 @@ AUD_SoundInfo AUD_getInfo(AUD_Sound *sound) info.length = reader->getLength() / (float) info.specs.rate; } } - catch(AUD_Exception&) + catch(AUD_Exception &ae) { + std::cout << ae.str << std::endl; } return info; @@ -1077,7 +1086,7 @@ int AUD_doesPlayback() return -1; } -int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_per_second) +int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_per_second, short *interrupt) { AUD_DeviceSpecs specs; sample_t *buf; @@ -1100,6 +1109,9 @@ int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_pe for (int i = 0; i < length; i++) { len = floor(samplejump * (i+1)) - floor(samplejump * i); + if (*interrupt) { + return 0; + } aBuffer.assureSize(len * AUD_SAMPLE_SIZE(specs)); buf = aBuffer.getBuffer(); |