[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 <kode54@gmail.com>
main
Christopher Snowhill 2022-07-19 23:04:25 -07:00
parent d9a09bff40
commit 7e03f423c3
1 changed files with 7 additions and 1 deletions

View File

@ -486,6 +486,12 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes
return [[AudioChunk alloc] init]; return [[AudioChunk alloc] init];
} }
AudioChunk *chunk = [chunkList objectAtIndex:0]; AudioChunk *chunk = [chunkList objectAtIndex:0];
#if !DSD_DECIMATE
AudioStreamBasicDescription asbd = [chunk format];
if(asbd.mBitsPerChannel == 1) {
maxFrameCount /= 8;
}
#endif
if([chunk frameCount] <= maxFrameCount) { if([chunk frameCount] <= maxFrameCount) {
[chunkList removeObjectAtIndex:0]; [chunkList removeObjectAtIndex:0];
listDuration -= [chunk duration]; listDuration -= [chunk duration];
@ -627,7 +633,7 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes
samplesRead *= 8; samplesRead *= 8;
#endif #endif
bitsPerSample = 32; bitsPerSample = 32;
bytesReadFromInput = samplesRead * inputFormat.mChannelsPerFrame * sizeof(float); bytesReadFromInput = samplesRead * floatFormat.mBytesPerPacket;
isFloat = YES; isFloat = YES;
inputBuffer = &tempData[buffer_adder]; inputBuffer = &tempData[buffer_adder];
inputChanged = YES; inputChanged = YES;