From 7e03f423c3f2bf191db33e216ee900c94a4db02a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 19 Jul 2022 23:04:25 -0700 Subject: [PATCH] [Chunk List Converter] Minor changes Neither of these two changes is really important, but they do simplify things, and the division on that one function makes the non-decimating DSD support actually functional, as the caller expects a specific number of samples, and that was otherwise octupling the input sample count. Signed-off-by: Christopher Snowhill --- Audio/Chain/ChunkList.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Audio/Chain/ChunkList.m b/Audio/Chain/ChunkList.m index 24e6acb07..4c6b75e31 100644 --- a/Audio/Chain/ChunkList.m +++ b/Audio/Chain/ChunkList.m @@ -486,6 +486,12 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes return [[AudioChunk alloc] init]; } AudioChunk *chunk = [chunkList objectAtIndex:0]; +#if !DSD_DECIMATE + AudioStreamBasicDescription asbd = [chunk format]; + if(asbd.mBitsPerChannel == 1) { + maxFrameCount /= 8; + } +#endif if([chunk frameCount] <= maxFrameCount) { [chunkList removeObjectAtIndex:0]; listDuration -= [chunk duration]; @@ -627,7 +633,7 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes samplesRead *= 8; #endif bitsPerSample = 32; - bytesReadFromInput = samplesRead * inputFormat.mChannelsPerFrame * sizeof(float); + bytesReadFromInput = samplesRead * floatFormat.mBytesPerPacket; isFloat = YES; inputBuffer = &tempData[buffer_adder]; inputChanged = YES;