aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/dsound.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-03-29 23:48:36 -0700
committerChris Robinson <[email protected]>2016-03-29 23:48:36 -0700
commitd6163fe570e09a6fa65ef1f11eba3d6bcbd3aa9f (patch)
treecb3294fad1b8111f253eeac06115a660142394b6 /Alc/backends/dsound.c
parent2ccc1d1d8a6ecc5c025e99518038fcc7a001d949 (diff)
Convert remaining ringbuffers to the lockless variant
Diffstat (limited to 'Alc/backends/dsound.c')
-rw-r--r--Alc/backends/dsound.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index c01e42ae..68ac08f1 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -653,7 +653,8 @@ typedef struct ALCdsoundCapture {
IDirectSoundCaptureBuffer *DSCbuffer;
DWORD BufferBytes;
DWORD Cursor;
- RingBuffer *Ring;
+
+ ll_ringbuffer_t *Ring;
} ALCdsoundCapture;
static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device);
@@ -823,7 +824,8 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
}
if(SUCCEEDED(hr))
{
- self->Ring = CreateRingBuffer(InputType.Format.nBlockAlign, device->UpdateSize * device->NumUpdates);
+ self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1,
+ InputType.Format.nBlockAlign);
if(self->Ring == NULL)
hr = DSERR_OUTOFMEMORY;
}
@@ -832,7 +834,7 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
{
ERR("Device init failed: 0x%08lx\n", hr);
- DestroyRingBuffer(self->Ring);
+ ll_ringbuffer_free(self->Ring);
self->Ring = NULL;
if(self->DSCbuffer != NULL)
IDirectSoundCaptureBuffer_Release(self->DSCbuffer);
@@ -854,7 +856,7 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
static void ALCdsoundCapture_close(ALCdsoundCapture *self)
{
- DestroyRingBuffer(self->Ring);
+ ll_ringbuffer_free(self->Ring);
self->Ring = NULL;
if(self->DSCbuffer != NULL)
@@ -897,7 +899,7 @@ static void ALCdsoundCapture_stop(ALCdsoundCapture *self)
static ALCenum ALCdsoundCapture_captureSamples(ALCdsoundCapture *self, ALCvoid *buffer, ALCuint samples)
{
- ReadRingBuffer(self->Ring, buffer, samples);
+ ll_ringbuffer_read(self->Ring, buffer, samples);
return ALC_NO_ERROR;
}
@@ -929,9 +931,9 @@ static ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self)
}
if(SUCCEEDED(hr))
{
- WriteRingBuffer(self->Ring, ReadPtr1, ReadCnt1/FrameSize);
+ ll_ringbuffer_write(self->Ring, ReadPtr1, ReadCnt1/FrameSize);
if(ReadPtr2 != NULL)
- WriteRingBuffer(self->Ring, ReadPtr2, ReadCnt2/FrameSize);
+ ll_ringbuffer_write(self->Ring, ReadPtr2, ReadCnt2/FrameSize);
hr = IDirectSoundCaptureBuffer_Unlock(self->DSCbuffer,
ReadPtr1, ReadCnt1,
ReadPtr2, ReadCnt2);
@@ -945,7 +947,7 @@ static ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self)
}
done:
- return RingBufferSize(self->Ring);
+ return ll_ringbuffer_read_space(self->Ring);
}