From 3cc5b46a0eee2ba8076d602ea2055fb2fc9d8d18 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 14 Jan 2022 10:17:41 -0800 Subject: [PATCH] Cog Audio: Improve end of track handling --- Audio/Output/OutputCoreAudio.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index 24b73ae53..c0ba2d351 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -363,11 +363,12 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const // Try repeatedly! Buffer wraps can cause a slight data shortage, as can // unexpected track changes. - while ((amountRead < amountToRead) && [outputController endOfStream] == NO && [outputController shouldContinue] == YES) + while ((amountRead < amountToRead) && [outputController shouldContinue] == YES) { int amountRead2; //Use this since return type of readdata isnt known...may want to fix then can do a simple += to readdata amountRead2 = [outputController readData:(readPointer+amountRead) amount:amountToRead-amountRead]; amountRead += amountRead2; + usleep(500); } int framesRead = amountRead / sizeof(float);