I think theres a bug in AudioTransportSource::getNextAudioBlock
(juce_AudioTransportSource.cpp, line 280).
[code]void AudioTransportSource::getNextAudioBlock (const AudioSourceChannelInfo& info)
{
const ScopedLock sl (callbackLock);
if (masterSource != 0 && ! stopped)
{
masterSource->getNextAudioBlock (info);
if (! playing)
{
// just stopped playing, so fade out the last block..
for (int i = info.buffer->getNumChannels(); --i >= 0;)
info.buffer->applyGainRamp (i, 0, jmin (256, info.numSamples), 1.0f, 0.0f); // BUG, LINE 280
///////////////////// BUGFIX: /////////////////////
if (info.numSamples > 256)
info.buffer->clear(256, info.numSamples - 256);
/////////////////////////////////////////////////////
}
if (positionableSource->getNextReadPosition() > positionableSource->getTotalLength() + 1
&& ! positionableSource->isLooping())
{
playing = false;
sendChangeMessage (this);
}
stopped = ! playing;
for (int i = info.buffer->getNumChannels(); --i >= 0;)
{
info.buffer->applyGainRamp (i, info.startSample, info.numSamples,
lastGain, gain);
}
}
else
{
info.clearActiveBufferRegion();
stopped = true;
}
lastGain = gain;
}[/code]
It only has an effect while using audio settings with buffer sizes larger than 256 samples. In these cases, the applied gain ramp is smaller than the buffer size, and the rest of the buffer is not set to zero.
Greetings
Jan