Do not dither samples as they pass through RingBuffer...

... See allocation of RingBuffers in AudioIO.

Playback buffers always used floatSample format so this change has no
effect on them.

But we also want no extra dithering applied during recording, where the capture
format might be narrower than float.
This commit is contained in:
Paul Licameli 2020-11-30 19:58:00 -05:00
parent 50a26d9caf
commit 0053c61c08
2 changed files with 4 additions and 2 deletions

View File

@ -85,7 +85,7 @@ size_t RingBuffer::Put(samplePtr buffer, sampleFormat format,
CopySamples(src, format,
mBuffer.ptr() + pos * SAMPLE_SIZE(mFormat), mFormat,
block);
block, DitherType::none);
src += block * SAMPLE_SIZE(format);
pos = (pos + block) % mBufferSize;
@ -167,7 +167,7 @@ size_t RingBuffer::Get(samplePtr buffer, sampleFormat format,
CopySamples(mBuffer.ptr() + start * SAMPLE_SIZE(mFormat), mFormat,
dest, format,
block);
block, DitherType::none);
dest += block * SAMPLE_SIZE(format);
start = (start + block) % mBufferSize;

View File

@ -24,6 +24,7 @@ class RingBuffer {
//
size_t AvailForPut();
//! Does not apply dithering
size_t Put(samplePtr buffer, sampleFormat format, size_t samples,
// optional number of trailing zeroes
size_t padding = 0);
@ -34,6 +35,7 @@ class RingBuffer {
//
size_t AvailForGet();
//! Does not apply dithering
size_t Get(samplePtr buffer, sampleFormat format, size_t samples);
size_t Discard(size_t samples);