diff options
author | Chris Robinson <[email protected]> | 2019-04-26 15:58:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-04-26 15:58:25 -0700 |
commit | f23ff0394d8ae58dc12f8d1076fe5cd9dfde383d (patch) | |
tree | 6ab98ccc85c76eb77bf8c533cdaae179fb0b6bd4 /Alc/backends/jack.cpp | |
parent | 348e01dc4bc16ac4543d54b722fb46dbdebcb1e3 (diff) |
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.
Diffstat (limited to 'Alc/backends/jack.cpp')
-rw-r--r-- | Alc/backends/jack.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<std::mutex> _{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; |