mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
sequencer time indicator
This commit is contained in:
parent
4ebecc2427
commit
e13569df93
5 changed files with 68 additions and 40 deletions
|
|
@ -10,7 +10,7 @@ pub fn draw (
|
|||
area.x = area.x + 13;
|
||||
let Rect { x, y, width, .. } = area;
|
||||
keys(buf, area, s.note_axis.1)?;
|
||||
timer(s, buf, x, y, beat);
|
||||
timer(buf, x + 6, y - 1, beat, s.steps, s.time_axis.0, s.time_axis.1);
|
||||
let height = 32.max(s.note_axis.1 - s.note_axis.0) / 2;
|
||||
if let Some(phrase) = s.phrase() {
|
||||
lanes(buf, x, y,
|
||||
|
|
@ -25,7 +25,8 @@ pub fn draw (
|
|||
}
|
||||
cursor(buf, x, y, Style::default().green().not_dim(),
|
||||
s.time_cursor,
|
||||
s.note_cursor);
|
||||
s.note_cursor
|
||||
);
|
||||
footer(s, buf, x, y, width, height);
|
||||
Ok(Rect {
|
||||
x: x - 13,
|
||||
|
|
@ -35,10 +36,9 @@ pub fn draw (
|
|||
})
|
||||
}
|
||||
|
||||
pub fn timer (s: &Sequencer, buf: &mut Buffer, x: u16, y: u16, beat: usize) {
|
||||
let (time0, time1) = s.time_axis;
|
||||
pub fn timer (buf: &mut Buffer, x: u16, y: u16, beat: usize, steps: usize, time0: u16, time1: u16) {
|
||||
for step in time0..time1 {
|
||||
buf.set_string(x + 6 + step, y - 1, &"-", if beat % s.steps == step as usize {
|
||||
buf.set_string(x + step, y, &"-", if beat % steps == step as usize {
|
||||
Style::default().yellow().bold().not_dim()
|
||||
} else {
|
||||
Style::default()
|
||||
|
|
@ -77,16 +77,16 @@ pub fn lanes (
|
|||
note1: u32,
|
||||
) {
|
||||
let bg = Style::default();
|
||||
let bw = bg.dim();
|
||||
let wh = bg.white();
|
||||
//let (time0, time1) = s.time_axis;
|
||||
//let (note0, note1) = s.note_axis;
|
||||
//let resolution = s.resolution;
|
||||
let (bw, wh) = (bg.dim(), bg.white());
|
||||
for step in time0..time1 {
|
||||
let x = x as u32 + 5 + step;
|
||||
let (a, b) = ((step + 0) * ppq / time_zoom, (step + 1) * ppq / time_zoom,);
|
||||
if step % time_zoom == 0 {
|
||||
format!("{}", step + 1).blit(buf, x as u16, y - 1, None);
|
||||
if step % 4 == 0 {
|
||||
"|".blit(buf, x as u16, y - 1, Some(Style::default().dim()));
|
||||
}
|
||||
if step % (time_zoom * 4) == 0 {
|
||||
format!("{}", step / time_zoom / 4 + 1)
|
||||
.blit(buf, x as u16, y - 1, Some(Style::default().bold().not_dim()));
|
||||
}
|
||||
let h = (note1-note0)/2;
|
||||
for k in 0..h {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue