diff options
-rw-r--r-- | Alc/backends/jack.c | 12 | ||||
-rw-r--r-- | alsoftrc.sample | 14 |
2 files changed, 24 insertions, 2 deletions
diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c index a3f44740..5bb2a1c3 100644 --- a/Alc/backends/jack.c +++ b/Alc/backends/jack.c @@ -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. */ diff --git a/alsoftrc.sample b/alsoftrc.sample index 3a3ca654..86d214bd 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -314,6 +314,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 ## [mmdevapi] |