summaryrefslogtreecommitdiffstats
path: root/src/engine/readaheadmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/readaheadmanager.cpp')
-rw-r--r--src/engine/readaheadmanager.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/engine/readaheadmanager.cpp b/src/engine/readaheadmanager.cpp
index fb1908c66d..264196a34d 100644
--- a/src/engine/readaheadmanager.cpp
+++ b/src/engine/readaheadmanager.cpp
@@ -80,7 +80,7 @@ SINT ReadAheadManager::getNextSamples(double dRate, CSAMPLE* pOutput,
}
// Sanity checks.
- if (samples_from_reader < 0) {
+ VERIFY_OR_DEBUG_ASSERT(samples_from_reader >= 0) {
qDebug() << "Need negative samples in ReadAheadManager::getNextSamples. Ignoring read";
return 0;
}
@@ -98,8 +98,8 @@ SINT ReadAheadManager::getNextSamples(double dRate, CSAMPLE* pOutput,
m_cacheMissHappened = true;
} else if (m_cacheMissHappened) {
// Previous read was a cache miss, but now we got something back.
- // Apply ramping gain, because the last buffer has unwanted silenced
- // and new without fading are causing a pop.
+ // Apply ramping gain, because the last buffer has unwanted silence
+ // and new samples without fading are causing a pop.
SampleUtil::applyRampingGain(pOutput, 0.0, 1.0, samples_from_reader);
// Reset the cache miss flag, because we are now back on track.
m_cacheMissHappened = false;
@@ -157,12 +157,10 @@ SINT ReadAheadManager::getNextSamples(double dRate, CSAMPLE* pOutput,
}
// do crossfade from the current buffer into the new loop beginning
- if (samples_from_reader != 0) { // avoid division by zero
- SampleUtil::linearCrossfadeBuffersOut(
- pOutput,
- m_pCrossFadeBuffer,
- samples_from_reader);
- }
+ SampleUtil::linearCrossfadeBuffersOut(
+ pOutput,
+ m_pCrossFadeBuffer,
+ samples_from_reader);
}
//qDebug() << "read" << m_currentPosition << samples_read;