From f23ff0394d8ae58dc12f8d1076fe5cd9dfde383d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 26 Apr 2019 15:58:25 -0700 Subject: Specify the buffer size as itself instead of the period count Certain backends don't need a buffer size to be a strict multiple of the period count, which allows a little more flexibility. The period/update size simply acts as the minimum request, which helps control CPU load by determining how often parameter and other pre-mixing updates are processed. --- Alc/backends/jack.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Alc/backends/jack.cpp') diff --git a/Alc/backends/jack.cpp b/Alc/backends/jack.cpp index 77d5fea0..74364f6a 100644 --- a/Alc/backends/jack.cpp +++ b/Alc/backends/jack.cpp @@ -202,14 +202,14 @@ int JackPlayback::bufferSizeNotify(jack_nframes_t numframes) { std::lock_guard _{mDevice->StateLock}; mDevice->UpdateSize = numframes; - mDevice->NumUpdates = 2; + mDevice->BufferSize = numframes*2; ALuint bufsize{mDevice->UpdateSize}; if(ConfigValueUInt(mDevice->DeviceName.c_str(), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), mDevice->UpdateSize); - mDevice->NumUpdates = (bufsize+mDevice->UpdateSize) / mDevice->UpdateSize; + mDevice->BufferSize = bufsize + mDevice->UpdateSize; - TRACE("%u update size x%u\n", mDevice->UpdateSize, mDevice->NumUpdates); + TRACE("%u / %u buffer\n", mDevice->UpdateSize, mDevice->BufferSize); mRing = nullptr; mRing = CreateRingBuffer(bufsize, mDevice->frameSizeFromFmt(), true); @@ -373,12 +373,12 @@ ALCboolean JackPlayback::reset() */ mDevice->Frequency = jack_get_sample_rate(mClient); mDevice->UpdateSize = jack_get_buffer_size(mClient); - mDevice->NumUpdates = 2; + mDevice->BufferSize = mDevice->UpdateSize * 2; ALuint bufsize{mDevice->UpdateSize}; if(ConfigValueUInt(mDevice->DeviceName.c_str(), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), mDevice->UpdateSize); - mDevice->NumUpdates = (bufsize+mDevice->UpdateSize) / mDevice->UpdateSize; + mDevice->BufferSize = bufsize + mDevice->UpdateSize; /* Force 32-bit float output. */ mDevice->FmtType = DevFmtFloat; -- cgit v1.2.3