Skip to content

Commit

Permalink
Use std::min to calculate startFrame
Browse files Browse the repository at this point in the history
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
  • Loading branch information
sakertooth and DomClark committed Jul 6, 2024
1 parent 815851a commit d32e752
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Instrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void Instrument::applyRelease( SampleFrame* buf, const NotePlayHandle * _n )
const auto releaseFrames = desiredReleaseFrames();

const auto endFrame = _n->framesLeft();
const auto startFrame = std::max(0, static_cast<int>(endFrame) - static_cast<int>(releaseFrames));
const auto startFrame = endFrame - std::min(endFrame, releaseFrames);

for (auto f = startFrame; f < endFrame && f < fpp; f++)
{
Expand Down

0 comments on commit d32e752

Please sign in to comment.