aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-11-03 23:29:33 -0700
committerChris Robinson <[email protected]>2016-11-03 23:29:33 -0700
commit939d16d57c2e766828848ab6b10b5e943f2ba024 (patch)
tree0d6fa74d3b57a1a30fec8f85c4e815c1be1b1ae2 /Alc/backends
parentacc9f66baf7173da0f027df70e671d1edf513232 (diff)
Include the full JACK ringbuffer size for the device period count
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/jack.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c
index 283df297..fa04c594 100644
--- a/Alc/backends/jack.c
+++ b/Alc/backends/jack.c
@@ -211,12 +211,14 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg)
ALCjackPlayback_lock(self);
device->UpdateSize = numframes;
device->NumUpdates = 2;
- TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
bufsize = device->UpdateSize;
if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
bufsize += device->UpdateSize;
+ device->NumUpdates = bufsize / device->UpdateSize;
+
+ TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
ll_ringbuffer_free(self->Ring);
self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType));
@@ -248,8 +250,9 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg)
todo = minu(numframes, data[0].len);
for(c = 0;c < numchans;c++)
{
+ const ALfloat *restrict in = ((ALfloat*)data[0].buf) + c;
for(i = 0;i < todo;i++)
- out[c][i] = ((ALfloat*)data[0].buf)[i*numchans + c];
+ out[c][i] = in[i*numchans];
out[c] += todo;
}
total += todo;
@@ -259,8 +262,9 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg)
{
for(c = 0;c < numchans;c++)
{
+ const ALfloat *restrict in = ((ALfloat*)data[1].buf) + c;
for(i = 0;i < todo;i++)
- out[c][i] = ((ALfloat*)data[1].buf)[i*numchans + c];
+ out[c][i] = in[i*numchans];
out[c] += todo;
}
total += todo;
@@ -407,6 +411,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize))
bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize);
bufsize += device->UpdateSize;
+ device->NumUpdates = bufsize / device->UpdateSize;
/* Force 32-bit float output. */
device->FmtType = DevFmtFloat;