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/oss.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/oss.cpp')
-rw-r--r-- | Alc/backends/oss.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp index ccc59c39..cc385edf 100644 --- a/Alc/backends/oss.cpp +++ b/Alc/backends/oss.cpp @@ -391,7 +391,7 @@ ALCboolean OSSPlayback::reset() break; } - periods = mDevice->NumUpdates; + periods = mDevice->BufferSize / mDevice->UpdateSize; numChannels = mDevice->channelsFromFmt(); ossSpeed = mDevice->Frequency; frameSize = numChannels * mDevice->bytesFromFmt(); @@ -436,7 +436,7 @@ ALCboolean OSSPlayback::reset() mDevice->Frequency = ossSpeed; mDevice->UpdateSize = info.fragsize / frameSize; - mDevice->NumUpdates = info.fragments; + mDevice->BufferSize = info.fragments * mDevice->UpdateSize; SetDefaultChannelOrder(mDevice); @@ -598,8 +598,7 @@ ALCenum OSScapture::open(const ALCchar *name) int numChannels{mDevice->channelsFromFmt()}; int frameSize{numChannels * mDevice->bytesFromFmt()}; int ossSpeed{static_cast<int>(mDevice->Frequency)}; - int log2FragmentSize{log2i(mDevice->UpdateSize * mDevice->NumUpdates * - frameSize / periods)}; + int log2FragmentSize{log2i(mDevice->BufferSize * frameSize / periods)}; /* according to the OSS spec, 16 bytes are the minimum */ log2FragmentSize = std::max(log2FragmentSize, 4); @@ -645,7 +644,7 @@ ALCenum OSScapture::open(const ALCchar *name) return ALC_INVALID_VALUE; } - mRing = CreateRingBuffer(mDevice->UpdateSize*mDevice->NumUpdates, frameSize, false); + mRing = CreateRingBuffer(mDevice->BufferSize, frameSize, false); if(!mRing) { ERR("Ring buffer create failed\n"); |