Skip to content

Commit

Permalink
Use size_t in loop, and prevent notes from going before 0 ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
regulus79 committed Feb 22, 2025
1 parent 98e05f3 commit 04c0992
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2909,8 +2909,7 @@ void PianoRoll::updateStrumPos(QMouseEvent* me, bool initial, bool warp)
{
// Don't strum a chord with only one note
if (chord.size() <= 1) { continue; }
int i = 0;
for (Note* note: chord)
for (size_t i = 0; i < chord.size(); ++i)
{
float heightRatio = 1.f * i / (chord.size() - 1);
float ratio = 0.0f;
Expand All @@ -2932,8 +2931,7 @@ void PianoRoll::updateStrumPos(QMouseEvent* me, bool initial, bool warp)
{
ratio = std::pow(ratio, strumPower);
}
note->setPos(note->oldPos() + ratio * strumTicksHorizontal);
i++;
chord.at(i)->setPos(std::max(0, static_cast<tick_t>(chord.at(i)->oldPos() + ratio * strumTicksHorizontal)));
}
}
m_midiClip->rearrangeAllNotes();
Expand Down

0 comments on commit 04c0992

Please sign in to comment.