aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-17 15:17:56 -0700
committerChris Robinson <[email protected]>2014-03-17 15:17:56 -0700
commitbe2aeeb2fb7b3a57eb87d769f9bed9a8b1e84a73 (patch)
tree76dcfa23d3b77de1c1a3585cb454d04f95d1241b /Alc/backends
parentdc744730252fda782fd8534d874dec63ed35695b (diff)
Remove some unneeded code and unnecessary macros in the OpenSL backend
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/opensl.c93
1 files changed, 20 insertions, 73 deletions
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index 76cbaf1a..619c9847 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -28,62 +28,9 @@
#include <SLES/OpenSLES.h>
-#if 1
#include <SLES/OpenSLES_Android.h>
-#else
-extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
-
-struct SLAndroidSimpleBufferQueueItf_;
-typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf;
-
-typedef void (*slAndroidSimpleBufferQueueCallback)(SLAndroidSimpleBufferQueueItf caller, void *pContext);
-
-typedef struct SLAndroidSimpleBufferQueueState_ {
- SLuint32 count;
- SLuint32 index;
-} SLAndroidSimpleBufferQueueState;
-
-
-struct SLAndroidSimpleBufferQueueItf_ {
- SLresult (*Enqueue) (
- SLAndroidSimpleBufferQueueItf self,
- const void *pBuffer,
- SLuint32 size
- );
- SLresult (*Clear) (
- SLAndroidSimpleBufferQueueItf self
- );
- SLresult (*GetState) (
- SLAndroidSimpleBufferQueueItf self,
- SLAndroidSimpleBufferQueueState *pState
- );
- SLresult (*RegisterCallback) (
- SLAndroidSimpleBufferQueueItf self,
- slAndroidSimpleBufferQueueCallback callback,
- void* pContext
- );
-};
-
-#define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE ((SLuint32) 0x800007BD)
-
-typedef struct SLDataLocator_AndroidSimpleBufferQueue {
- SLuint32 locatorType;
- SLuint32 numBuffers;
-} SLDataLocator_AndroidSimpleBufferQueue;
-
-#endif
/* Helper macros */
-#define SLObjectItf_Realize(a,b) ((*(a))->Realize((a),(b)))
-#define SLObjectItf_GetInterface(a,b,c) ((*(a))->GetInterface((a),(b),(c)))
-#define SLObjectItf_Destroy(a) ((*(a))->Destroy((a)))
-
-#define SLEngineItf_CreateOutputMix(a,b,c,d,e) ((*(a))->CreateOutputMix((a),(b),(c),(d),(e)))
-#define SLEngineItf_CreateAudioPlayer(a,b,c,d,e,f,g) ((*(a))->CreateAudioPlayer((a),(b),(c),(d),(e),(f),(g)))
-
-#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
@@ -186,7 +133,7 @@ static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *context)
buf = (ALbyte*)data->buffer + data->curBuffer*data->bufferSize;
aluMixData(Device, buf, data->bufferSize/data->frameSize);
- result = (*bq)->Enqueue(bq, buf, data->bufferSize);
+ result = VCALL(bq,Enqueue)(buf, data->bufferSize);
PRINTERR(result, "bq->Enqueue");
data->curBuffer = (data->curBuffer+1) % Device->NumUpdates;
@@ -212,33 +159,33 @@ static ALCenum opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName
PRINTERR(result, "slCreateEngine");
if(SL_RESULT_SUCCESS == result)
{
- result = SLObjectItf_Realize(data->engineObject, SL_BOOLEAN_FALSE);
+ result = VCALL(data->engineObject,Realize)(SL_BOOLEAN_FALSE);
PRINTERR(result, "engine->Realize");
}
if(SL_RESULT_SUCCESS == result)
{
- result = SLObjectItf_GetInterface(data->engineObject, SL_IID_ENGINE, &data->engine);
+ result = VCALL(data->engineObject,GetInterface)(SL_IID_ENGINE, &data->engine);
PRINTERR(result, "engine->GetInterface");
}
if(SL_RESULT_SUCCESS == result)
{
- result = SLEngineItf_CreateOutputMix(data->engine, &data->outputMix, 0, NULL, NULL);
+ result = VCALL(data->engine,CreateOutputMix)(&data->outputMix, 0, NULL, NULL);
PRINTERR(result, "engine->CreateOutputMix");
}
if(SL_RESULT_SUCCESS == result)
{
- result = SLObjectItf_Realize(data->outputMix, SL_BOOLEAN_FALSE);
+ result = VCALL(data->outputMix,Realize)(SL_BOOLEAN_FALSE);
PRINTERR(result, "outputMix->Realize");
}
if(SL_RESULT_SUCCESS != result)
{
if(data->outputMix != NULL)
- SLObjectItf_Destroy(data->outputMix);
+ VCALL0(data->outputMix,Destroy)();
data->outputMix = NULL;
if(data->engineObject != NULL)
- SLObjectItf_Destroy(data->engineObject);
+ VCALL0(data->engineObject,Destroy)();
data->engineObject = NULL;
data->engine = NULL;
@@ -258,13 +205,13 @@ static void opensl_close_playback(ALCdevice *Device)
osl_data *data = Device->ExtraData;
if(data->bufferQueueObject != NULL)
- SLObjectItf_Destroy(data->bufferQueueObject);
+ VCALL0(data->bufferQueueObject,Destroy)();
data->bufferQueueObject = NULL;
- SLObjectItf_Destroy(data->outputMix);
+ VCALL0(data->outputMix,Destroy)();
data->outputMix = NULL;
- SLObjectItf_Destroy(data->engineObject);
+ VCALL0(data->engineObject,Destroy)();
data->engineObject = NULL;
data->engine = NULL;
@@ -321,21 +268,21 @@ static ALCboolean opensl_reset_playback(ALCdevice *Device)
if(data->bufferQueueObject != NULL)
- SLObjectItf_Destroy(data->bufferQueueObject);
+ VCALL0(data->bufferQueueObject,Destroy)();
data->bufferQueueObject = NULL;
- result = SLEngineItf_CreateAudioPlayer(data->engine, &data->bufferQueueObject, &audioSrc, &audioSnk, 1, &id, &req);
+ result = VCALL(data->engine,CreateAudioPlayer)(&data->bufferQueueObject, &audioSrc, &audioSnk, 1, &id, &req);
PRINTERR(result, "engine->CreateAudioPlayer");
if(SL_RESULT_SUCCESS == result)
{
- result = SLObjectItf_Realize(data->bufferQueueObject, SL_BOOLEAN_FALSE);
+ result = VCALL(data->bufferQueueObject,Realize)(SL_BOOLEAN_FALSE);
PRINTERR(result, "bufferQueue->Realize");
}
if(SL_RESULT_SUCCESS != result)
{
if(data->bufferQueueObject != NULL)
- SLObjectItf_Destroy(data->bufferQueueObject);
+ VCALL0(data->bufferQueueObject,Destroy)();
data->bufferQueueObject = NULL;
return ALC_FALSE;
@@ -352,11 +299,11 @@ static ALCboolean opensl_start_playback(ALCdevice *Device)
SLresult result;
ALuint i;
- result = SLObjectItf_GetInterface(data->bufferQueueObject, SL_IID_BUFFERQUEUE, &bufferQueue);
+ result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_BUFFERQUEUE, &bufferQueue);
PRINTERR(result, "bufferQueue->GetInterface");
if(SL_RESULT_SUCCESS == result)
{
- result = (*bufferQueue)->RegisterCallback(bufferQueue, opensl_callback, Device);
+ result = VCALL(bufferQueue,RegisterCallback)(opensl_callback, Device);
PRINTERR(result, "bufferQueue->RegisterCallback");
}
if(SL_RESULT_SUCCESS == result)
@@ -376,26 +323,26 @@ static ALCboolean opensl_start_playback(ALCdevice *Device)
if(SL_RESULT_SUCCESS == result)
{
ALvoid *buf = (ALbyte*)data->buffer + i*data->bufferSize;
- result = (*bufferQueue)->Enqueue(bufferQueue, buf, data->bufferSize);
+ result = VCALL(bufferQueue,Enqueue)(buf, data->bufferSize);
PRINTERR(result, "bufferQueue->Enqueue");
}
}
data->curBuffer = 0;
if(SL_RESULT_SUCCESS == 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_PLAYING);
+ result = VCALL(player,SetPlayState)(SL_PLAYSTATE_PLAYING);
PRINTERR(result, "player->SetPlayState");
}
if(SL_RESULT_SUCCESS != result)
{
if(data->bufferQueueObject != NULL)
- SLObjectItf_Destroy(data->bufferQueueObject);
+ VCALL0(data->bufferQueueObject,Destroy)();
data->bufferQueueObject = NULL;
free(data->buffer);