mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: add note to phrase
This commit is contained in:
parent
a0eef1f626
commit
2606381d8c
3 changed files with 17 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ impl Content for Arrangement<Tui> {
|
|||
ArrangementViewMode::Vertical(factor) => add(&VerticalArranger(&self, factor))
|
||||
}?;
|
||||
if self.focused {
|
||||
let commands = "[G]et [S]et [A]dd [I]nsert [D]uplicate [C]olor";
|
||||
let commands = "[G]et [S]et [A]dd [I]nsert [D]uplicate [E]dit [C]olor";
|
||||
let lower_left = Align::SW(commands.push_x(1));
|
||||
add(&lower_left)?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ impl<E: Engine> PhrasePool<E> {
|
|||
phrase.name = String::from(name.unwrap_or("(no name)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.length = 4 * PPQ;
|
||||
phrase.notes = vec![Vec::with_capacity(16);phrase.length];
|
||||
self.phrases.push(Arc::new(RwLock::new(phrase)));
|
||||
self.phrase = self.phrases.len() - 1;
|
||||
}
|
||||
|
|
@ -181,6 +182,7 @@ impl<E: Engine> PhrasePool<E> {
|
|||
phrase.name = String::from(name.unwrap_or("(no name)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.length = 4 * PPQ;
|
||||
phrase.notes = vec![Vec::with_capacity(16);phrase.length];
|
||||
self.phrases.insert(self.phrase + 1, Arc::new(RwLock::new(phrase)));
|
||||
self.phrase += 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,20 @@ impl Handle<Tui> for PhraseEditor<Tui> {
|
|||
true => {},
|
||||
false => {},
|
||||
},
|
||||
key!(KeyCode::Char('a')) => if self.entered {},
|
||||
key!(KeyCode::Char('i')) => 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 });
|
||||
}
|
||||
},
|
||||
key!(KeyCode::Char('s')) => if self.entered {},
|
||||
|
||||
_ => { return Ok(None) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue