Skip to content

Commit 6ac0c22

Browse files
committed
analyzersilence.cpp cf regression pull 13545
Adjust lasttSampleBeforeFadeOut (and avoid a regression with lastSoundSample) to bring it into line with mixxxdj#13545 (I assume I was working off an older code base.)
1 parent 2129011 commit 6ac0c22

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/analyzer/analyzersilence.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ SINT AnalyzerSilence::findFirstFadeOutChunk(std::span<const CSAMPLE> samples) {
119119
kFadeOutThreshold),
120120
samples.rend()) -
121121
1;
122-
// if we don't find it (track only partially loaded - and/or pathological)
123-
// give us the track size.
124-
if (ret == -1) {
125-
ret = samples.size();
126-
}
127122
return ret;
128123
}
129124

@@ -159,14 +154,14 @@ bool AnalyzerSilence::processSamples(const CSAMPLE* pIn, SINT count) {
159154
}
160155
if (m_fadeThresholdFadeInEnd >= 0) {
161156
const SINT lasttSampleBeforeFadeOut = findFirstFadeOutChunk(samples);
162-
if (lasttSampleBeforeFadeOut < (count - 1)) {
157+
if (lasttSampleBeforeFadeOut >= 0) {
163158
m_fadeThresholdFadeOutStart = m_framesProcessed +
164159
(lasttSampleBeforeFadeOut / m_channelCount) + 1;
165160
}
166161
}
167162
if (m_fadeThresholdFadeOutStart >= 0) {
168163
const SINT lastSoundSample = findLastSoundInChunk(samples);
169-
if (lastSoundSample < (count - 1)) { // not only sound or silence
164+
if (lastSoundSample >= 0) {
170165
m_signalEnd = m_framesProcessed + (lastSoundSample / m_channelCount) + 1;
171166
}
172167
}

0 commit comments

Comments
 (0)