wrap note end and post-add advance

This commit is contained in:
🪞👃🪞 2024-10-23 20:50:26 +03:00
parent 35599c6cde
commit ecbbef22b5
2 changed files with 5 additions and 2 deletions

View file

@ -165,8 +165,10 @@ impl<E: Engine> PhraseEditor<E> {
let mut phrase = phrase.write().unwrap();
let key: u7 = u7::from((127 - note) as u8);
let vel: u7 = 100.into();
let start = time;
let end = (start + self.note_len) % phrase.length;
phrase.notes[time].push(MidiMessage::NoteOn { key, vel });
phrase.notes[time + self.note_len].push(MidiMessage::NoteOff { key, vel });
phrase.notes[end].push(MidiMessage::NoteOff { key, vel });
self.buffer = Self::redraw(&phrase);
}
}