diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.cpp | 9 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index d2a934740d6..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" @@ -317,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; @@ -1084,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; @@ -1107,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(); diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h index 64a3d06bd5f..657d4e6fd02 100644 --- a/intern/audaspace/intern/AUD_C-API.h +++ b/intern/audaspace/intern/AUD_C-API.h @@ -646,7 +646,7 @@ extern int AUD_doesPlayback(void); * \param samples_per_second How many samples to read per second of the sound. * \return How many samples really have been read. Always <= length. */ -extern int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_per_second); +extern int AUD_readSound(AUD_Sound *sound, sample_t *buffer, int length, int samples_per_second, short *interrupt); /** * Copies a sound. |