mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
move forward after appending note
This commit is contained in:
parent
57cd9644e6
commit
e4a51c80eb
1 changed files with 14 additions and 1 deletions
|
|
@ -115,6 +115,20 @@ impl Handle<Tui> for PhraseEditor<Tui> {
|
||||||
false => {},
|
false => {},
|
||||||
},
|
},
|
||||||
key!(KeyCode::Char('a')) => if self.entered {
|
key!(KeyCode::Char('a')) => if self.entered {
|
||||||
|
if let (Some(phrase), Some(time), Some(note)) = (
|
||||||
|
&self.phrase,
|
||||||
|
self.time_axis.point,
|
||||||
|
self.note_axis.point,
|
||||||
|
) {
|
||||||
|
let mut phrase = phrase.write().unwrap();
|
||||||
|
let key: u7 = u7::from((127 - note) as u8);
|
||||||
|
let vel: u7 = 100.into();
|
||||||
|
phrase.notes[time].push(MidiMessage::NoteOn { key, vel });
|
||||||
|
phrase.notes[time + self.note_len].push(MidiMessage::NoteOff { key, vel });
|
||||||
|
self.time_axis.point = Some(time + self.note_len);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
key!(KeyCode::Char('s')) => if self.entered {
|
||||||
if let (Some(phrase), Some(time), Some(note)) = (
|
if let (Some(phrase), Some(time), Some(note)) = (
|
||||||
&self.phrase,
|
&self.phrase,
|
||||||
self.time_axis.point,
|
self.time_axis.point,
|
||||||
|
|
@ -127,7 +141,6 @@ impl Handle<Tui> for PhraseEditor<Tui> {
|
||||||
phrase.notes[time + self.note_len].push(MidiMessage::NoteOff { key, vel });
|
phrase.notes[time + self.note_len].push(MidiMessage::NoteOff { key, vel });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key!(KeyCode::Char('s')) => if self.entered {},
|
|
||||||
|
|
||||||
_ => { return Ok(None) }
|
_ => { return Ok(None) }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue