Flac Audio Format Streaming Audio Source Bug/Regression

On the latest JUCE develop, the FLAC audio format is broken when used with BufferingAudioReader. In commit [93a923] (Reservoir: Factor out reservoir management code · juce-framework/JUCE@930a329 · GitHub), @reuk refactored Flac reading with some lambda magic. In line 276 there’s now:

zeromem (destSamples[i] + startOffsetInDestBuffer, (size_t) remainingSamples.getLength() * sizeof (int));

But compared to the old version, startOffsetInDestBuffer never gets increased in those lambdas. During streaming, this leads to erasing audio that was just read.

I guess it should be

zeromem (destSamples[I] + remainingSamples.getStart(), (size_t) remainingSamples.getLength() * sizeof (int));

That at least seems to work for me, but those nested lambdas make the method very hard to read and understand - it would be nice to have this properly fixed in JUCE.

Thank you for reporting.

1 Like