mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wrap note end and post-add advance
This commit is contained in:
parent
35599c6cde
commit
ecbbef22b5
2 changed files with 5 additions and 2 deletions
|
|
@ -127,7 +127,8 @@ impl Handle<Tui> for PhraseEditor<Tui> {
|
|||
},
|
||||
key!(KeyCode::Char('a')) => if self.entered {
|
||||
self.put();
|
||||
self.time_axis.point = self.time_axis.point.map(|time|{time + self.note_len});
|
||||
self.time_axis.point = self.time_axis.point.map(|time|(time + self.note_len)
|
||||
% self.phrase.as_ref().map(|p|p.read().unwrap().length).unwrap_or(1));
|
||||
},
|
||||
key!(KeyCode::Char('s')) => if self.entered {
|
||||
self.put();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue