1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +00:00

Piano: Add UI support for different lengths of notes

This commit is contained in:
Peter Elliott 2020-10-11 13:26:57 -06:00 committed by Andreas Kling
parent 27b990ec19
commit b82f2df4c8
3 changed files with 52 additions and 23 deletions

View file

@ -287,7 +287,7 @@ void Track::set_roll_note(int note, u32 on_sample, u32 off_sample)
sync_roll(note);
return;
}
if (it->on_sample == new_roll_note.on_sample && it->off_sample == new_roll_note.off_sample) {
if (it->on_sample <= new_roll_note.on_sample && it->off_sample >= new_roll_note.on_sample) {
if (m_time >= it->on_sample && m_time <= it->off_sample)
set_note(note, Off);
m_roll_notes[note].remove(it);
@ -301,12 +301,6 @@ void Track::set_roll_note(int note, u32 on_sample, u32 off_sample)
it = m_roll_notes[note].begin();
continue;
}
if (it->on_sample < new_roll_note.on_sample && it->off_sample >= new_roll_note.on_sample) {
if (m_time >= new_roll_note.off_sample && m_time <= it->off_sample)
set_note(note, Off);
it->off_sample = new_roll_note.on_sample - 1;
ASSERT(it->length() >= 2);
}
++it;
}