AudioTransportSource / AudioFormatReaderSource::setLooping() interaction


If I’m reading the code correctly, it seems like the state set by AudioFormatReaderSource::setLooping() results in different behaviour for an AudioTransportSource depending on whether the loop count is zero or greater than zero. The relevant logic is here (juce_AudioTransportSource.cpp:278)

        if (positionableSource->getNextReadPosition() > positionableSource->getTotalLength() + 1
              && ! positionableSource->isLooping())
            playing = false;
            inputStreamEOF = true;

AFAICT this means that for looping sources, playback will stop at getTotalLength() if setLooping(false) is called before total length is reached, but will stop immediately if called after that.

Is there any reason for this inconsistent behaviour? It seems to me that loop state and playback state should be decoupled and setLooping(false) shouldn’t also stop playback.