aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/wasapi.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-26 21:22:17 -0800
committerChris Robinson <[email protected]>2018-12-26 21:22:17 -0800
commit8a0295503db394ea895bfa079d1f3eda0d758e61 (patch)
tree21a1a1e63fe148dc087ad2c35ce94a49418ef900 /Alc/backends/wasapi.cpp
parent4f253a935a14e49a77516a56e0d4c6d6177a56b6 (diff)
Clean up the ring buffer struct and use member functions
Diffstat (limited to 'Alc/backends/wasapi.cpp')
-rw-r--r--Alc/backends/wasapi.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp
index c1b4bddb..e1783ef9 100644
--- a/Alc/backends/wasapi.cpp
+++ b/Alc/backends/wasapi.cpp
@@ -1230,7 +1230,8 @@ void ALCwasapiCapture_Destruct(ALCwasapiCapture *self)
FORCE_ALIGN int ALCwasapiCapture_recordProc(ALCwasapiCapture *self)
{
- ALCdevice *device{STATIC_CAST(ALCbackend, self)->mDevice};
+ ALCdevice *device{self->mDevice};
+ RingBuffer *ring{self->mRing.get()};
IAudioCaptureClient *capture{self->mCapture};
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
@@ -1272,7 +1273,7 @@ FORCE_ALIGN int ALCwasapiCapture_recordProc(ALCwasapiCapture *self)
rdata = reinterpret_cast<BYTE*>(samples.data());
}
- auto data = ll_ringbuffer_get_write_vector(self->mRing.get());
+ auto data = ring->getWriteVector();
size_t dstframes;
if(self->mSampleConv)
@@ -1308,7 +1309,7 @@ FORCE_ALIGN int ALCwasapiCapture_recordProc(ALCwasapiCapture *self)
dstframes = len1 + len2;
}
- ll_ringbuffer_write_advance(self->mRing.get(), dstframes);
+ ring->writeAdvance(dstframes);
hr = capture->ReleaseBuffer(numsamples);
if(FAILED(hr)) ERR("Failed to release capture buffer: 0x%08lx\n", hr);
@@ -1786,12 +1787,14 @@ void ALCwasapiCapture::stopProxy()
ALuint ALCwasapiCapture_availableSamples(ALCwasapiCapture *self)
{
- return (ALuint)ll_ringbuffer_read_space(self->mRing.get());
+ RingBuffer *ring{self->mRing.get()};
+ return (ALuint)ring->readSpace();
}
ALCenum ALCwasapiCapture_captureSamples(ALCwasapiCapture *self, ALCvoid *buffer, ALCuint samples)
{
- ll_ringbuffer_read(self->mRing.get(), reinterpret_cast<char*>(buffer), samples);
+ RingBuffer *ring{self->mRing.get()};
+ ring->read(buffer, samples);
return ALC_NO_ERROR;
}