From 323a554832a578e608a0b65f3fcdbcfe05459b13 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 14 Jul 2023 04:14:14 -0700 Subject: [PATCH] Fix lossless capability reporting for partial read When reading partial chunks, and when returning partial data, it is essential to maintain this lossless chunk status across either whole or partial chunk reads. Otherwise, the converter chain sees the lossless flag constantly changing on lossless files, such as PCM or DSD, and causes the DSD decimator and/or resampler to be torn down and reset repeatedly, causing glitches in the audio. The glitch was not, in fact, with the decimator itself, and was occurring to a degree without it, as it would be restarting the resampler repeatedly as well. Fixes #367 Signed-off-by: Christopher Snowhill --- Audio/Chain/ChunkList.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Audio/Chain/ChunkList.m b/Audio/Chain/ChunkList.m index 71cc6a5f4..a2043c075 100644 --- a/Audio/Chain/ChunkList.m +++ b/Audio/Chain/ChunkList.m @@ -475,6 +475,7 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes AudioChunk *ret = [[AudioChunk alloc] init]; [ret setFormat:[chunk format]]; [ret setChannelConfig:[chunk channelConfig]]; + [ret setLossless:[chunk lossless]]; [ret assignData:removedData]; listDuration -= [ret duration]; inRemover = NO; @@ -510,6 +511,7 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes AudioChunk *ret = [[AudioChunk alloc] init]; [ret setFormat:[chunk format]]; [ret setChannelConfig:[chunk channelConfig]]; + [ret setLossless:[chunk lossless]]; [ret assignData:removedData]; listDuration -= [ret duration]; inRemover = NO;