Skip to content

Commit

Permalink
Merge pull request sfztools#618 from dwuertz/fix-region-end
Browse files Browse the repository at this point in the history
Respect region end opcode
  • Loading branch information
jpcima authored Feb 2, 2021
2 parents 82899ed + c793af2 commit fec97ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sfizz/Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fec97ff

Please sign in to comment.