From 869a9fd9944d4d87246567451ea49cf65eb2b6f9 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 4 Jul 2019 11:37:32 +0100 Subject: [PATCH] CoreAudio: Handle ExtAudioFileRead() reading fewer frames than expected --- modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp index 999bf8d902..039da4afab 100644 --- a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp @@ -494,6 +494,12 @@ public: if (status != noErr) return false; + if ((int) numFramesToRead < numThisTime) + { + numThisTime = (int) numFramesToRead; + numBytes = (size_t) numThisTime * sizeof (float); + } + for (int i = numDestChannels; --i >= 0;) { auto* dest = destSamples[(i < (int) numChannels ? channelMap[i] : i)];