diff options
author | Chris Robinson <[email protected]> | 2014-12-22 18:48:54 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-12-22 18:48:54 -0800 |
commit | b8d98dd6d0c3019e6e6681100fd9be092bc2a1c9 (patch) | |
tree | c3dfc2bd022b555b9f97810f3703ef6011b46150 /Alc/backends/jack.c | |
parent | 7e6d0d6b4fdfbf3f3f4f08a70de7563ed02a4948 (diff) |
Add an option for an increased ringbuffer size with JACK
Diffstat (limited to 'Alc/backends/jack.c')
-rw-r--r-- | Alc/backends/jack.c | 12 |
1 files changed, 10 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. */ |