aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.c2
-rw-r--r--Alc/backends/coreaudio.c2
-rw-r--r--Alc/backends/dsound.c2
-rw-r--r--Alc/backends/jack.c10
-rw-r--r--Alc/backends/mmdevapi.c2
-rw-r--r--Alc/backends/opensl.c12
-rw-r--r--Alc/backends/oss.c2
-rw-r--r--Alc/backends/winmm.c2
8 files changed, 13 insertions, 21 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index d0f0e24e..9fc36582 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -1123,7 +1123,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name)
if(needring)
{
self->ring = ll_ringbuffer_create(
- device->UpdateSize*device->NumUpdates + 1,
+ device->UpdateSize*device->NumUpdates,
FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder),
false
);
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index caa01167..b2545c47 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -663,7 +663,7 @@ static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar
goto error;
self->ring = ll_ringbuffer_create(
- device->UpdateSize*self->sampleRateRatio*device->NumUpdates + 1,
+ (size_t)ceil(device->UpdateSize*self->sampleRateRatio*device->NumUpdates),
self->frameSize, false
);
if(!self->ring) goto error;
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 4c52e0f8..6bab641c 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -856,7 +856,7 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi
hr = IDirectSoundCapture_CreateCaptureBuffer(self->DSC, &DSCBDescription, &self->DSCbuffer, NULL);
if(SUCCEEDED(hr))
{
- self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1,
+ self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates,
InputType.Format.nBlockAlign, false);
if(self->Ring == NULL)
hr = DSERR_OUTOFMEMORY;
diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c
index 003877a4..67e3c106 100644
--- a/Alc/backends/jack.c
+++ b/Alc/backends/jack.c
@@ -229,8 +229,7 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg)
bufsize = device->UpdateSize;
if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
- bufsize += device->UpdateSize;
- device->NumUpdates = bufsize / device->UpdateSize;
+ device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize;
TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
@@ -391,9 +390,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
}
/* Ignore the requested buffer metrics and just keep one JACK-sized buffer
- * ready for when requested. Note that one period's worth of audio in the
- * ring buffer will always be left unfilled because one element of the ring
- * buffer will not be writeable, and we only write in period-sized chunks.
+ * ready for when requested.
*/
device->Frequency = jack_get_sample_rate(self->Client);
device->UpdateSize = jack_get_buffer_size(self->Client);
@@ -402,8 +399,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
bufsize = device->UpdateSize;
if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
- bufsize += device->UpdateSize;
- device->NumUpdates = bufsize / device->UpdateSize;
+ device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize;
/* Force 32-bit float output. */
device->FmtType = DevFmtFloat;
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 34dcf468..961cba52 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -1810,7 +1810,7 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self)
return hr;
}
- buffer_len = maxu(device->UpdateSize*device->NumUpdates + 1, buffer_len);
+ buffer_len = maxu(device->UpdateSize*device->NumUpdates, buffer_len);
ll_ringbuffer_free(self->Ring);
self->Ring = ll_ringbuffer_create(buffer_len,
FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder),
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index d930526d..a5ad3b09 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -566,12 +566,8 @@ static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self)
SLresult result;
ll_ringbuffer_free(self->mRing);
- /* NOTE: Add an extra update since one period's worth of audio in the ring
- * buffer will always be left unfilled because one element of the ring
- * buffer will not be writeable, and we only write in period-sized chunks.
- */
- self->mRing = ll_ringbuffer_create(device->NumUpdates + 1,
- self->mFrameSize*device->UpdateSize, true);
+ self->mRing = ll_ringbuffer_create(device->NumUpdates, self->mFrameSize*device->UpdateSize,
+ true);
result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
&bufferQueue);
@@ -847,8 +843,8 @@ static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name
if(SL_RESULT_SUCCESS == result)
{
- self->mRing = ll_ringbuffer_create(device->NumUpdates + 1,
- device->UpdateSize * self->mFrameSize, false);
+ self->mRing = ll_ringbuffer_create(device->NumUpdates, device->UpdateSize*self->mFrameSize,
+ false);
result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
&bufferQueue);
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index 61d25476..c0c98c43 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -729,7 +729,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
return ALC_INVALID_VALUE;
}
- self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1, frameSize, false);
+ self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, false);
if(!self->ring)
{
ERR("Ring buffer create failed\n");
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 787ba8e4..2f4c65df 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -626,7 +626,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name)
if(CapturedDataSize < (self->Format.nSamplesPerSec / 10))
CapturedDataSize = self->Format.nSamplesPerSec / 10;
- self->Ring = ll_ringbuffer_create(CapturedDataSize+1, self->Format.nBlockAlign, false);
+ self->Ring = ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false);
if(!self->Ring) goto failure;
InitRef(&self->WaveBuffersCommitted, 0);