diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 88f5a1bda3..93348576ec 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -2,6 +2,25 @@ # Version 8.0.4 + +## Change + +The behavior of AudioTransportSource::hasStreamFinished has been updated to correctly return true when the stream has finished. + +**Possible Issues** + +This change may affect any code that relied on the previous behavior, where the method never returned true. + +**Workaround** + +Review and update any code that depends on hasStreamFinished or any registered ChangeListeners that respond to stream completion. + +**Rationale** + +The previous behavior, where hasStreamFinished never returned true, was incorrect. +This update ensures the method works as intended. + + ## Change Support for Arm32 in Projucer has been removed for Windows targets. diff --git a/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp b/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp index 8bf92ba0aa..d4cd074be0 100644 --- a/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioTransportSource.cpp @@ -168,9 +168,13 @@ double AudioTransportSource::getLengthInSeconds() const bool AudioTransportSource::hasStreamFinished() const noexcept { - return positionableSource == nullptr - || (positionableSource->getNextReadPosition() > positionableSource->getTotalLength() + 1 - && ! positionableSource->isLooping()); + if (positionableSource == nullptr) + return true; + + if (positionableSource->isLooping()) + return false; + + return positionableSource->getNextReadPosition() >= positionableSource->getTotalLength(); } void AudioTransportSource::setNextReadPosition (int64 newPosition)