Add an option for an increased ringbuffer size with JACK

This commit is contained in:
Chris Robinson
2014-12-22 18:48:54 -08:00
parent 7e6d0d6b4f
commit b8d98dd6d0
2 changed files with 24 additions and 2 deletions
+10 -2
View File
@@ -211,9 +211,13 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg)
{
ALCjackPlayback *self = arg;
ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice;
ALuint bufsize;
ALCjackPlayback_lock(self);
device->UpdateSize = numframes;
if(ConfigValueUInt("jack", "buffer-size", &bufsize))
device->UpdateSize = maxu(numframes, NextPowerOf2(bufsize));
else
device->UpdateSize = numframes;
TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates);
jack_ringbuffer_free(self->Ring);
@@ -372,6 +376,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
{
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
ALuint numchans, i;
ALuint bufsize;
for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
{
@@ -386,7 +391,10 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self)
* because there's one byte less of it that's writeable, and we only write
* in update-sized chunks. */
device->Frequency = jack_get_sample_rate(self->Client);
device->UpdateSize = jack_get_buffer_size(self->Client);
if(ConfigValueUInt("jack", "buffer-size", &bufsize))
device->UpdateSize = maxu(jack_get_buffer_size(self->Client), NextPowerOf2(bufsize));
else
device->UpdateSize = jack_get_buffer_size(self->Client);
device->NumUpdates = 2;
/* FIXME: Force stereo, 32-bit float output. */
+14
View File
@@ -313,6 +313,20 @@
##
[qsa]
##
## JACK backend stuff
##
[jack]
## buffer-size:
# Sets the update buffer size, in samples, that the backend will keep buffered
# to handle the server's real-time processing requests. This value must be a
# power of 2, or else it will be rounded up to the next power of 2. If it is
# less than JACK's buffer update size, it will be clamped. This option may
# be useful in case the server's update size is too small and doesn't give the
# mixer time to keep enough audio available for the processing requests.
#buffer-size = 0
##
## MMDevApi backend stuff
##