From 2282538c423852476f507f14da41e7c071adaf95 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 26 Mar 2025 19:07:36 -0700 Subject: [PATCH] Bug Fix: Fix inserting empty chunks on track ends This code did not check the number of samples in a packet before adding it to the output buffer, which apparently had the potential to cause the output code to emit up to 512 samples of silence between tracks. This, as one can guess, is a bad thing, and causes noticeable gapping between tracks. Signed-off-by: Christopher Snowhill --- Audio/Output/OutputCoreAudio.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index 96841cb6f..d0533c915 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -625,9 +625,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons AudioChunk *chunk = [self renderInput:512]; size_t frameCount = 0; - if(chunk) { - frameCount = [chunk frameCount]; - + if(chunk && (frameCount = [chunk frameCount])) { [outputLock lock]; [outputBuffer addChunk:chunk]; [outputLock unlock];