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/alsa.cpp | |
parent | 4f253a935a14e49a77516a56e0d4c6d6177a56b6 (diff) |
Clean up the ring buffer struct and use member functions
Diffstat (limited to 'Alc/backends/alsa.cpp')
-rw-r--r-- | Alc/backends/alsa.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp index cf3f7fff..fd6981f8 100644 --- a/Alc/backends/alsa.cpp +++ b/Alc/backends/alsa.cpp @@ -1136,9 +1136,9 @@ ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buffer, ALC { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - if(self->Ring) + if(RingBuffer *ring{self->Ring.get()}) { - ll_ringbuffer_read(self->Ring.get(), static_cast<char*>(buffer), samples); + ring->read(static_cast<char*>(buffer), samples); return ALC_NO_ERROR; } @@ -1221,7 +1221,8 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) } } - if(!self->Ring) + RingBuffer *ring{self->Ring.get()}; + if(!ring) { if(avail < 0) avail = 0; avail += snd_pcm_bytes_to_frames(self->PcmHandle, self->Buffer.size()); @@ -1231,7 +1232,7 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) while(avail > 0) { - auto vec = ll_ringbuffer_get_write_vector(self->Ring.get()); + auto vec = ring->getWriteVector(); if(vec.first.len == 0) break; snd_pcm_sframes_t amt{std::min<snd_pcm_sframes_t>(vec.first.len, avail)}; @@ -1259,11 +1260,11 @@ ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) continue; } - ll_ringbuffer_write_advance(self->Ring.get(), amt); + ring->writeAdvance(amt); avail -= amt; } - return ll_ringbuffer_read_space(self->Ring.get()); + return ring->readSpace(); } ClockLatency ALCcaptureAlsa_getClockLatency(ALCcaptureAlsa *self) |