mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-21 01:24:21 +00:00
This commit is contained in:
parent
f80962c994
commit
ef00f04f2a
2 changed files with 8 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue