diff options
author | Chris Robinson <[email protected]> | 2014-01-19 02:45:51 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-01-19 02:45:51 -0800 |
commit | f193b539ce3804fd00b238f05531bd076fe41ec3 (patch) | |
tree | d64af4d2987db978cc015d7a3897bf4a8f5df3f3 | |
parent | 35fd4dcf771a3b2a10bca8b3677d6b39a21e61c9 (diff) |
Clear the OpenSL buffer queue when stopping
-rw-r--r-- | Alc/backends/opensl.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c index cba4c856..583cbf72 100644 --- a/Alc/backends/opensl.c +++ b/Alc/backends/opensl.c @@ -83,6 +83,10 @@ typedef struct SLDataLocator_AndroidSimpleBufferQueue { #define SLPlayItf_SetPlayState(a,b) ((*(a))->SetPlayState((a),(b))) +/* Should start using these generic callers instead of the name-specific ones above. */ +#define VCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS +#define VCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS + typedef struct { /* engine interfaces */ @@ -409,16 +413,25 @@ static void opensl_stop_playback(ALCdevice *Device) { osl_data *data = Device->ExtraData; SLPlayItf player; + SLAndroidSimpleBufferQueueItf bufferQueue; SLresult result; - result = SLObjectItf_GetInterface(data->bufferQueueObject, SL_IID_PLAY, &player); + result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_PLAY, &player); PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS == result) { - result = SLPlayItf_SetPlayState(player, SL_PLAYSTATE_STOPPED); + result = VCALL(player,SetPlayState)(SL_PLAYSTATE_STOPPED); PRINTERR(result, "player->SetPlayState"); } + result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_BUFFERQUEUE, &bufferQueue); + PRINTERR(result, "bufferQueue->GetInterface"); + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(bufferQueue,Clear)(bufferQueue); + PRINTERR(result, "bufferQueue->Clear"); + } + free(data->buffer); data->buffer = NULL; data->bufferSize = 0; |