mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
scroll sequencer
This commit is contained in:
parent
47b2c5da29
commit
7f3425fe04
3 changed files with 18 additions and 7 deletions
|
|
@ -85,7 +85,11 @@ const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
2 => {
|
2 => {
|
||||||
|
if app.entered {
|
||||||
app.time_cursor = app.time_cursor.saturating_sub(1);
|
app.time_cursor = app.time_cursor.saturating_sub(1);
|
||||||
|
} else {
|
||||||
|
app.time_start = app.time_start.saturating_sub(1);
|
||||||
|
}
|
||||||
Ok(true)
|
Ok(true)
|
||||||
},
|
},
|
||||||
_ => Ok(false)
|
_ => Ok(false)
|
||||||
|
|
@ -106,7 +110,11 @@ const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
2 => {
|
2 => {
|
||||||
|
if app.entered {
|
||||||
app.time_cursor = app.time_cursor + 1;
|
app.time_cursor = app.time_cursor + 1;
|
||||||
|
} else {
|
||||||
|
app.time_start = app.time_start + 1;
|
||||||
|
}
|
||||||
Ok(true)
|
Ok(true)
|
||||||
},
|
},
|
||||||
_ => Ok(false)
|
_ => Ok(false)
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ impl Track {
|
||||||
pub fn device (&self) -> Option<&Box<dyn Device>> {
|
pub fn device (&self) -> Option<&Box<dyn Device>> {
|
||||||
self.devices.get(self.device)
|
self.devices.get(self.device)
|
||||||
}
|
}
|
||||||
|
pub fn device_mut (&mut self) -> Option<&mut Box<dyn Device>> {
|
||||||
|
self.devices.get_mut(self.device)
|
||||||
|
}
|
||||||
pub fn first_device (&self) -> Option<&Box<dyn Device>> {
|
pub fn first_device (&self) -> Option<&Box<dyn Device>> {
|
||||||
self.devices.get(0)
|
self.devices.get(0)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ mod horizontal {
|
||||||
phrase: &Phrase,
|
phrase: &Phrase,
|
||||||
ppq: usize,
|
ppq: usize,
|
||||||
time_z: usize,
|
time_z: usize,
|
||||||
_time0: usize,
|
time0: usize,
|
||||||
note0: usize,
|
note0: usize,
|
||||||
) {
|
) {
|
||||||
let Rect { x, y, width, height } = area;
|
let Rect { x, y, width, height } = area;
|
||||||
|
|
@ -142,7 +142,8 @@ mod horizontal {
|
||||||
let (bw, wh) = (bg.dim(), bg.white().not_dim());
|
let (bw, wh) = (bg.dim(), bg.white().not_dim());
|
||||||
let offset = 5;
|
let offset = 5;
|
||||||
for x in x+offset..x+width-offset {
|
for x in x+offset..x+width-offset {
|
||||||
let step = (x-offset) as usize * time_z;
|
let step = (time0 + (x-offset) as usize) * time_z;
|
||||||
|
let next_step = (time0 + (x-offset) as usize + 1) * time_z;
|
||||||
if step % ppq == 0 {
|
if step % ppq == 0 {
|
||||||
"|".blit(buf, x as u16, y, Some(Style::default().dim()));
|
"|".blit(buf, x as u16, y, Some(Style::default().dim()));
|
||||||
}
|
}
|
||||||
|
|
@ -151,13 +152,12 @@ mod horizontal {
|
||||||
format!("{}", (step/bar)+1)
|
format!("{}", (step/bar)+1)
|
||||||
.blit(buf, x as u16, y, Some(Style::default().bold().not_dim()));
|
.blit(buf, x as u16, y, Some(Style::default().bold().not_dim()));
|
||||||
}
|
}
|
||||||
let (a, b) = (step, step + time_z);
|
|
||||||
for index in 0..height-2 {
|
for index in 0..height-2 {
|
||||||
let note_a = note0 + index as usize * 2;
|
let note_a = note0 + index as usize * 2;
|
||||||
let note_b = note0 + index as usize * 2 + 1;
|
let note_b = note0 + index as usize * 2 + 1;
|
||||||
let (character, mut style) = match (
|
let (character, mut style) = match (
|
||||||
phrase.contains_note_on(u7::from_int_lossy(note_a as u8), a, b),
|
phrase.contains_note_on(u7::from_int_lossy(note_a as u8), step, next_step),
|
||||||
phrase.contains_note_on(u7::from_int_lossy(note_b as u8), a, b),
|
phrase.contains_note_on(u7::from_int_lossy(note_b as u8), step, next_step),
|
||||||
) {
|
) {
|
||||||
(true, true) => ("█", wh),
|
(true, true) => ("█", wh),
|
||||||
(false, true) => ("▀", wh),
|
(false, true) => ("▀", wh),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue