Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
ef00f04f2a
2 changed files with 8 additions and 16 deletions
  1. +7
    -15
      src/juce_appframework/audio/audio_sources/juce_AudioTransportSource.cpp
  2. +1
    -1
      src/juce_appframework/audio/audio_sources/juce_AudioTransportSource.h

+ 7
- 15
src/juce_appframework/audio/audio_sources/juce_AudioTransportSource.cpp View File

@@ -50,7 +50,6 @@ AudioTransportSource::AudioTransportSource()
stopped (true),
sampleRate (44100.0),
sourceSampleRate (0.0),
speed (1.0),
blockSize (128),
readAheadBufferSize (0),
isPrepared (false),
@@ -71,20 +70,10 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource,
{
if (source == newSource)
{
if (source == 0
|| (readAheadBufferSize_ == readAheadBufferSize
&& sourceSampleRate == sourceSampleRateToCorrectFor))
{
deleteAndZero (resamplerSource);
deleteAndZero (bufferingSource);
masterSource = 0;
positionableSource = 0;
if (source == 0)
return;
}
else
{
setSource (0, 0, 0); // deselect and reselect to avoid releasing resources wrongly
}
setSource (0, 0, 0); // deselect and reselect to avoid releasing resources wrongly
}
readAheadBufferSize = readAheadBufferSize_;
@@ -281,7 +270,10 @@ void AudioTransportSource::getNextAudioBlock (const AudioSourceChannelInfo& info
{
// 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);
info.buffer->applyGainRamp (i, info.startSample, jmin (256, info.numSamples), 1.0f, 0.0f);
if (info.numSamples > 256)
info.buffer->clear (info.startSample + 256, info.numSamples - 256);
}
if (positionableSource->getNextReadPosition() > positionableSource->getTotalLength() + 1


+ 1
- 1
src/juce_appframework/audio/audio_sources/juce_AudioTransportSource.h View File

@@ -175,7 +175,7 @@ private:
CriticalSection callbackLock;
float volatile gain, lastGain;
bool volatile playing, stopped;
double sampleRate, sourceSampleRate, speed;
double sampleRate, sourceSampleRate;
int blockSize, readAheadBufferSize;
bool isPrepared, inputStreamEOF;


Loading…
Cancel
Save