From b632360518a31574bfb7f9ad794532359109a97e Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 29 May 2018 10:49:56 +0100 Subject: [PATCH] Fixed missing position update in MemoryAudioSource --- modules/juce_audio_basics/sources/juce_MemoryAudioSource.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_basics/sources/juce_MemoryAudioSource.cpp b/modules/juce_audio_basics/sources/juce_MemoryAudioSource.cpp index 6adec04448..a987d7f575 100644 --- a/modules/juce_audio_basics/sources/juce_MemoryAudioSource.cpp +++ b/modules/juce_audio_basics/sources/juce_MemoryAudioSource.cpp @@ -49,7 +49,8 @@ void MemoryAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& bufferT auto max = 0, pos = 0; auto n = buffer.getNumSamples(), m = bufferToFill.numSamples; - for (auto i = position; (i < n || isLooping) && (pos < m); i += max) + int i; + for (i = position; (i < n || isLooping) && (pos < m); i += max) { max = jmin (m - pos, n - (i % n)); @@ -65,6 +66,8 @@ void MemoryAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& bufferT if (pos < m) dst.clear (bufferToFill.startSample + pos, m - pos); + + position = (i % n); } } // namespace juce