diff options
author | Chris Robinson <[email protected]> | 2018-12-26 21:22:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-26 21:22:17 -0800 |
commit | 8a0295503db394ea895bfa079d1f3eda0d758e61 (patch) | |
tree | 21a1a1e63fe148dc087ad2c35ce94a49418ef900 /Alc/backends/dsound.cpp | |
parent | 4f253a935a14e49a77516a56e0d4c6d6177a56b6 (diff) |
Clean up the ring buffer struct and use member functions
Diffstat (limited to 'Alc/backends/dsound.cpp')
-rw-r--r-- | Alc/backends/dsound.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp index 4ada7419..516a7770 100644 --- a/Alc/backends/dsound.cpp +++ b/Alc/backends/dsound.cpp @@ -889,16 +889,18 @@ void ALCdsoundCapture_stop(ALCdsoundCapture *self) ALCenum ALCdsoundCapture_captureSamples(ALCdsoundCapture *self, ALCvoid *buffer, ALCuint samples) { - ll_ringbuffer_read(self->Ring.get(), buffer, samples); + RingBuffer *ring{self->Ring.get()}; + ring->read(buffer, samples); return ALC_NO_ERROR; } ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) { - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ALCdevice *device{self->mDevice}; + RingBuffer *ring{self->Ring.get()}; if(!device->Connected.load(std::memory_order_acquire)) - return static_cast<ALCuint>(ll_ringbuffer_read_space(self->Ring.get())); + return static_cast<ALCuint>(ring->readSpace()); ALsizei FrameSize{device->frameSizeFromFmt()}; DWORD BufferBytes{self->BufferBytes}; @@ -911,15 +913,15 @@ ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) if(SUCCEEDED(hr)) { DWORD NumBytes{(ReadCursor-LastCursor + BufferBytes) % BufferBytes}; - if(!NumBytes) return static_cast<ALCubyte>(ll_ringbuffer_read_space(self->Ring.get())); + if(!NumBytes) return static_cast<ALCubyte>(ring->readSpace()); hr = self->DSCbuffer->Lock(LastCursor, NumBytes, &ReadPtr1, &ReadCnt1, &ReadPtr2, &ReadCnt2, 0); } if(SUCCEEDED(hr)) { - ll_ringbuffer_write(self->Ring.get(), ReadPtr1, ReadCnt1/FrameSize); + ring->write(ReadPtr1, ReadCnt1/FrameSize); if(ReadPtr2 != nullptr) - ll_ringbuffer_write(self->Ring.get(), ReadPtr2, ReadCnt2/FrameSize); + ring->write(ReadPtr2, ReadCnt2/FrameSize); hr = self->DSCbuffer->Unlock(ReadPtr1, ReadCnt1, ReadPtr2, ReadCnt2); self->Cursor = (LastCursor+ReadCnt1+ReadCnt2) % BufferBytes; } @@ -930,7 +932,7 @@ ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) aluHandleDisconnect(device, "Failure retrieving capture data: 0x%lx", hr); } - return static_cast<ALCuint>(ll_ringbuffer_read_space(self->Ring.get())); + return static_cast<ALCuint>(ring->readSpace()); } } // namespace |