mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
big worky on sequencer and launcher
This commit is contained in:
parent
a4c3593840
commit
8a8d7b8704
14 changed files with 852 additions and 680 deletions
|
|
@ -35,16 +35,18 @@ pub fn timer (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, beat: usize) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn keys (s: &Sequencer, buf: &mut Buffer, mut area: Rect) -> Usually<Rect> {
|
||||
pub fn keys (s: &Sequencer, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
|
||||
let bw = Style::default().dim();
|
||||
let Rect { x, y, .. } = area;
|
||||
let Rect { x, y, width, height } = area;
|
||||
let (note0, note1) = s.note_axis;
|
||||
let (time0, time1) = s.time_axis;
|
||||
for i in 0..32.max(note1-note0)/2 {
|
||||
let h = 32.max(height.saturating_sub(2)*2)/2;
|
||||
for i in 0..h {
|
||||
let y = y + i;
|
||||
buf.set_string(x + 1, y, KEYS_VERTICAL[(i % 6) as usize], bw);
|
||||
buf.set_string(x + 2, y, "█", bw);
|
||||
buf.set_string(x + 5, y, &"·".repeat((time1 - time0) as usize), bw.black());
|
||||
buf.set_string(x + 5, y, &"·".repeat(width.saturating_sub(6) as usize), bw.black());
|
||||
//buf.set_string(x + 3, y, &format!("{i}"), Style::default());
|
||||
if i % 6 == 0 {
|
||||
let octave = format!("C{}", ((note1 - i) / 6) as i8 - 4);
|
||||
buf.set_string(x + 3, y, &octave, Style::default());
|
||||
|
|
@ -69,7 +71,8 @@ pub fn lanes (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, width: u16) {
|
|||
if step % s.resolution as u16 == 0 {
|
||||
buf.set_string(x + 5 + step, y - 1, &format!("{}", step + 1), Style::default());
|
||||
}
|
||||
for k in 0..(note1 - note0)/2 {
|
||||
let h = (note1 - note0)/2;
|
||||
for k in 0..h {
|
||||
let (character, style) = match (
|
||||
contains_note_on(&s.sequences[s.sequence],
|
||||
::midly::num::u7::from_int_lossy((note0 + k * 2 + 0) as u8),
|
||||
|
|
@ -84,7 +87,7 @@ pub fn lanes (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, width: u16) {
|
|||
(false, false) => ("·", bw),
|
||||
};
|
||||
//let (character, style) = ("▄", bg);
|
||||
buf.set_string(x + 5 + step, y + k, character, style);
|
||||
buf.set_string(x + 5 + step, y + h - k, character, style);
|
||||
}
|
||||
//for (_, (_, events)) in notes.range(time_start..time_end).enumerate() {
|
||||
//if events.len() > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue