Respect region end opcode

This commit is contained in:
Dominique Würtz 2021-02-02 08:35:08 +01:00 committed by Jean Pierre Cimalando
parent 00f2e7e261
commit c793af2e01

View file

@ -950,9 +950,11 @@ void Voice::Impl::fillWithData(AudioSpan<float> buffer) noexcept
else {
// cut short the voice at the instant of reaching end of sample
const auto sampleEnd = min(
static_cast<int>(currentPromise_->information.end),
static_cast<int>(source.getNumFrames())
) - 1;
int(region_->trueSampleEnd(resources_.filePool.getOversamplingFactor())),
int(currentPromise_->information.end),
int(source.getNumFrames()))
- 1;
for (unsigned i = 0; i < numSamples; ++i) {
if ((*indices)[i] >= sampleEnd) {
#ifndef NDEBUG