Skip to content

Commit 985b121

Browse files
authored
Merge pull request #13294 from daschuer/loop_leadin_fade
Fix clicks at loop-out when looping into lead-in
2 parents cd2eb24 + 6e8681d commit 985b121

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/engine/readaheadmanager.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ SINT ReadAheadManager::getNextSamples(double dRate, CSAMPLE* pOutput,
9898
// Previous read was a cache miss, but now we got something back.
9999
// Apply ramping gain, because the last buffer has unwanted silence
100100
// and new samples without fading are causing a pop.
101-
SampleUtil::applyRampingGain(pOutput, 0.0, 1.0, samples_from_reader);
101+
SampleUtil::applyRampingGain(pOutput,
102+
CSAMPLE_GAIN_ZERO,
103+
CSAMPLE_GAIN_ONE,
104+
samples_from_reader);
102105
// Reset the cache miss flag, because we are now back on track.
103106
m_cacheMissHappened = false;
104107
}
@@ -186,6 +189,12 @@ SINT ReadAheadManager::getNextSamples(double dRate, CSAMPLE* pOutput,
186189
m_pCrossFadeBuffer,
187190
crossFadeSamples);
188191
}
192+
} else {
193+
// No samples for crossfading, ramp to zero
194+
SampleUtil::applyRampingGain(pOutput,
195+
CSAMPLE_GAIN_ONE,
196+
CSAMPLE_GAIN_ZERO,
197+
samples_from_reader);
189198
}
190199
}
191200

0 commit comments

Comments
 (0)