diff options
author | Chris Robinson <[email protected]> | 2018-12-27 21:50:54 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-27 21:50:54 -0800 |
commit | 28308226e76f8378dc74db12b085d50bb97b11cb (patch) | |
tree | 22da2d33d98833a0eb62d612bcb1ed755f5d35a7 /Alc | |
parent | 885f68268feb21c7c7fbb6f01c7bd899b9846bfe (diff) |
Turn more methods into member functions
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/jack.cpp | 128 | ||||
-rw-r--r-- | Alc/backends/null.cpp | 43 | ||||
-rw-r--r-- | Alc/backends/opensl.cpp | 165 |
3 files changed, 169 insertions, 167 deletions
diff --git a/Alc/backends/jack.cpp b/Alc/backends/jack.cpp index 37855fe3..26086bf9 100644 --- a/Alc/backends/jack.cpp +++ b/Alc/backends/jack.cpp @@ -149,6 +149,17 @@ ALCboolean jack_load(void) struct ALCjackPlayback final : public ALCbackend { + ALCjackPlayback(ALCdevice *device) noexcept : ALCbackend{device} { } + ~ALCjackPlayback() override; + + static int bufferSizeNotifyC(jack_nframes_t numframes, void *arg); + int bufferSizeNotify(jack_nframes_t numframes); + + static int processC(jack_nframes_t numframes, void *arg); + int process(jack_nframes_t numframes); + + int mixerProc(); + jack_client_t *mClient{nullptr}; jack_port_t *mPort[MAX_OUTPUT_CHANNELS]{}; @@ -157,15 +168,8 @@ struct ALCjackPlayback final : public ALCbackend { std::atomic<bool> mKillNow{true}; std::thread mThread; - - ALCjackPlayback(ALCdevice *device) noexcept : ALCbackend{device} { } }; -int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg); - -int ALCjackPlayback_process(jack_nframes_t numframes, void *arg); -int ALCjackPlayback_mixerProc(ALCjackPlayback *self); - void ALCjackPlayback_Construct(ALCjackPlayback *self, ALCdevice *device); void ALCjackPlayback_Destruct(ALCjackPlayback *self); ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name); @@ -189,64 +193,65 @@ void ALCjackPlayback_Construct(ALCjackPlayback *self, ALCdevice *device) } void ALCjackPlayback_Destruct(ALCjackPlayback *self) +{ self->~ALCjackPlayback(); } + +ALCjackPlayback::~ALCjackPlayback() { - if(self->mClient) - { - std::for_each(std::begin(self->mPort), std::end(self->mPort), - [self](jack_port_t *port) -> void - { if(port) jack_port_unregister(self->mClient, port); } - ); - std::fill(std::begin(self->mPort), std::end(self->mPort), nullptr); - jack_client_close(self->mClient); - self->mClient = nullptr; - } + if(!mClient) + return; - self->~ALCjackPlayback(); + std::for_each(std::begin(mPort), std::end(mPort), + [this](jack_port_t *port) -> void + { if(port) jack_port_unregister(mClient, port); } + ); + std::fill(std::begin(mPort), std::end(mPort), nullptr); + jack_client_close(mClient); + mClient = nullptr; } -int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg) -{ - auto self = static_cast<ALCjackPlayback*>(arg); - ALCdevice *device{self->mDevice}; +int ALCjackPlayback::bufferSizeNotifyC(jack_nframes_t numframes, void *arg) +{ return static_cast<ALCjackPlayback*>(arg)->bufferSizeNotify(numframes); } - ALCjackPlayback_lock(self); - device->UpdateSize = numframes; - device->NumUpdates = 2; +int ALCjackPlayback::bufferSizeNotify(jack_nframes_t numframes) +{ + ALCjackPlayback_lock(this); + mDevice->UpdateSize = numframes; + mDevice->NumUpdates = 2; - ALuint bufsize{device->UpdateSize}; - if(ConfigValueUInt(device->DeviceName.c_str(), "jack", "buffer-size", &bufsize)) - bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); - device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize; + ALuint bufsize{mDevice->UpdateSize}; + if(ConfigValueUInt(mDevice->DeviceName.c_str(), "jack", "buffer-size", &bufsize)) + bufsize = maxu(NextPowerOf2(bufsize), mDevice->UpdateSize); + mDevice->NumUpdates = (bufsize+mDevice->UpdateSize) / mDevice->UpdateSize; - TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates); + TRACE("%u update size x%u\n", mDevice->UpdateSize, mDevice->NumUpdates); - self->mRing = nullptr; - self->mRing = CreateRingBuffer(bufsize, device->frameSizeFromFmt(), true); - if(!self->mRing) + mRing = nullptr; + mRing = CreateRingBuffer(bufsize, mDevice->frameSizeFromFmt(), true); + if(!mRing) { ERR("Failed to reallocate ringbuffer\n"); - aluHandleDisconnect(device, "Failed to reallocate %u-sample buffer", bufsize); + aluHandleDisconnect(mDevice, "Failed to reallocate %u-sample buffer", bufsize); } - ALCjackPlayback_unlock(self); + ALCjackPlayback_unlock(this); return 0; } -int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) -{ - auto self = static_cast<ALCjackPlayback*>(arg); +int ALCjackPlayback::processC(jack_nframes_t numframes, void *arg) +{ return static_cast<ALCjackPlayback*>(arg)->process(numframes); } +int ALCjackPlayback::process(jack_nframes_t numframes) +{ jack_default_audio_sample_t *out[MAX_OUTPUT_CHANNELS]; ALsizei numchans{0}; - for(auto port : self->mPort) + for(auto port : mPort) { if(!port) break; out[numchans++] = static_cast<float*>(jack_port_get_buffer(port, numframes)); } - RingBuffer *ring{self->mRing.get()}; - auto data = ring->getReadVector(); + auto data = mRing->getReadVector(); jack_nframes_t todo{minu(numframes, data.first.len)}; std::transform(out, out+numchans, out, [&data,numchans,todo](ALfloat *outbuf) -> ALfloat* @@ -288,8 +293,8 @@ int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) total += todo; } - ring->readAdvance(total); - self->mSem.post(); + mRing->readAdvance(total); + mSem.post(); if(numframes > total) { @@ -306,39 +311,36 @@ int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) return 0; } -int ALCjackPlayback_mixerProc(ALCjackPlayback *self) +int ALCjackPlayback::mixerProc() { - ALCdevice *device{self->mDevice}; - RingBuffer *ring{self->mRing.get()}; - SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); - ALCjackPlayback_lock(self); - while(!self->mKillNow.load(std::memory_order_acquire) && - device->Connected.load(std::memory_order_acquire)) + ALCjackPlayback_lock(this); + while(!mKillNow.load(std::memory_order_acquire) && + mDevice->Connected.load(std::memory_order_acquire)) { - if(ring->writeSpace() < device->UpdateSize) + if(mRing->writeSpace() < mDevice->UpdateSize) { - ALCjackPlayback_unlock(self); - self->mSem.wait(); - ALCjackPlayback_lock(self); + ALCjackPlayback_unlock(this); + mSem.wait(); + ALCjackPlayback_lock(this); continue; } - auto data = ring->getWriteVector(); + auto data = mRing->getWriteVector(); auto todo = static_cast<ALuint>(data.first.len + data.second.len); - todo -= todo%device->UpdateSize; + todo -= todo%mDevice->UpdateSize; ALuint len1{minu(data.first.len, todo)}; ALuint len2{minu(data.second.len, todo-len1)}; - aluMixData(device, data.first.buf, len1); + aluMixData(mDevice, data.first.buf, len1); if(len2 > 0) - aluMixData(device, data.second.buf, len2); - ring->writeAdvance(todo); + aluMixData(mDevice, data.second.buf, len2); + mRing->writeAdvance(todo); } - ALCjackPlayback_unlock(self); + ALCjackPlayback_unlock(this); return 0; } @@ -367,8 +369,8 @@ ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name) TRACE("Client name not unique, got `%s' instead\n", client_name); } - jack_set_process_callback(self->mClient, ALCjackPlayback_process, self); - jack_set_buffer_size_callback(self->mClient, ALCjackPlayback_bufferSizeNotify, self); + jack_set_process_callback(self->mClient, &ALCjackPlayback::processC, self); + jack_set_buffer_size_callback(self->mClient, &ALCjackPlayback::bufferSizeNotifyC, self); ALCdevice *device{self->mDevice}; device->DeviceName = name; @@ -478,7 +480,7 @@ ALCboolean ALCjackPlayback_start(ALCjackPlayback *self) try { self->mKillNow.store(false, std::memory_order_release); - self->mThread = std::thread(ALCjackPlayback_mixerProc, self); + self->mThread = std::thread(std::mem_fn(&ALCjackPlayback::mixerProc), self); return ALC_TRUE; } catch(std::exception& e) { diff --git a/Alc/backends/null.cpp b/Alc/backends/null.cpp index 7a4cf475..5367c46f 100644 --- a/Alc/backends/null.cpp +++ b/Alc/backends/null.cpp @@ -45,14 +45,14 @@ constexpr ALCchar nullDevice[] = "No Output"; struct ALCnullBackend final : public ALCbackend { + ALCnullBackend(ALCdevice *device) noexcept : ALCbackend{device} { } + + int mixerProc(); + std::atomic<ALenum> mKillNow{AL_TRUE}; std::thread mThread; - - ALCnullBackend(ALCdevice *device) noexcept : ALCbackend{device} { } }; -int ALCnullBackend_mixerProc(ALCnullBackend *self); - void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device); void ALCnullBackend_Destruct(ALCnullBackend *self); ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name); @@ -76,39 +76,36 @@ void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device) } void ALCnullBackend_Destruct(ALCnullBackend *self) -{ - self->~ALCnullBackend(); -} +{ self->~ALCnullBackend(); } -int ALCnullBackend_mixerProc(ALCnullBackend *self) +int ALCnullBackend::mixerProc() { - ALCdevice *device{self->mDevice}; - const milliseconds restTime{device->UpdateSize*1000/device->Frequency / 2}; + const milliseconds restTime{mDevice->UpdateSize*1000/mDevice->Frequency / 2}; SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); ALint64 done{0}; auto start = std::chrono::steady_clock::now(); - while(!self->mKillNow.load(std::memory_order_acquire) && - device->Connected.load(std::memory_order_acquire)) + while(!mKillNow.load(std::memory_order_acquire) && + mDevice->Connected.load(std::memory_order_acquire)) { auto now = std::chrono::steady_clock::now(); /* This converts from nanoseconds to nanosamples, then to samples. */ - ALint64 avail{std::chrono::duration_cast<seconds>((now-start) * device->Frequency).count()}; - if(avail-done < device->UpdateSize) + ALint64 avail{std::chrono::duration_cast<seconds>((now-start) * mDevice->Frequency).count()}; + if(avail-done < mDevice->UpdateSize) { std::this_thread::sleep_for(restTime); continue; } - while(avail-done >= device->UpdateSize) + while(avail-done >= mDevice->UpdateSize) { - ALCnullBackend_lock(self); - aluMixData(device, nullptr, device->UpdateSize); - ALCnullBackend_unlock(self); - done += device->UpdateSize; + ALCnullBackend_lock(this); + aluMixData(mDevice, nullptr, mDevice->UpdateSize); + ALCnullBackend_unlock(this); + done += mDevice->UpdateSize; } /* For every completed second, increment the start time and reduce the @@ -116,11 +113,11 @@ int ALCnullBackend_mixerProc(ALCnullBackend *self) * and current time from growing too large, while maintaining the * correct number of samples to render. */ - if(done >= device->Frequency) + if(done >= mDevice->Frequency) { - seconds s{done/device->Frequency}; + seconds s{done/mDevice->Frequency}; start += s; - done -= device->Frequency*s.count(); + done -= mDevice->Frequency*s.count(); } } @@ -151,7 +148,7 @@ ALCboolean ALCnullBackend_start(ALCnullBackend *self) { try { self->mKillNow.store(AL_FALSE, std::memory_order_release); - self->mThread = std::thread(ALCnullBackend_mixerProc, self); + self->mThread = std::thread(std::mem_fn(&ALCnullBackend::mixerProc), self); return ALC_TRUE; } catch(std::exception& e) { diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp index 0853e32f..b0e51441 100644 --- a/Alc/backends/opensl.cpp +++ b/Alc/backends/opensl.cpp @@ -38,6 +38,9 @@ #include <SLES/OpenSLES_Android.h> #include <SLES/OpenSLES_AndroidConfiguration.h> + +namespace { + /* Helper macros */ #define VCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS #define VCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS @@ -135,6 +138,14 @@ static const char *res_str(SLresult result) struct ALCopenslPlayback final : public ALCbackend { + ALCopenslPlayback(ALCdevice *device) noexcept : ALCbackend{device} { } + ~ALCopenslPlayback() override; + + static void processC(SLAndroidSimpleBufferQueueItf bq, void *context); + void process(SLAndroidSimpleBufferQueueItf bq); + + int mixerProc(); + /* engine interfaces */ SLObjectItf mEngineObj{nullptr}; SLEngineItf mEngine{nullptr}; @@ -152,13 +163,8 @@ struct ALCopenslPlayback final : public ALCbackend { std::atomic<ALenum> mKillNow{AL_TRUE}; std::thread mThread; - - ALCopenslPlayback(ALCdevice *device) noexcept : ALCbackend{device} { } }; -static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf bq, void *context); -static int ALCopenslPlayback_mixerProc(ALCopenslPlayback *self); - static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *device); static void ALCopenslPlayback_Destruct(ALCopenslPlayback *self); static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *name); @@ -182,30 +188,31 @@ static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *devi } static void ALCopenslPlayback_Destruct(ALCopenslPlayback* self) -{ - if(self->mBufferQueueObj != NULL) - VCALL0(self->mBufferQueueObj,Destroy)(); - self->mBufferQueueObj = NULL; +{ self->~ALCopenslPlayback(); } - if(self->mOutputMix) - VCALL0(self->mOutputMix,Destroy)(); - self->mOutputMix = NULL; - - if(self->mEngineObj) - VCALL0(self->mEngineObj,Destroy)(); - self->mEngineObj = NULL; - self->mEngine = NULL; - - self->~ALCopenslPlayback(); +ALCopenslPlayback::~ALCopenslPlayback() +{ + if(mBufferQueueObj) + VCALL0(mBufferQueueObj,Destroy)(); + mBufferQueueObj = nullptr; + + if(mOutputMix) + VCALL0(mOutputMix,Destroy)(); + mOutputMix = nullptr; + + if(mEngineObj) + VCALL0(mEngineObj,Destroy)(); + mEngineObj = nullptr; + mEngine = nullptr; } /* this callback handler is called every time a buffer finishes playing */ -static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), void *context) -{ - auto self = static_cast<ALCopenslPlayback*>(context); - RingBuffer *ring{self->mRing.get()}; +void ALCopenslPlayback::processC(SLAndroidSimpleBufferQueueItf bq, void *context) +{ static_cast<ALCopenslPlayback*>(context)->process(bq); } +void ALCopenslPlayback::process(SLAndroidSimpleBufferQueueItf UNUSED(bq)) +{ /* A note on the ringbuffer usage: The buffer queue seems to hold on to the * pointer passed to the Enqueue method, rather than copying the audio. * Consequently, the ringbuffer contains the audio that is currently queued @@ -214,42 +221,35 @@ static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), * available for writing again, and wake up the mixer thread to mix and * queue more audio. */ - ring->readAdvance(1); + mRing->readAdvance(1); - self->mSem.post(); + mSem.post(); } - -static int ALCopenslPlayback_mixerProc(ALCopenslPlayback *self) +int ALCopenslPlayback::mixerProc() { - ALCdevice *device{self->mDevice}; - RingBuffer *ring{self->mRing.get()}; - SLAndroidSimpleBufferQueueItf bufferQueue; - SLPlayItf player; - SLresult result; - SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); - result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, - &bufferQueue); + SLPlayItf player; + SLAndroidSimpleBufferQueueItf bufferQueue; + SLresult result{VCALL(mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue)}; PRINTERR(result, "bufferQueue->GetInterface SL_IID_ANDROIDSIMPLEBUFFERQUEUE"); if(SL_RESULT_SUCCESS == result) { - result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_PLAY, &player); + result = VCALL(mBufferQueueObj,GetInterface)(SL_IID_PLAY, &player); PRINTERR(result, "bufferQueue->GetInterface SL_IID_PLAY"); } - ALCopenslPlayback_lock(self); + ALCopenslPlayback_lock(this); if(SL_RESULT_SUCCESS != result) - aluHandleDisconnect(device, "Failed to get playback buffer: 0x%08x", result); + aluHandleDisconnect(mDevice, "Failed to get playback buffer: 0x%08x", result); - while(SL_RESULT_SUCCESS == result && !self->mKillNow.load(std::memory_order_acquire) && - device->Connected.load(std::memory_order_acquire)) + while(SL_RESULT_SUCCESS == result && !mKillNow.load(std::memory_order_acquire) && + mDevice->Connected.load(std::memory_order_acquire)) { - size_t todo; - - if(ring->writeSpace() == 0) + if(mRing->writeSpace() == 0) { SLuint32 state = 0; @@ -262,26 +262,26 @@ static int ALCopenslPlayback_mixerProc(ALCopenslPlayback *self) } if(SL_RESULT_SUCCESS != result) { - aluHandleDisconnect(device, "Failed to start platback: 0x%08x", result); + aluHandleDisconnect(mDevice, "Failed to start platback: 0x%08x", result); break; } - if(ring->writeSpace() == 0) + if(mRing->writeSpace() == 0) { - ALCopenslPlayback_unlock(self); - self->mSem.wait(); - ALCopenslPlayback_lock(self); + ALCopenslPlayback_unlock(this); + mSem.wait(); + ALCopenslPlayback_lock(this); continue; } } - auto data = ring->getWriteVector(); - aluMixData(device, data.first.buf, data.first.len*device->UpdateSize); + auto data = mRing->getWriteVector(); + aluMixData(mDevice, data.first.buf, data.first.len*mDevice->UpdateSize); if(data.second.len > 0) - aluMixData(device, data.second.buf, data.second.len*device->UpdateSize); + aluMixData(mDevice, data.second.buf, data.second.len*mDevice->UpdateSize); - todo = data.first.len+data.second.len; - ring->writeAdvance(todo); + size_t todo{data.first.len + data.second.len}; + mRing->writeAdvance(todo); for(size_t i{0};i < todo;i++) { @@ -292,20 +292,19 @@ static int ALCopenslPlayback_mixerProc(ALCopenslPlayback *self) data.second.len = 0; } - result = VCALL(bufferQueue,Enqueue)(data.first.buf, - device->UpdateSize*self->mFrameSize); + result = VCALL(bufferQueue,Enqueue)(data.first.buf, mDevice->UpdateSize*mFrameSize); PRINTERR(result, "bufferQueue->Enqueue"); if(SL_RESULT_SUCCESS != result) { - aluHandleDisconnect(device, "Failed to queue audio: 0x%08x", result); + aluHandleDisconnect(mDevice, "Failed to queue audio: 0x%08x", result); break; } data.first.len--; - data.first.buf += device->UpdateSize*self->mFrameSize; + data.first.buf += mDevice->UpdateSize*mFrameSize; } } - ALCopenslPlayback_unlock(self); + ALCopenslPlayback_unlock(this); return 0; } @@ -569,14 +568,13 @@ static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self) if(SL_RESULT_SUCCESS != result) return ALC_FALSE; - result = VCALL(bufferQueue,RegisterCallback)(ALCopenslPlayback_process, self); + result = VCALL(bufferQueue,RegisterCallback)(&ALCopenslPlayback::processC, self); PRINTERR(result, "bufferQueue->RegisterCallback"); - if(SL_RESULT_SUCCESS != result) - return ALC_FALSE; + if(SL_RESULT_SUCCESS != result) return ALC_FALSE; try { self->mKillNow.store(AL_FALSE); - self->mThread = std::thread(ALCopenslPlayback_mixerProc, self); + self->mThread = std::thread(std::mem_fn(&ALCopenslPlayback::mixerProc), self); return ALC_TRUE; } catch(std::exception& e) { @@ -649,6 +647,12 @@ static ClockLatency ALCopenslPlayback_getClockLatency(ALCopenslPlayback *self) struct ALCopenslCapture final : public ALCbackend { + ALCopenslCapture(ALCdevice *device) noexcept : ALCbackend{device} { } + ~ALCopenslCapture() override; + + static void processC(SLAndroidSimpleBufferQueueItf bq, void *context); + void process(SLAndroidSimpleBufferQueueItf bq); + /* engine interfaces */ SLObjectItf mEngineObj{nullptr}; SLEngineItf mEngine; @@ -660,12 +664,8 @@ struct ALCopenslCapture final : public ALCbackend { ALCuint mSplOffset{0u}; ALsizei mFrameSize{0}; - - ALCopenslCapture(ALCdevice *device) noexcept : ALCbackend{device} { } }; -static void ALCopenslCapture_process(SLAndroidSimpleBufferQueueItf bq, void *context); - static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device); static void ALCopenslCapture_Destruct(ALCopenslCapture *self); static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name); @@ -688,26 +688,28 @@ static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device } static void ALCopenslCapture_Destruct(ALCopenslCapture *self) -{ - if(self->mRecordObj != NULL) - VCALL0(self->mRecordObj,Destroy)(); - self->mRecordObj = NULL; - - if(self->mEngineObj != NULL) - VCALL0(self->mEngineObj,Destroy)(); - self->mEngineObj = NULL; - self->mEngine = NULL; +{ self->~ALCopenslCapture(); } - self->~ALCopenslCapture(); +ALCopenslCapture::~ALCopenslCapture() +{ + if(mRecordObj) + VCALL0(mRecordObj,Destroy)(); + mRecordObj = nullptr; + + if(mEngineObj) + VCALL0(mEngineObj,Destroy)(); + mEngineObj = nullptr; + mEngine = nullptr; } -static void ALCopenslCapture_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), void *context) +void ALCopenslCapture::processC(SLAndroidSimpleBufferQueueItf bq, void *context) +{ static_cast<ALCopenslCapture*>(context)->process(bq); } + +void ALCopenslCapture::process(SLAndroidSimpleBufferQueueItf UNUSED(bq)) { - auto *self = static_cast<ALCopenslCapture*>(context); - RingBuffer *ring{self->mRing.get()}; /* A new chunk has been written into the ring buffer, advance it. */ - ring->writeAdvance(1); + mRing->writeAdvance(1); } @@ -835,7 +837,7 @@ static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name } if(SL_RESULT_SUCCESS == result) { - result = VCALL(bufferQueue,RegisterCallback)(ALCopenslCapture_process, self); + result = VCALL(bufferQueue,RegisterCallback)(&ALCopenslCapture::processC, self); PRINTERR(result, "bufferQueue->RegisterCallback"); } if(SL_RESULT_SUCCESS == result) @@ -978,6 +980,7 @@ static ALCuint ALCopenslCapture_availableSamples(ALCopenslCapture *self) return ring->readSpace() * device->UpdateSize; } +} // namespace bool OSLBackendFactory::init() { return true; } |