From f57fedec7f8878230fb77be1d91d7c056f7e6de4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 26 May 2019 21:28:51 -0700 Subject: Get rid of the COUNTOF macro --- Alc/backends/opensl.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'Alc/backends/opensl.cpp') diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp index 2072f99c..1cf309f7 100644 --- a/Alc/backends/opensl.cpp +++ b/Alc/backends/opensl.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -352,8 +353,6 @@ ALCboolean OpenSLPlayback::reset() SLDataLocator_OutputMix loc_outmix; SLDataSource audioSrc; SLDataSink audioSnk; - SLInterfaceID ids[2]; - SLboolean reqs[2]; SLresult result; if(mBufferQueueObj) @@ -437,6 +436,9 @@ ALCboolean OpenSLPlayback::reset() mFrameSize = mDevice->frameSizeFromFmt(); + const std::array ids{{ SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }}; + const std::array reqs{{ SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE }}; + loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; loc_bufq.numBuffers = mDevice->BufferSize / mDevice->UpdateSize; @@ -472,13 +474,8 @@ ALCboolean OpenSLPlayback::reset() audioSnk.pFormat = nullptr; - ids[0] = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; - reqs[0] = SL_BOOLEAN_TRUE; - ids[1] = SL_IID_ANDROIDCONFIGURATION; - reqs[1] = SL_BOOLEAN_FALSE; - - result = VCALL(mEngine,CreateAudioPlayer)(&mBufferQueueObj, &audioSrc, &audioSnk, COUNTOF(ids), - ids, reqs); + result = VCALL(mEngine,CreateAudioPlayer)(&mBufferQueueObj, &audioSrc, &audioSnk, ids.size(), + ids.data(), reqs.data()); PRINTERR(result, "engine->CreateAudioPlayer"); if(SL_RESULT_SUCCESS == result) { @@ -704,8 +701,8 @@ ALCenum OpenSLCapture::open(const ALCchar* name) } if(SL_RESULT_SUCCESS == result) { - const SLInterfaceID ids[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; - const SLboolean reqs[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE }; + const std::array ids{{ SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }}; + const std::array reqs{{ SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE }}; SLDataLocator_IODevice loc_dev{}; loc_dev.locatorType = SL_DATALOCATOR_IODEVICE; @@ -747,7 +744,7 @@ ALCenum OpenSLCapture::open(const ALCchar* name) audioSnk.pFormat = &format_pcm; result = VCALL(mEngine,CreateAudioRecorder)(&mRecordObj, &audioSrc, &audioSnk, - COUNTOF(ids), ids, reqs); + ids.size(), ids.data(), reqs.data()); PRINTERR(result, "engine->CreateAudioRecorder"); } if(SL_RESULT_SUCCESS == result) -- cgit v1.2.3