From 10ce121dbd05e048c89a2b7c32f2ddabbc8fbe77 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 22 Dec 2018 11:38:38 -0800 Subject: Use a normal delete instead of ll_ringbuffer_free And use RingBufferPtr in more places --- Alc/backends/winmm.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'Alc/backends/winmm.cpp') diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp index 362b2e5e..38766869 100644 --- a/Alc/backends/winmm.cpp +++ b/Alc/backends/winmm.cpp @@ -401,7 +401,7 @@ struct ALCwinmmCapture final : public ALCbackend { HWAVEIN InHdl{nullptr}; - ll_ringbuffer_t *Ring{nullptr}; + RingBufferPtr Ring{nullptr}; WAVEFORMATEX Format{}; @@ -448,9 +448,6 @@ void ALCwinmmCapture_Destruct(ALCwinmmCapture *self) al_free(self->WaveBuffer[0].lpData); std::fill(self->WaveBuffer.begin(), self->WaveBuffer.end(), WAVEHDR{}); - ll_ringbuffer_free(self->Ring); - self->Ring = nullptr; - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~ALCwinmmCapture(); } @@ -497,7 +494,7 @@ int ALCwinmmCapture_captureProc(ALCwinmmCapture *self) WAVEHDR &waveHdr = self->WaveBuffer[widx]; widx = (widx+1) % self->WaveBuffer.size(); - ll_ringbuffer_write(self->Ring, waveHdr.lpData, + ll_ringbuffer_write(self->Ring.get(), waveHdr.lpData, waveHdr.dwBytesRecorded / self->Format.nBlockAlign ); self->Readable.fetch_sub(1, std::memory_order_acq_rel); @@ -585,7 +582,7 @@ ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *deviceName) std::max(device->UpdateSize*device->NumUpdates, BufferSize*self->WaveBuffer.size()) ); - self->Ring = ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false); + self->Ring.reset(ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false)); if(!self->Ring) return ALC_INVALID_VALUE; al_free(self->WaveBuffer[0].lpData); @@ -648,13 +645,13 @@ void ALCwinmmCapture_stop(ALCwinmmCapture *self) ALCenum ALCwinmmCapture_captureSamples(ALCwinmmCapture *self, ALCvoid *buffer, ALCuint samples) { - ll_ringbuffer_read(self->Ring, buffer, samples); + ll_ringbuffer_read(self->Ring.get(), buffer, samples); return ALC_NO_ERROR; } ALCuint ALCwinmmCapture_availableSamples(ALCwinmmCapture *self) { - return (ALCuint)ll_ringbuffer_read_space(self->Ring); + return (ALCuint)ll_ringbuffer_read_space(self->Ring.get()); } } // namespace -- cgit v1.2.3