This commit is contained in:
Paul Fd 2021-03-05 13:02:03 +01:00
parent 4a3c1f36e5
commit a98e909eeb
2 changed files with 7 additions and 7 deletions

View file

@ -1661,7 +1661,7 @@ uint32_t sfz::Region::trueSampleEnd(Oversampling factor) const noexcept
if (sampleEnd <= 0)
return 0;
return min(static_cast<uint32_t>(sampleEnd), loopRange.getEnd()) * static_cast<uint32_t>(factor);
return static_cast<uint32_t>(sampleEnd) * static_cast<uint32_t>(factor);
}
uint32_t sfz::Region::loopStart(Oversampling factor) const noexcept

View file

@ -987,7 +987,6 @@ void Voice::Impl::fillWithData(AudioSpan<float> buffer) noexcept
};
if (loopContinuous) {
for (unsigned i = 0; i < numSamples; ++i) {
int wrappedIndex = (*indices)[i] - loop.size * blockRestarts;
if (wrappedIndex > loop.end) {
@ -1000,9 +999,8 @@ void Voice::Impl::fillWithData(AudioSpan<float> buffer) noexcept
addPartitionIfNecessary(i, wrappedIndex, wrapped);
// Release if we reached the loop count
if (wrapped && region_->loopCount && loop_.restarts >= *region_->loopCount && !released()) {
if (wrapped && region_->loopCount && loop_.restarts >= *region_->loopCount && !released())
release(i);
}
}
} else if (loopSustain) {
unsigned i = 0;
@ -1037,19 +1035,21 @@ void Voice::Impl::fillWithData(AudioSpan<float> buffer) noexcept
}
i++;
}
} else { // One shots and loop_sustain that have ended
} else { // One shots and loop_sustain that have released or ended
for (unsigned i = 0; i < numSamples; ++i) {
(*indices)[i] -= sampleSize_ * blockRestarts;
if ((*indices)[i] >= sampleEnd) {
if (region_->sampleCount && count_ < *region_->sampleCount) {
if (region_->sampleCount && count_ < *region_->sampleCount && !region_->shouldLoop()) {
(*indices)[i] -= sampleSize_;
blockRestarts += 1;
count_ += 1;
continue;
}
release(i);
if (!released())
release(i);
fill<int>(indices->subspan(i), sampleEnd);
fill<float>(coeffs->subspan(i), 1.0f);
break;