From 054cbc73218db1ad4b79b441b53a3e8637b7ef22 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 20:50:56 +0000 Subject: [PATCH] JIANT 0.9.9-seq2: every SEQ page the same piano roll, with the keys at its left and a line a playhead (the approved mock-up's slice 3; v0.9.9-seq2b) All ten pages of SEQ's chain draw one picture (ported from 0.9.17's "every page the same piano roll": seq_roll_view, lens_strip on every SEQ page, seq_col, seq_overlay): the bars' strip and the cursor bar's roll (a kit: the grid), the page's knobs its own. New, as the mock-up's R1 .. R3: the keys at the roll's left (x 7 .. 19, white MID, black BG, the root a THEME tooth; the cursor's step's notes TEXT, the note each playhead sounds its colour, the keys held / the step being entered ACCENT); the roll x 22 .. 230, 13 px a step; every playhead a line (the sequencer's ACCENT at its column's left, FUGUE's heads 2 .. 4 the knobs' colours inside theirs). The pages' marks over it: COMP the steps with the component, AUTOMATION / AUTO LIST the records at the foot, MUTATE the next mutation's chip, TRACK the PITCH ghosts. Gone: graph_bars, graph_bigstep, graph_fugue, graph_mutate, graph_events. AUTOMATION's lane under the roll is left for slice 9 (TODO). Redrawn by the signature only: a playhead's step, the pattern, the cursor, the keys held (AUTOMATION no longer a frame at a time). Image 570092 -> 566284 B; RAM .data+.bss 88324 B unchanged. ui_test (the keys, the held step's note, a line a playhead, a redraw a step, every page's roll), editor_test, regress (157 goldens unchanged) pass. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh --- firmware/src/felucca.c | 2 +- firmware/src/ui_graph.c | 535 +++++++++++++++------------------------- tests/ui_test.c | 88 ++++++- 3 files changed, 276 insertions(+), 349 deletions(-) diff --git a/firmware/src/felucca.c b/firmware/src/felucca.c index b301aa47..6ed3180e 100644 --- a/firmware/src/felucca.c +++ b/firmware/src/felucca.c @@ -38,7 +38,7 @@ #define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */ #endif #ifndef FELUCCA_VERSION -#define FELUCCA_VERSION "v0.9.9-seq2a" /* the sequencer redesign's first slices (the footer's bars, SEQ's chain), on beta4a */ +#define FELUCCA_VERSION "v0.9.9-seq2b" /* the sequencer redesign: the footer's bars, SEQ's chain, one roll on every SEQ page, on beta4a */ #endif #if FELUCCA_OTA && !FELUCCA_FLASH #error "FELUCCA_OTA needs FELUCCA_FLASH" diff --git a/firmware/src/ui_graph.c b/firmware/src/ui_graph.c index 2d890912..b7d90e51 100644 --- a/firmware/src/ui_graph.c +++ b/firmware/src/ui_graph.c @@ -85,14 +85,6 @@ static uint16_t heat_y(int32_t y, int32_t y0, int32_t y1, uint16_t c) { return settings.palette == UI_JIANT_INDEX && y1 > y0 ? heat_col(24 + (y1 - y) * 232 / (y1 - y0)) : c; } -/* JIANT: a hit or note as hot as it plays (velocity x chance; an accent white hot); else ACCENT or c */ -static uint16_t step_heat(const step_t *st, int acc, uint16_t c) -{ - int32_t v = (st->vel ? st->vel : 100) * (int32_t)step_chance(st) / 100; - if (settings.palette != UI_JIANT_INDEX) - return acc ? T_ACCENT : c; - return heat_col(acc ? 236 : 40 + v * 160 / 127); -} #include "ui_being.c" /* (JIANT 0.5) the beings: the engine pages' creatures */ #include "ui_engvis.c" /* (0.9.4) VOICE's head, ANIMAL's creature, DRUM-X's kit */ @@ -173,38 +165,6 @@ static void graph_lfo(const track_t *t, uint16_t c) } -/* (0.6.43) SEQ > MUTATE: a row a track, the next 32 bars: SOUND's changes an orange mark on top, PATTERN's a violet one - * under it; the bar now ACCENT; the selected track's row lit; ORBIT / DRIFT at the right; FROZEN over it all */ -/* (0.6.92) the selected track's next 32 bars: a mark where its SOUND changes (warm) and where its PATTERN does (cool), - * the bar now at the left; under it what it does (every project's steps written; ORBIT around the anchor OCT+ keeps, - * DRIFT on and on) and the two hands */ -static void graph_mutate(void) -{ - const track_t *t = TSEL; - uint32_t b, now = song.playing ? bar_n : 0u, k = song.sel; - uint32_t s = MUT_BARS[(uint32_t)clamp(t->p[P_MSND], 0, 6)], q = MUT_BARS[(uint32_t)clamp(t->p[P_MPAT], 0, 6)]; - int on = (s || q) && k < trk_live; - char nm[12] = "TRACK 1"; - nm[6] = (char)('1' + k); - cv_text(PANEL_X0, 4, &AF_S, nm, T_THEME); - cv_text_r(PANEL_X0 + PANEL_W, 4, &AF_S, !on ? "MUTATE OFF" : t->p[P_MMODE] ? "DRIFT: ON AND ON" : "ORBIT: AROUND THE ANCHOR", - on ? T_TEXT : T_DIM, T_SURF); - cv_text(PANEL_X0, 24, &AF_S, "SOUND", on && s ? heat_col(190) : T_DIM); - cv_text(PANEL_X0, 44, &AF_S, "PATTERN", on && q ? heat_col(90) : T_DIM); - for (b = 0; b < 32u; b++) { - uint32_t bar = now + 1u + b; - int32_t x = PANEL_X0 + 52 + (int32_t)b * 5; - cv_rect(x, 31, 4, 1, T_RAISE); - cv_rect(x, 51, 4, 1, T_RAISE); - if (on && s && bar % s == 0u) cv_rect(x, 24, 4, 8, mut_freeze ? T_DIM : heat_col(190)); - if (on && q && bar % q == 0u) cv_rect(x, 44, 4, 8, mut_freeze ? T_DIM : heat_col(90)); - } - cv_rect(PANEL_X0 + 52, 20, 4, 36, ux_mix(T_SURF, T_ACCENT, 25)); /* (the next bar's column) */ - cv_text(PANEL_X0, 68, &AF_S, "EVERY N BARS, BY AMOUNT, ON THE BAR", T_MID); - cv_text(PANEL_X0, 84, &AF_S, mut_freeze ? "FROZEN [OCT-] GOES ON" : "OCT+ KEEP GLO+A4 FREEZE", mut_freeze ? T_ACCENT : T_DIM); - cv_text(PANEL_X0, 100, &AF_S, mut_back_ok() ? "SEQ+D5 REVERT GLO+B4 ALL" : "REVERT: NO ANCHOR", T_DIM); /* (0.9.3) */ -} - /* (0.6.45) EDIT > MORPH: a cycle of the wave as it morphs (from WAVE towards the next ones), heat coloured by its * height; under it the two waves it is between */ /* (0.6.48) EDIT > IMAGE (a DRUM track): the eight sounds from left to right as IMAGE places them (as wide as DRV, @@ -366,7 +326,7 @@ static void graph_morph(const track_t *t) } /* (0.8.5) the piano roll of the cursor's bar, as the approved mock-up (LENTE's BAR, under the bars' strip): its 16 - * steps as columns over the panel's width (x 4 .. 236, 14 or 15 px), PR_ROWS semitone rows of PR_RH px (4), the + * steps as columns (0.9.9-seq2b: x 22 .. 230, 13 px, the keys at the left; was 4 .. 236), PR_ROWS semitone rows of PR_RH px (4), the * highest on top, on a BG area; rows in the track's scale (SCL ROOT / SCALE; CHR: the white keys) tinted LANE; step * lines GRID, every 4th LINE. A note is a bar in its column, a px in from either side, PR_RH - 1 tall, as hot as it * plays (an accent: the highlight; another palette: notes ACCENT, accents TEXT); chords stacked; lane hits as their @@ -381,8 +341,13 @@ static void graph_morph(const track_t *t) #define PR_ROWS ((int32_t)proll.rows) /* semitones shown: 30 (2.5 octaves) */ #define PR_RH 4 /* px per row */ #define PR_Y0 ((int32_t)proll.y0) /* the top row (canvas y): 20, under the bars' strip */ -#define PR_RX 4 /* the roll: x 4 .. 236 */ -#define PR_RW 232 +#define PR_RX 22 /* (0.9.9-seq2b) the roll: x 22 .. 230, 13 px a step; the keys at its left */ +#define PR_RW 208 +#define PR_KX 7 /* .. the keys: x 7 .. 19, a row a key (white MID, black BG), the */ +#define PR_KW 13 /* track's root a THEME tooth at x 4 .. 5 */ +#define PR_SX 4 /* the bars' strip over it: the panel's width, 4 .. 236 */ +#define PR_SW 232 +#define PR_MAXR 64 /* (rows lit on the keys: at most) */ #define PR_CX(i) (PR_RX + (int32_t)(i) * PR_RW / 16) /* column i's left */ #define PR_CWI(i) (PR_CX((i) + 1) - PR_CX(i)) /* .. its width */ static struct { @@ -563,10 +528,12 @@ static void bar_cells(const track_t *t, int32_t x0, int32_t w, int32_t y, int32_ for (b = 0; b < 4u; b++) bar_cell(t, b, x0 + (int32_t)b * bw + 1, y, bw - 2, h, lo, hi, c); } -/* (0.8.5) BAR's strip over the roll and the grid (lens_strip): the bars small, 16 px at the panel's top */ +/* (0.8.5) BAR's strip over the roll and the grid (lens_strip; 0.9.9-seq2b, as 0.9.17: every SEQ page's): the bars small, + * 16 px at the panel's top */ #define LS_Y 0 #define LS_H 16 -static int lens_strip(void) { return !ui.home && lz_on() && lens_level() == LV_BAR; } +static int seq_roll_view(const page_t *pg); +static int lens_strip(void) { return !ui.home && lz_on() && !ui.layer && seq_roll_view(cur_page()); } /* the bars of step s in column x (in its RATCH parts, hits; a TIE's carried bars: 1): a 1 px edge mark for a note * out of view; first: row y of the step's first note; fc: the note in focus's colour (0: none) and its note */ @@ -591,6 +558,74 @@ static void pr_bars(const step_t *st, int32_t x, int32_t w, uint16_t c, int acc_ pr_split(x, y, w, PR_RH - 1, c ? c : lz_note(st, acc, ACC), hits); } } +/* (0.9.9-seq2b, the approved mock-up's R1 .. R3) the playheads' colours: the sequencer's ACCENT, FUGUE's heads 2 .. 4 the + * knobs' colours 1, 2 and 4 (the palette's own: GREY grey, MONO white) */ +static uint16_t pr_head_col(uint32_t k) { return k ? T_K(k == 3u ? 3u : k - 1u) : T_ACCENT; } +/* the step a head is on (0: the sequencer's, 1 .. 3 FUGUE's; NSTEP: none, stopped or the head off) */ +static uint32_t pr_head_step(const track_t *t, uint32_t k) +{ + uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), ti = song.sel % NTRK, i; + if (!song.playing) + return NSTEP; + if (!k) + return seq_src(t, t->seq_idx); + i = fg_head[ti][k - 1u].idx; + return fg_set[ti][k - 1u].rate && i < len ? seq_src(t, i) : NSTEP; +} +/* the keys lit: the rows of the notes step si sounds (a TIE's: the note before's), moved ivl degrees (FUGUE's INTERVAL) */ +static void pr_lit(const track_t *t, uint32_t si, int32_t ivl, uint16_t c, uint16_t *lit) +{ + uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), s, j; + if (si >= len || (s = pr_src(t, si, len)) == NSTEP) + return; + for (j = 0; j < seq_steps(t)[s].n && j < 4u; j++) { + int32_t n = seq_steps(t)[s].note[j], r; + if (ivl) + n = scale_steps(t, n, ivl); + r = (int32_t)proll.lo + PR_ROWS - 1 - n; + if (r >= 0 && r < PR_ROWS && r < PR_MAXR) + lit[r] = c; + } +} +static const uint8_t PR_KB[12] = {0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0}; /* (a black key) */ +/* the keys at the roll's left, a row a key: white MID, black BG, the track's root a THEME tooth; lit: the cursor's step's + * notes TEXT, the notes each playhead sounds its colour, the keys held (the step being entered) ACCENT */ +static void pr_keys(const track_t *t, uint32_t held) +{ + uint16_t lit[PR_MAXR]; + uint32_t k, ti = song.sel % NTRK; + int32_t r; + for (r = 0; r < PR_MAXR; r++) + lit[r] = 0; + pr_lit(t, ui.cursor, 0, T_TEXT, lit); + for (k = FG_HEADS + 1u; k-- > 0u;) + pr_lit(t, pr_head_step(t, k), k ? fg_set[ti][k - 1u].ivl : 0, pr_head_col(k), lit); + for (r = 0; r < PR_ROWS && r < PR_MAXR; r++) { + int32_t n = (int32_t)proll.lo + PR_ROWS - 1 - r, y = PR_Y0 + r * PR_RH; + uint16_t kc = (held >> r) & 1u ? T_ACCENT : lit[r] ? lit[r] : PR_KB[n % 12] ? T_BG : T_MID; + cv_rect(PR_KX, y, PR_KW, PR_RH - 1, kc); + if ((n - t->p[P_ROOT] + 120) % 12 == 0) + cv_rect(PR_KX - 3, y, 2, PR_RH - 1, T_THEME); + } +} +/* the playheads as lines down the bar shown, a step at a time: the sequencer's 1 px ACCENT at its column's left (as + * before), FUGUE's heads 2 .. 4 in their colours a quarter, a half, three quarters into theirs (PLAYHEADS: the head edited + * 2 px); dr: the DRUM grid's columns */ +static void seq_col(uint32_t dr, uint32_t i, int32_t *x, int32_t *w); +static void pr_heads(const track_t *t, int32_t top, int32_t bot, uint32_t dr) +{ + uint32_t k; + for (k = dr ? 1u : 0u; k <= FG_HEADS; k++) { /* (the grid: its own bar over the sequencer's step) */ + uint32_t s = pr_head_step(t, k); + int32_t x, w; + if (s >= NSTEP || s / 16u != ui.bank) + continue; + seq_col(dr, s % 16u, &x, &w); + if (k) + x += (w + 1) * (int32_t)k / 4; + cv_rect(x, top, k && cur_page()->graph == GR_FUGUE && k - 1u == fg_ui % FG_HEADS ? 2 : 1, bot - top, pr_head_col(k)); + } +} static void graph_roll(const track_t *t, uint16_t c) { uint32_t i, len = (uint32_t)t->p[P_SLEN], base = ui.bank * 16u, ncol, mask = scale_mask(t), held = pr_held(); @@ -607,10 +642,10 @@ static void graph_roll(const track_t *t, uint16_t c) trw = text_w(&AF_S, tb) + 6; } if (lens_strip()) { /* LENTE's BAR: the bars over the roll (ALL TR after them) */ - bar_cells(t, PR_RX, PR_RW - trw, LS_Y, LS_H, ACC); + bar_cells(t, PR_SX, PR_SW - trw, LS_Y, LS_H, ACC); if (trw) { GFX_HOOK_ALIGN(0, LS_Y, 0, LS_Y + LS_H, AL_V, "ALL TR on the bars' line"); - cv_text_r(PR_RX + PR_RW, LS_Y + CAP_IN(S, LS_H), &AF_S, tb, T_ACCENT, T_SURF); + cv_text_r(PR_SX + PR_SW, LS_Y + CAP_IN(S, LS_H), &AF_S, tb, T_ACCENT, T_SURF); } } ncol = base < len ? (len - base < 16u ? len - base : 16u) : 0u; @@ -618,8 +653,7 @@ static void graph_roll(const track_t *t, uint16_t c) for (r = 0; r < PR_ROWS; r++) { /* rows: the scale's tinted */ int32_t n = (int32_t)proll.lo + PR_ROWS - 1 - r, y = PR_Y0 + r * PR_RH; uint32_t pc = (uint32_t)n % 12u; - static const uint8_t KB[12] = {0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0}; - int in = mask == 0xFFFu ? !KB[pc] : (int)((mask >> ((uint32_t)(n - t->p[P_ROOT] + 120) % 12u)) & 1u); + int in = mask == 0xFFFu ? !PR_KB[pc] : (int)((mask >> ((uint32_t)(n - t->p[P_ROOT] + 120) % 12u)) & 1u); if (in && !ux.skin) /* ((0.8.9) BOTTOM, HUD: no rows, the beats only) */ cv_rect(PR_RX, y, PR_CX(ncol) - PR_RX, PR_RH, T_LANE); } @@ -628,9 +662,8 @@ static void graph_roll(const track_t *t, uint16_t c) cv_rect(PR_CX(i), PR_Y0, 1, ybot - PR_Y0, i % 4u ? T_GRID : T_LINE); if (ncol < 16u) /* past LEN: dark */ cv_rect(PR_CX(ncol), PR_Y0, PR_RX + PR_RW - PR_CX(ncol), ybot - PR_Y0, T_BG); - for (r = 0; r < PR_ROWS; r++) /* the keys held: their rows marked at the left */ - if ((held >> r) & 1u) - cv_rect(PR_RX, PR_Y0 + r * PR_RH, 2, PR_RH - 1, T_ACCENT); + pr_keys(t, held); /* (0.9.9-seq2b) the keys at the left (was: a key held, its row + * marked at the roll's left) */ for (i = 0; i < ncol; i++) { /* the notes */ uint32_t si = base + i, s = pr_src(t, si, len), nx = (si + 1u) % len; const step_t *st, *ns = &seq_steps(t)[nx]; @@ -661,14 +694,13 @@ static void graph_roll(const track_t *t, uint16_t c) for (i = 0; i < ncol; i++) { uint32_t si = base + i; int32_t x = PR_CX(i); - if (song.playing && si == seq_src(t, t->seq_idx)) - cv_rect(x, PR_Y0, 1, ybot - PR_Y0, T_ACCENT); if ((locks >> si) & 1u) /* a parameter lock: a mark at the column's foot */ cv_rect(x + 3, ybot - 3, PR_CWI(i) - 6, 2, T_ACCENT); if (si == ui.cursor) /* the cursor: a frame round its column (0.8.9, the skins' mock-up: * TEXT) */ cv_frame(x, PR_Y0, PR_CWI(i) + 1, ybot - PR_Y0, T_TEXT); } + pr_heads(t, PR_Y0, ybot, 0); if (ui.entry_open && !ui.ent_arp && ui.ent_nn && ui.ent_len > 1u) { /* (0.6.81) a chord held, KNOB 1 its length: * the length to be written, outlined from the cursor on */ uint32_t k, j; @@ -697,7 +729,7 @@ static void graph_grid(const track_t *t, uint16_t c) int s = lens_strip(); int32_t y0 = s ? 19 : 6, lp = s ? 15 : 14, hy = 2; /* (a lane's pitch; its hits' row in it) */ if (s) - bar_cells(t, PR_RX, PR_RW, LS_Y, LS_H, c); + bar_cells(t, PR_SX, PR_SW, LS_Y, LS_H, c); for (i = 0; i < 16u && base + i < len; i++) /* a parameter lock: a mark over the step (under the bars: under it) */ if ((locks >> (base + i)) & 1u) cv_rect(41 + (int32_t)i * 12, s ? y0 + 4 + 8 * lp - 1 : 1, 8, 2, T_ACCENT); @@ -1017,226 +1049,98 @@ static void graph_title(void) cv_text_in(0, y, 240, f, ti, T_THEME, T_SURF); } -/* (0.6.52) SEQ > FUGUE: the steps (their notes as heat) with the sequencer's playhead, then a lane each for heads 2..4: - * where it is, its RATE DIR INTERVAL; the head edited lit */ -/* (0.8.2) the pages that edit the piano roll kept it in the panel. (0.8.3) LENTE (ui.c lens_*): the panel is the - * level's: the roll (a kit: the grid) on BAR's STEP and NOTE; the bars on PATTERN's PATTERN, STRETCH and TRACK - * (graph_bars); the cursor step large on STEP's NOTE, COMP and COMP 2 (graph_bigstep); PLAYHEADS, MUTATE, AUTOMATION - * and AUTO LIST keep their own graphs */ + +/* (0.9.9-seq2b, the approved mock-up's chapter 1; ported from 0.9.17's commit "every page the same piano roll") every SEQ + * page draws the same picture: the bars' strip and the roll of the cursor's bar with the keys at its left and every + * playhead (a kit: the grid), then the page's own marks over it (seq_overlay); its knobs stay the page's. (0.8.3 .. + * 0.9.9-seq2a: PATTERN STRETCH TRACK the big bars, COMP the step large, PLAYHEADS MUTATE AUTO LIST their own panels.) + * PHRASES and SONG keep their lists. TODO (the mock-up's slice 9): AUTOMATION's lane under a shorter roll (lane2), a value + * a step, once motion.c keeps one; till then its records as marks at the roll's foot */ +static int seq_roll_view(const page_t *pg) +{ + return pg == &PAGES[ui.page] && lens_on() && pg->graph != GR_PATS && pg->graph != GR_SONG; +} static int roll_view(const page_t *pg) { - return pg->fam == FAM_SEQ && pg->graph == GR_ROLL && !(pg == &PAGES[ui.page] && lens_on() && lens_level() == LV_STEP); + return pg->fam == FAM_SEQ && pg->graph == GR_ROLL; } -static int bars_view(const page_t *pg) /* (0.8.3) LENTE's PATTERN level: the bars */ +static void seq_col(uint32_t dr, uint32_t i, int32_t *x, int32_t *w) { - return pg == &PAGES[ui.page] && lens_on() && lens_level() == LV_PAT && (pg->graph == GR_STEPS || pg->graph == GR_SHAPE); + *x = dr ? 40 + (int32_t)i * 12 : PR_CX(i); + *w = dr ? 10 : PR_CWI(i); } -static int bigstep_view(const page_t *pg) /* .. its STEP level: the step large */ +/* MUTATE's chip: when the next mutation comes (or OFF, FROZEN) */ +static void mut_chip(const track_t *t, char *m) { - return pg == &PAGES[ui.page] && lens_on() && lens_level() == LV_STEP && (pg->graph == GR_ROLL || pg->graph == GR_COMP); -} -/* (0.8.3) LENTE's PATTERN; (0.8.5) as the mock-up: the pattern's bars side by side (up to four, LEN 64) as big cells - * (2 .. 62); under them PLAYHEADS (S, DIM) and the whole pattern as one small roll (80 .. 140, a BG area: the scale's - * rows LANE, the step lines GRID and every 4th LINE, the notes as hot as they play, held through their TIEs, a - * component's mark on top, past LEN dark) with the sequencer's playhead (ACCENT) and FUGUE's heads (a tick each at the - * foot, as hot as its lane on the PLAYHEADS page) */ -#define LB_Y 2 -#define LB_H 60 -#define LP_TY 65 /* "PLAYHEADS" (capitals 68..76) */ -#define LP_Y 80 /* the pattern's roll, to 140 */ -#define LP_H 60 -static void graph_bars(const track_t *t, uint16_t c) -{ - uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), n = len < 16u ? 16u : len, i, j, k, l, dr = drum_track(t); - uint32_t ph = song.playing ? seq_src(t, t->seq_idx) : 0xFFFFu, ti = song.sel % NTRK, mask = scale_mask(t); - int32_t lo, hi, rows, rh = 2; - bar_cells(t, PR_RX, PR_RW, LB_Y, LB_H, c); - GFX_HOOK_ALIGN(0, LP_TY + 3 + AF_X_CAP_Y, 0, LP_TY + 3 + AF_X_CAP_Y + AF_X_CAP_H, AL_V | AL_PASS, "PLAYHEADS title"); - cv_text(6, LP_TY + 3, &AF_X, "PLAYHEADS", T_DIM); - pat_range(t, &lo, &hi); - rows = LP_H / rh; - if (hi - lo + 1 < rows) - lo -= (rows - (hi - lo + 1)) / 2; - hi = lo + rows - 1; - cv_rect(PR_RX, LP_Y, PR_RW, LP_H, T_BG); - if (!dr) - for (k = 0; k < (uint32_t)rows; k++) { /* the scale's rows */ - int32_t nn = hi - (int32_t)k; - static const uint8_t KB[12] = {0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0}; - int in = mask == 0xFFFu ? !KB[(uint32_t)(nn + 120) % 12u] : (int)((mask >> ((uint32_t)(nn - t->p[P_ROOT] + 120) % 12u)) & 1u); - if (in) - cv_rect(PR_RX, LP_Y + (int32_t)k * rh, PR_RW, rh, T_LANE); - } - for (i = 0; i <= n; i++) /* the step lines, the beats brighter */ - cv_rect(PR_RX + (int32_t)(i * PR_RW / n) - (i == n), LP_Y, 1, LP_H, i % 4u ? T_GRID : T_LINE); - if (len < n) /* past LEN: dark */ - cv_rect(PR_RX + (int32_t)(len * PR_RW / n), LP_Y, PR_RW - (int32_t)(len * PR_RW / n), LP_H, T_BG); - for (i = 0; i < len; i++) { - const step_t *st = &seq_steps(t)[i]; - int32_t x = PR_RX + (int32_t)(i * PR_RW / n), sw, L = 1; - if (!step_on(st)) - continue; - while (L < (int32_t)len - (int32_t)i && seq_steps(t)[i + (uint32_t)L].time == ST_TIE) - L++; - sw = PR_RX + (int32_t)((i + (uint32_t)L) * PR_RW / n) - x - 2; - if (sw < 1) - sw = 1; - if (dr) { - for (l = 0; l < NLANE; l++) - if ((step_lanes(st) >> l) & 1u) - cv_rect(x + 1, LP_Y + 4 + (int32_t)l * (LP_H - 8) / (int32_t)NLANE, sw, 3, - lz_note(st, (step_accents(st) >> l) & 1u, c)); - continue; - } - for (j = 0; j < st->n && j < 4u; j++) { - int32_t nn = clamp(st->note[j], lo, hi); - cv_rect(x + 1, LP_Y + (hi - nn) * rh, sw + ((st->flags & SF_SLIDE) ? 2 : 0), rh, - lz_note(st, (st->flags & SF_ACCENT) != 0u, c)); - } - lz_comp_mark(st, x + (int32_t)(PR_RW / n) / 2, LP_Y + 1); - } - if (ph < len) - cv_rect(PR_RX + (int32_t)(ph * PR_RW / n), LP_Y, 1, LP_H, T_ACCENT); - for (k = 0; k < FG_HEADS && song.playing; k++) { /* FUGUE's heads */ - uint32_t hi2 = fg_head[ti][k].idx; - if (!fg_set[ti][k].rate || hi2 >= len) - continue; - cv_rect(PR_RX + (int32_t)(hi2 * PR_RW / n + PR_RW / n / 2) - 1, LP_Y + LP_H - 6, 2, 6, heat_col(70u + k * 60u)); + uint32_t sb = MUT_BARS[(uint32_t)clamp(t->p[P_MSND], 0, 6)], qb = MUT_BARS[(uint32_t)clamp(t->p[P_MPAT], 0, 6)]; + uint32_t now = song.playing ? bar_n : 0u, b = 1u; + if (!(sb || qb) || song.sel >= trk_live) + str_cpy(m, "MUTATE OFF", 16); + else if (mut_freeze) + str_cpy(m, "FROZEN", 16); + else { + while (b < 32u && !(sb && (now + b) % sb == 0u) && !(qb && (now + b) % qb == 0u)) + b++; + str_cpy(m, "NEXT ", 16); + fmt_int(m + 5, (int32_t)b); + str_cpy(m + str_len(m), b > 1u ? " BARS" : " BAR", 6); } } -/* (0.8.3) LENTE's STEP: the cursor step large; (0.8.5) as the mock-up, on a BG area (4 .. 236): on top "STEP n" (S, - * THEME) and at the right what it is (NOTE, TIE, REST; a note longer than a step: LEN n, MID). At the left its notes as - * bars 70 px wide where their pitch puts them (2.6 px a semitone, C3 at the foot), each named at the right of it (S, - * TEXT): as hot as it plays (moved by its MICRO, in its RATCH's parts; NOTE's note in focus the accent); a TIE the notes - * it holds, MID; a REST, an empty step: said; a kit: the lanes it hits. At the right its chips (102 x 14, 17 px apart): - * ACC, SLD, MICRO n, COMP1 x, COMP2 x, CHANCE n% (a value set: TINT with TEXT; else RAISE with DIM) */ -#define BS_CX 130 /* the chips' column */ -#define BS_CW 102 -#define BS_Y 28 /* the first chip, 17 px apart */ -#define BS_TY 4 /* the title's line (capitals 7..15) */ -#define BS_NH 6 /* a note's bar */ -static void bs_chip(uint32_t k, const char *s, int on) +/* the page's marks over the roll / the grid (0.9.17's): PLAYHEADS FUGUE's heads on the grid too (the roll draws them on + * every page); COMP the steps with the cursor's component a bar on top ACCENT, another component a thin MID one; + * AUTOMATION / AUTO LIST the records at the foot (a lock ACCENT, automation TEXT; AUTO LIST the row picked framed THEME); + * MUTATE a chip, the next mutation; TRACK the notes PITCH moves them to, MID outlines */ +static void seq_overlay(const track_t *t, const page_t *pg) { - int32_t y = BS_Y + (int32_t)k * 17; - uint16_t bg = on ? T_TINT : T_RAISE, fg = on ? T_TEXT : T_DIM == T_RAISE ? T_MID : T_DIM; - cv_rect(BS_CX, y, BS_CW, 14, bg); - GFX_HOOK_ALIGN(0, y, 0, y + 14, AL_V, "big step chip text centred up/down"); - cv_text_on(BS_CX + 5, y + CAP_IN(X, 14), &AF_X, s, fg, bg); -} -static void graph_bigstep(const track_t *t, const page_t *pg, uint16_t c) -{ - static const char *const TIME_N[3] = {"NOTE", "TIE", "REST"}; - uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), i, dr = drum_track(t), nl; - uint32_t src = pr_src(t, ui.cursor % NSTEP, len); - const step_t *st = &seq_steps(t)[ui.cursor % NSTEP], *sn = src < NSTEP ? &seq_steps(t)[src] : st; - int note = pg->id[0] == 4u, tie = st->time == ST_TIE, acc; - int32_t m = ST_MICRO(st); - char b[20]; - cv_rect(PR_RX, 0, PR_RW, LZ_GRAPH_H, T_BG); - str_cpy(b, "STEP ", sizeof b); - fmt_int(b + 5, (int32_t)ui.cursor + 1); - GFX_HOOK_ALIGN(0, BS_TY + 3 + AF_X_CAP_Y, 0, BS_TY + 3 + AF_X_CAP_Y + AF_X_CAP_H, AL_V | AL_PASS, "big step title"); - cv_text_on(10, BS_TY + 3, &AF_X, b, T_THEME, T_BG); - nl = !dr && st->time == ST_NOTE && st->n ? note_len(t, ui.cursor % NSTEP, len) : 1u; /* (0.8.4) a NOTE's length: - * LEN 3 (BAR > STEP's KNOB 3 sets it) */ - str_cpy(b, nl > 1u ? "LEN " : TIME_N[st->time % 3u], sizeof b); - if (nl > 1u) fmt_int(b + 4, (int32_t)nl); - cv_text_r(230, BS_TY + 3, &AF_X, b, nl > 1u ? T_TEXT : T_MID, T_BG); - if (dr) { /* a kit: the lanes it hits (their accents hot), two columns */ - uint32_t k = 0, l; - for (l = 0; l < NLANE; l++) { - int32_t x = 14 + (int32_t)(k / 4u) * 52, y = 40 + (int32_t)(k % 4u) * 20; - if (!(((st->time == ST_NOTE ? step_lanes(st) : 0u) >> l) & 1u)) + uint32_t dr = drum_track(t), len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), base = ui.bank * 16u, i, k; + int32_t top = dr ? 19 : PR_Y0, bot = dr ? 19 + 8 * 15 - 1 : PR_Y0 + PR_ROWS * PR_RH, x, w; + if (dr) + pr_heads(t, top, bot, dr); + if (pg->graph == GR_COMP) { + uint32_t mine = comp_type(&seq_steps(t)[ui.cursor % NSTEP]); + for (i = 0; i < 16u && base + i < len; i++) { + const step_t *st = &seq_steps(t)[base + i]; + uint32_t cp = comp_type(st); + if (!cp || !step_on(st)) continue; - cv_rect(x, y, 10, 10, lz_note(st, (step_accents(st) >> l) & 1u, c)); - GFX_HOOK_ALIGN(0, y, 0, y + 10, AL_V, "big step lane on its hit"); - cv_text_on(x + 15, y + CAP_IN(X, 10), &AF_X, drum_lane_abbr(t, l), T_TEXT, T_BG); - k++; + seq_col(dr, i, &x, &w); + if (cp == mine) + cv_rect(x + 1, top - 3, w - 2, 3, T_ACCENT); + else + cv_rect(x + 2, top - 2, w - 4, 1, T_MID); } - if (!k) - cv_text_in(4, 69, 120, &AF_X, st->time == ST_NOTE ? "NO HIT" : TIME_N[st->time % 3u], T_MID, T_BG); - } else if ((tie && src < NSTEP) || (st->time == ST_NOTE && st->n)) { /* the notes where their pitch puts them */ - uint32_t n = sn->n < 4u ? sn->n : 4u, f = note && !tie && ui.pr_focus <= n ? ui.pr_focus : 0u, j; - uint8_t ord[4] = {0, 1, 2, 3}; - int32_t gy[4]; - for (i = 0; i < n; i++) /* highest first */ - for (j = i + 1u; j < n; j++) - if (sn->note[ord[j]] > sn->note[ord[i]]) { uint8_t q = ord[i]; ord[i] = ord[j]; ord[j] = q; } - for (i = 0; i < n; i++) { /* by pitch, 11 px apart at least (the names), inside 22 .. 128 */ - gy[i] = 112 - ((int32_t)sn->note[ord[i]] - 48) * 13 / 5; - if (i && gy[i] < gy[i - 1u] + 11) - gy[i] = gy[i - 1u] + 11; + } else if (pg->graph == GR_MOTION || pg->graph == GR_EVENTS) { + uint8_t idx[MOTION_MAX]; + uint32_t n = ev_rows(idx), cur = ev_row(n); + for (k = 0; k < n; k++) { + const motion_event_t *e = &motion.event[idx[k]]; + uint32_t sx = MOTION_STEP(e); + if (sx < base || sx >= base + 16u || sx >= len) + continue; + seq_col(dr, sx - base, &x, &w); + cv_rect(x + 2, bot - 3, w - 4, 2, (e->param & MOTION_LOCK) ? T_ACCENT : T_TEXT); + if (pg->graph == GR_EVENTS && k == cur) + cv_frame(x, top, w + 1, bot - top, T_THEME); } - if (n && gy[n - 1u] > 128) - for (i = 0; i < n; i++) gy[i] -= gy[n - 1u] - 128; - if (n && gy[0] < 22) - for (i = n; i-- > 0;) gy[i] += 22 - gy[0]; - for (i = 0; i < n; i++) { - int32_t y = gy[i], x = 14 + (tie ? 0 : m / 4); /* (0.9.1: MICRO in 64ths; as far as before) */ - uint16_t col = tie ? T_MID : f ? (ord[i] + 1u == f ? T_ACCENT : lz_note(sn, (sn->flags & SF_ACCENT) != 0u, c)) : - lz_note(sn, (sn->flags & SF_ACCENT) != 0u, c); - pr_split(x, y, 70, BS_NH, col, tie ? 1u : step_ratchet(sn)); - note_name(b, sn->note[ord[i]]); - GFX_HOOK_ALIGN(0, y, 0, y + BS_NH, AL_V, "big step note name on its bar"); - cv_text_on(90, y + CAP_IN(X, BS_NH), &AF_X, b, tie ? T_MID : T_TEXT, T_BG); + } else if (pg->graph == GR_MUTATE) { + char m[16]; + mut_chip(t, m); + w = text_w(&AF_X, m) + 8; + cv_rect(PR_RX + PR_RW - w, bot - 13, w, 13, T_RAISE); + GFX_HOOK_ALIGN(0, bot - 13, 0, bot, AL_V, "MUTATE chip text centred up/down"); + cv_text_on(PR_RX + PR_RW - w + 4, bot - 13 + CAP_IN(X, 13), &AF_X, m, T_TEXT, T_RAISE); + } else if (pg->id[0] == P_POFS && !dr && t->p[P_POFS]) { + for (i = 0; i < 16u && base + i < len; i++) { + const step_t *st = &seq_steps(t)[base + i]; + if (st->time != ST_NOTE) + continue; + seq_col(dr, i, &x, &w); + for (k = 0; k < st->n && k < 4u; k++) { + int32_t y = pr_row_y(st->note[k] + t->p[P_POFS]); + if (y >= PR_Y0 && y < bot) + cv_frame(x + 1, y, w - 2, PR_RH - 1, T_MID); + } } - } else { - cv_text_in(4, 69, 120, &AF_X, st->time == ST_NOTE ? "EMPTY" : TIME_N[st->time % 3u], T_MID, T_BG); - } - acc = dr ? step_accents(st) != 0u : (st->flags & SF_ACCENT) != 0u; - bs_chip(0, "ACC", acc); - bs_chip(1, "SLD", !dr && (st->flags & SF_SLIDE)); - str_cpy(b, "MICRO ", sizeof b); - if (!m) str_cpy(b + 6, "0", 4); - else { b[6] = m < 0 ? '-' : '+'; fmt_int(b + 7, m < 0 ? -m : m); str_cpy(b + str_len(b), "/64", 4); } /* (0.9.1) */ - bs_chip(2, b, m != 0); - str_cpy(b, "COMP1 ", sizeof b); - if (st->comp) str_cpy(b + 6, COMP_NAMES[(COMP_ARPN + st->comp - CP_ARPN) % COMP_N], 10); - else if (step_ratchet(st) > 1u) { str_cpy(b + 6, "RATCH x", 10); b[13] = (char)('0' + step_ratchet(st)); b[14] = 0; } - else str_cpy(b + 6, "-", 4); - bs_chip(3, b, st->comp || step_ratchet(st) > 1u); - str_cpy(b, "COMP2 ", sizeof b); - str_cpy(b + 6, st->comp2 ? COMP_NAMES[(COMP_ARPN + st->comp2 - CP_ARPN) % COMP_N] : "-", 10); - bs_chip(4, b, st->comp2 != 0u); - str_cpy(b, "CHANCE ", sizeof b); - fmt_int(b + 7, (int32_t)step_chance(st)); - str_cpy(b + str_len(b), "%", 4); - bs_chip(5, b, step_chance(st) < 100u); -} -static void graph_fugue(const track_t *t); - -static void graph_fugue(const track_t *t) -{ - uint32_t len = (uint32_t)clamp(t->p[P_SLEN], 1, NSTEP), i, k, ti = song.sel % NTRK; - int32_t w = PANEL_W / (int32_t)len, x0 = PANEL_X0 + (PANEL_W - w * (int32_t)len) / 2; - if (w < 2) w = 2; - for (i = 0; i < len; i++) { - const step_t *st = &seq_steps(t)[i]; - int on = step_on(st); - cv_rect(x0 + (int32_t)i * w, on ? 4 : 14, w - (w > 3 ? 1 : 0), on ? 14 : 4, on ? step_heat(st, st->flags & SF_ACCENT, ACC) : T_RAISE); - if (song.playing && i == seq_src(t, t->seq_idx)) cv_rect(x0 + (int32_t)i * w, 20, w, 2, T_TEXT); - } - for (k = 0; k < FG_HEADS; k++) { - const fg_set_t *f = &fg_set[ti][k]; - const fg_head_t *h = &fg_head[ti][k]; - int32_t y = 28 + (int32_t)k * 23; - uint16_t c = f->rate ? heat_col(70u + k * 60u) : T_DIM; - char b[24] = {(char)('2' + k), ' ', 0}; - if (k == fg_ui % FG_HEADS) cv_rrect(PANEL_X0, y - 2, PANEL_W, 22, 3, T_RAISE, T_SURF); - cv_rect(x0, y + 17, w * (int32_t)len, 1, T_MID); - if (f->rate && song.playing && h->idx < len) - cv_rect(x0 + (int32_t)h->idx * w, y + 14, w, 6, c); - str_cpy(b + 2, N_FGRATE[f->rate % FG_NRATE], sizeof b - 2u); - if (f->rate) { - uint32_t n = str_len(b); - b[n] = ' '; b[n + 1u] = 0; - str_cpy(b + n + 1u, N_FGDIR[f->dir & 3u], sizeof b - n - 1u); - n = str_len(b); - b[n] = ' '; - b[n + 1u] = f->ivl > 0 ? '+' : 0; - fmt_int(b + n + 1u + (f->ivl > 0), f->ivl); - } - cv_text(PANEL_X0 + 4, y, &AF_S, b, f->rate ? T_TEXT : T_DIM); } } @@ -1301,6 +1205,7 @@ static int drift_on(void) if (UI_NO_DRIFT) return 0; return !ui.home && !sys_load && !ANIM_OFF() && strip_kind() == SK_NONE && !roll_view(cur_page()) && + !seq_roll_view(cur_page()) && g != GR_ROLL && g != GR_SHAPE && g != GR_COMP && g != GR_FUGUE && /* (0.8.3: LENTE's step, the heads) */ g != GR_STEPS && g != GR_CHANCE && g != GR_BROWSE && g != GR_USER && g != GR_SLOTS && g != GR_EVENTS && g != GR_SONG && g != GR_TOOLS && g != GR_PATS; @@ -1400,7 +1305,8 @@ static uint32_t graph_signature(void) h ^= (uint32_t)pg->graph * 131u + TSEL->eng_req + song.sel * 7777u + ui.page * 1291u; if (strip_kind() == SK_TITLE) /* MENU > LARGE: the page's title (its engine, its number) */ return h ^ 0x5A17u; - if ((pg->graph == GR_NONE && !fx_on()) || pg->graph == GR_ARP || pg->graph == GR_MOTION) h ^= anim_fr / 2u; /* (0.8.5: + if ((pg->graph == GR_NONE && !fx_on()) || pg->graph == GR_ARP || + (pg->graph == GR_MOTION && !seq_roll_view(pg))) h ^= anim_fr / 2u; /* (0.9.9-seq2b: AUTOMATION the roll, still) */ /* (0.8.5: * FX's lens pictures change with their values, */ if (fx_on() && (song.playing || bg_energy() > 2)) /* .. and with the sound while it sounds: FX live) */ h ^= anim_fr / 2u * 2246822519u; @@ -1550,20 +1456,34 @@ static uint32_t graph_signature(void) h = (h ^ (lens_level() + 1u) * 2654435761u) * 16777619u; h = (h ^ (song.playing ? seq_src(t, t->seq_idx) / 16u + 1u : 0u) * 40503u) * 16777619u; /* (0.8.5) the bar * playing: its number lit in the bars */ - if (bars_view(pg) && song.playing) { /* (0.8.5) PATTERN's roll: FUGUE's heads */ - uint32_t ti = song.sel % NTRK, k; + if (seq_roll_view(pg)) { /* (0.9.9-seq2b) the roll: every playhead's step (the keys light + * what each sounds, in any bar: a step at a time), the page's marks */ + uint32_t k; + char m[16]; + for (k = 0; k <= FG_HEADS; k++) + h = (h ^ (pr_head_step(t, k) + 1u)) * 16777619u; + h = (h ^ (pg->graph == GR_FUGUE ? fg_ui + 1u : 0u) ^ (uint32_t)(uint8_t)t->p[P_POFS] << 8) * 16777619u; for (k = 0; k < FG_HEADS; k++) - h = (h ^ (fg_set[ti][k].rate ? fg_head[ti][k].idx + 1u : 0u)) * 16777619u; - } - if (bigstep_view(pg)) { - const uint8_t *sb = (const uint8_t *)&seq_steps(t)[ui.cursor % NSTEP]; - for (i = 0; i < sizeof(step_t); i++) - h = (h ^ sb[i]) * 16777619u; - h = (h ^ (ui.pr_focus + 1u) * 40503u) * 16777619u; + h = (h ^ (uint32_t)(uint8_t)fg_set[song.sel % NTRK][k].ivl) * 16777619u; + if (pg->graph == GR_COMP) + h = (h ^ (comp_slot() + 1u) * 40503u) * 16777619u; + if (pg->graph == GR_MUTATE) { + mut_chip(t, m); + h = str_hash(h, m); + } + if (pg->graph == GR_MOTION || pg->graph == GR_EVENTS) { + uint8_t idx[MOTION_MAX]; + uint32_t n = ev_rows(idx); + for (k = 0; k < n; k++) + h = (h ^ motion.event[idx[k]].place ^ (uint32_t)motion.event[idx[k]].param << 8) * 16777619u; + h = (h ^ (n + 1u) ^ ev_row(n) << 8) * 16777619u; + } } } - if (pg->graph == GR_STEPS || pg->graph == GR_ROLL || pg->graph == GR_CHANCE || pg->graph == GR_SHAPE || roll_view(pg)) { - uint32_t ph = song.playing ? seq_src(t, t->seq_idx) : 0xFFFFu, rl = roll_view(pg) || pg->graph == GR_CHANCE; + if (pg->graph == GR_STEPS || pg->graph == GR_ROLL || pg->graph == GR_CHANCE || pg->graph == GR_SHAPE || roll_view(pg) || + seq_roll_view(pg)) { + uint32_t ph = song.playing ? seq_src(t, t->seq_idx) : 0xFFFFu, rl = roll_view(pg) || seq_roll_view(pg) || + pg->graph == GR_CHANCE; if (rl && ph / 16u != ui.bank) ph = 0xFFFFu; /* the roll shows the cursor's bank only */ h ^= steps_hash(t) + ph * 31u + ui.cursor * 7919u + ui.lane * 104723u + ui.bank * 613u; @@ -1626,52 +1546,6 @@ static void graph_pats(void) list_row(LIST_Y(row), k == cur, tag, T_MID, nm, T_TEXT, 232); } } -/* SEQ > AUTO LIST (ui_events.c): the track's records around the one selected, a row each: the kind (LOCK in the - * accent, AUTO), the step, the parameter's name, the value at the right; the last row + ADD LOCK */ -static void graph_events(void) -{ - const track_t *t = TSEL; - uint8_t idx[MOTION_MAX]; - uint32_t n = ev_rows(idx), cur = ev_row(n), k; - int32_t row, first = clamp((int32_t)cur - 3, 0, (int32_t)n + 1 > 7 ? (int32_t)n + 1 - 7 : 0); - for (row = 0; row < 7 && (uint32_t)(first + row) <= n; row++) { - int32_t y = LIST_Y(row); - int sel; - uint16_t bg; - k = (uint32_t)(first + row); - sel = k == cur; - bg = sel ? T_THEME : T_SURF; - if (sel) - cv_rrect(6, y, 228, 16, 4, T_THEME, T_SURF); - if (k == n) { - GFX_HOOK_ALIGN(0, y, 0, y + 16, AL_V, "list row text centred up/down"); - cv_text_on(14, y + CAP_IN(S, 16), &AF_S, "+ ADD LOCK", sel ? T_INK : T_DIM, bg); - break; - } - { - const motion_event_t *e = &motion.event[idx[k]]; - uint32_t id = MOTION_ID(e), lock = (e->param & MOTION_LOCK) != 0u; - char b[16], nm[12]; - const char *unit; - const param_desc_t *d = track_desc(t, id); - b[0] = (char)('0' + (MOTION_STEP(e) + 1u) / 10u); - b[1] = (char)('0' + (MOTION_STEP(e) + 1u) % 10u); - b[2] = 0; - GFX_HOOK_ALIGN(0, y, 0, y + 16, AL_V, "list row text centred up/down"); - cv_text_on(14, y + CAP_IN(S, 16), &AF_S, lock ? "LOCK" : "AUTO", sel ? T_INK : lock ? T_ACCENT : T_MID, bg); - GFX_HOOK_ALIGN(0, y, 0, y + 16, AL_V, "list row text centred up/down"); - cv_text_on(54, y + CAP_IN(S, 16), &AF_S, b, sel ? T_INK : T_MID, bg); - param_format(d, MOTION_VAL(e), b, &unit); - if (unit && unit[0] && str_len(b) + str_len(unit) < sizeof b) - str_cpy(b + str_len(b), unit, sizeof b - str_len(b)); - ev_name(t, id, nm); - GFX_HOOK_ALIGN(0, y, 0, y + 16, AL_V, "list row text centred up/down"); - cv_free_text(80, y + CAP_IN(S, 16), &AF_S, nm, sel ? T_INK : T_TEXT, bg, 226 - text_w(&AF_S, b) - 8 - 80); - GFX_HOOK_ALIGN(0, y, 0, y + 16, AL_V, "list row text centred up/down"); - cv_text_r(226, y + CAP_IN(S, 16), &AF_S, b, sel ? T_INK : T_TEXT, bg); - } - } -} /* MIXER page: four SURF columns, one under each card: the track number on its cushion (in the accent: * the selected track) with a REC / ARM / MUTE badge (P_MUTE: the GLO layer's black keys), the sound's short name (a MUTE badge * when armed and muted), the LEVEL knob (dB inside) with the output meter beside it, then the PAN and REV @@ -2089,12 +1963,13 @@ static void draw_graph(void) cv_oy = 0; graph_home_lz(); /* (0.8.5: HOME's lens, ECO / BEING; JIANT 0.5: the system's * beings, was the scope) */ - } else if (bars_view(pg)) { /* (0.8.3) LENTE's PATTERN: PATTERN STRETCH TRACK, the bars */ + } else if (seq_roll_view(pg)) { /* (0.9.9-seq2b) every SEQ page: the roll (a kit: the grid), its marks */ cv_oy = 0; - graph_bars(t, c); - } else if (bigstep_view(pg)) { /* .. its STEP: NOTE COMP COMP 2, the step large */ - cv_oy = 0; - graph_bigstep(t, pg, c); + if (drum_track(t)) + graph_grid(t, c); + else + graph_roll(t, c); + seq_overlay(t, pg); } else if (lz_on() && lz_fam() == LZ_SAVE) { /* (0.8.5) SAVE's lens */ cv_oy = 0; graph_save_lz(pg); @@ -2114,9 +1989,6 @@ static void draw_graph(void) case GR_ADSR: graph_adsr(t, c); break; - case GR_MUTATE: - graph_mutate(); - break; case GR_MORPH: graph_morph(t); break; @@ -2127,9 +1999,6 @@ static void draw_graph(void) } else graph_dximg(t); break; - case GR_FUGUE: - graph_fugue(t); - break; case GR_ROLL: case GR_CHANCE: case GR_SHAPE: /* (0.6.85) STRETCH: the whole sequence, as the roll shows it */ @@ -2143,10 +2012,6 @@ static void draw_graph(void) cv_oy = 0; graph_pats(); break; - case GR_EVENTS: - cv_oy = 0; - graph_events(); - break; case GR_FMOP: /* (0.6.10) FM6's operators: (0.9.6) the colony (ui_engvis.c), the operator */ case GR_FMOP2: /* picked lit */ if (fop_ok()) vx_fm6_page(t, fop_op % 6u, pg->graph == GR_FMOP2); diff --git a/tests/ui_test.c b/tests/ui_test.c index abf29a01..cbc1e3f8 100644 --- a/tests/ui_test.c +++ b/tests/ui_test.c @@ -4742,6 +4742,10 @@ static int test_step_rec(void) return bad; } +static uint16_t key_px(int32_t r, int32_t dx) /* (seq2b) the keys' pixel of row r from the top, dx into it */ +{ + return r >= 0 && r < PR_ROWS ? swap16(host_screen[(graph_y() + PR_Y0 + (uint32_t)r * PR_RH + 1u) * 240u + (uint32_t)(PR_KX + dx)]) : 0; +} static int test_piano_roll(void) { int bad = 0, ok; @@ -4790,11 +4794,55 @@ static int test_piano_roll(void) key_down(7); frames(200); /* a key held: its row lit on the strip */ { int32_t r = (int32_t)proll.lo + PR_ROWS - 1 - (int32_t)kb_snd[7][0]; - uint16_t c = r >= 0 && r < PR_ROWS ? swap16(host_screen[(graph_y() + PR_Y0 + (uint32_t)r * PR_RH + 1u) * 240u + PR_RX + 1]) : 0; - bad += check(" a key held: its row marked at the roll's left in the accent", kb_on[7] && c == T_ACCENT); + uint16_t c = r >= 0 && r < PR_ROWS ? swap16(host_screen[(graph_y() + PR_Y0 + (uint32_t)r * PR_RH + 1u) * 240u + PR_KX + 1]) : 0; + int32_t rs = (int32_t)proll.lo + PR_ROWS - 1 - (int32_t)t->step[ui.cursor].note[0]; /* (seq2b) the held step's note */ + uint16_t cs = rs >= 0 && rs < PR_ROWS ? swap16(host_screen[(graph_y() + PR_Y0 + (uint32_t)rs * PR_RH + 1u) * 240u + PR_KX + 6]) : 0; + bad += check(" a key held: its row marked at the roll's left in the accent (seq2b: its key on the keyboard)", kb_on[7] && c == T_ACCENT); + bad += check(" seq2b: the keyboard lights the held step's note in the accent", ui.entry_open && lock_held() && + t->step[ui.cursor].n && cs == T_ACCENT); } key_up(7); frames(100); song.rec = 0; + { /* (0.9.9-seq2b) the keys at the roll's left: stopped, the cursor's step's note TEXT, another key plain, the root's + * tooth; playing, a line a playhead in its colour and each head's note lit on the keys in it; drawn again a step at + * a time, not a frame at a time */ + uint32_t ti = song.sel % NTRK, k, sig, okk = 1, okl = 1; + int32_t yl = (int32_t)graph_y() + PR_Y0 + PR_ROWS * PR_RH / 2, r, root = -1; +#define KEYPX(n, dx) key_px((int32_t)proll.lo + PR_ROWS - 1 - (int32_t)(n), dx) + cursor_set(20); frame(); + memset(host_screen, 0, sizeof host_screen); ui.force = 1; ui_draw(); + ok = t->step[20].n && KEYPX(t->step[20].note[0], 6) == T_TEXT && + KEYPX(t->step[20].note[0] - 1, 6) == (PR_KB[(t->step[20].note[0] - 1) % 12] ? T_BG : T_MID); + for (r = 0; r < PR_ROWS && root < 0; r++) + if (((int32_t)proll.lo + PR_ROWS - 1 - r - t->p[P_ROOT] + 120) % 12 == 0) root = r; + ok &= root >= 0 && key_px(root, -3) == T_THEME && key_px(root < PR_ROWS - 1 ? root + 1 : root - 1, -3) != T_THEME; + bad += check(" seq2b keys: stopped, the cursor's step's note lit TEXT, the others plain (white MID, black BG), the root's tooth", ok); + memset(fg_set, 0, sizeof fg_set); + fg_set[ti][0].rate = 5; fg_set[ti][1].rate = 3; fg_set[ti][2].rate = 7; + fg_head[ti][0].idx = 22; fg_head[ti][1].idx = 24; fg_head[ti][2].idx = 26; + song.playing = 1; t->seq_idx = 20; + memset(host_screen, 0, sizeof host_screen); ui.force = 1; ui_draw(); + for (k = 0; k <= FG_HEADS; k++) { + uint32_t st = pr_head_step(t, k); + int32_t x = PR_CX(st % 16u) + (k ? (PR_CWI(st % 16u) + 1) * (int32_t)k / 4 : 0); + okl &= st / 16u == 1u && swap16(host_screen[(uint32_t)yl * 240u + (uint32_t)x]) == pr_head_col(k); + if (!k) + okk &= KEYPX(t->step[st].note[0], 6) == T_ACCENT; + else if (k == 1u && t->step[st].note[0] != t->step[pr_head_step(t, 0)].note[0]) + okk &= KEYPX(t->step[st].note[0], 6) == pr_head_col(1); + } + bad += check(" seq2b playing: a line a playhead (the sequencer's ACCENT, FUGUE's 2..4 their colours) in its column", okl); + bad += check(" seq2b playing: the note each playhead sounds lit on the keys in its colour", okk); + frame(); sig = ui.graph_sig; frame(); frame(); + ok = ui.graph_sig == sig; + fg_head[ti][1].idx = 25; frame(); + ok &= ui.graph_sig != sig; + sig = ui.graph_sig; t->seq_idx = 21; frame(); + ok &= ui.graph_sig != sig; + bad += check(" seq2b: the roll drawn again when a playhead steps, not frame by frame", ok); + song.playing = 0; memset(fg_set, 0, sizeof fg_set); +#undef KEYPX + } return bad; } @@ -6515,19 +6563,33 @@ static int test_lente(void) turn(EN_SELECT, -1); frames(32); ok &= str_eq(cur_page()->title, "STEP") && lz_count_is("1/10"); /* (the first: no wrap) */ turn(EN_SELECT, 1); frames(32); - ok &= str_eq(cur_page()->title, "PATTERN") && bars_view(cur_page()) && lz_tab_lit(1) && lz_count_is("2/10") && + ok &= str_eq(cur_page()->title, "PATTERN") && seq_roll_view(cur_page()) && lz_tab_lit(1) && lz_count_is("2/10") && lz_crumb_is("SEQ \xB7 LENGTH \xB7 LENGTH"); /* (PATTERN, named LENGTH) */ turn(EN_SELECT, 1); frames(32); ok &= str_eq(cur_page()->title, "TRACK") && lz_tab_lit(1) && lz_count_is("3/10") && lz_crumb_is("SEQ \xB7 LENGTH \xB7 TRACK"); /* (TRACK under the LEN tab) */ turn(EN_SELECT, 4); frames(32); - ok &= str_eq(cur_page()->title, "COMP") && bigstep_view(cur_page()) && lz_tab_lit(5) && lz_count_is("7/10") && + ok &= str_eq(cur_page()->title, "COMP") && seq_roll_view(cur_page()) && lz_tab_lit(5) && lz_count_is("7/10") && lz_crumb_is("SEQ \xB7 COMP \xB7 COMP"); turn(EN_SELECT, 1); frames(32); ok &= str_eq(cur_page()->title, "COMP 2") && lz_tab_lit(5) && lz_count_is("8/10"); - bad += check("seq2 SEQ: enters at STEP (1/10, seven tabs); LENGTH's bars, TRACK under its tab, COMP the step large, COMP 2 after it", ok); + bad += check("seq2 SEQ: enters at STEP (1/10, seven tabs); LENGTH the roll (seq2b), TRACK under its tab, COMP the roll, COMP 2 after it", ok); bad += check("seq2 SEQ: one chain of 10 by SELECT (no wrap); a SEQ tap the next tab's first, round", chain_walk(B_SEQ, CH, 10, TP, 6)); + { /* (0.9.9-seq2b) every page of the chain the same picture: the bars' strip, the roll with its keys */ + static const char *const TI[10] = {"STEP", "PATTERN", "TRACK", "MUTATE", "PLAYHEADS", "STRETCH", "COMP", "COMP 2", + "AUTOMATION", "AUTO LIST"}; + ui_power_on(); TSEL->p[P_SLEN] = 64; + open_family(FAM_SEQ); frame(); + ok = 1; + for (q = 0; q < 10u; q++) { + go_title(TI[q]); frame(); + memset(host_screen, 0, sizeof host_screen); ui.force = 1; ui_draw(); + ok &= str_eq(cur_page()->title, TI[q]) && seq_roll_view(cur_page()) && lens_strip() && + key_px(PR_ROWS / 2, 6) != T_SURF && key_px(PR_ROWS / 2, 6) != 0u; + } + bad += check("seq2b SEQ: every page of the chain draws the roll, its keys and the bars' strip (its knobs its own)", ok); + } /* the memory: the section's (not the track's) */ ui_power_on(); TSEL->p[P_SLEN] = 64; open_family(FAM_SEQ); frame(); @@ -6540,13 +6602,13 @@ static int test_lente(void) ok &= str_eq(cur_page()->title, "MUTATE"); /* (T2: the same page) */ track_select(0); frame(); go_title("COMP 2"); frame(); - ok &= lens_level() == LV_STEP && bigstep_view(cur_page()); /* (a page put by code: its entry) */ + ok &= lens_level() == LV_STEP && seq_roll_view(cur_page()); /* (a page put by code: its entry) */ go_page(GR_CHANCE); frame(); ok &= lens_level() == LV_STEP; press(B_SEQ); frames(32); ok &= str_eq(cur_page()->title, "AUTOMATION"); /* (hidden CHANCE: from COMP's tab) */ go_title("NOTE"); frame(); - ok &= roll_view(cur_page()) && !bigstep_view(cur_page()); /* (NOTE, out of the chain: the roll) */ + ok &= roll_view(cur_page()) && seq_roll_view(cur_page()); /* (NOTE, out of the chain: the roll) */ bad += check("0.9.2 SEQ from elsewhere: the page left, on any track (was per track); a page put by code brings its entry", ok); /* BAR: KNOB 1 the bar (no wrap, the cursor at its place), KNOB 2 LEN; STEP's KNOB 1 into the next bar */ ui_power_on(); TSEL->p[P_SLEN] = 64; @@ -6615,13 +6677,13 @@ static int test_lente(void) ok = grid_on() && roll_view(cur_page()) && lens_level() == LV_BAR && song.grid == 1u; frames(500); turn(EN_SELECT, 1); frames(32); - ok &= bars_view(cur_page()) && str_eq(cur_page()->title, "PATTERN"); + ok &= seq_roll_view(cur_page()) && str_eq(cur_page()->title, "PATTERN"); go_title("BAR"); frames(32); turn(EN_K1, 1); ok &= ui.bank == 1u; turn(EN_SELECT, 5); frames(32); /* (from BAR, LENGTH's place: COMP) */ - ok &= bigstep_view(cur_page()) && lens_level() == LV_STEP; - bad += check(" DRUM: STEP is the grid (its keys); LENGTH its bars, BAR (by code) KNOB 1 the bar; COMP the step large", ok); + ok &= seq_roll_view(cur_page()) && lens_level() == LV_STEP; + bad += check(" DRUM: STEP is the grid (its keys); LENGTH the grid (seq2b), BAR (by code) KNOB 1 the bar; COMP the grid", ok); return bad; } @@ -9014,7 +9076,7 @@ static int test_click_menu(void) } bad += check("CLICK / CLICK LEVEL / COUNT-IN saved and read back; a stored 3 the default; older settings OFF / MID / OFF", ok); - /* the count-in from the UI (0.8.5: read at the cells' row 40, where the roll's lens page is one colour across) */ + /* the count-in from the UI (0.8.5: read at the cells' row 40, where the roll's lens page is one colour across; seq2b: the page back read at x 28, 84, inside the roll past its keys) */ ui_power_on(); menu_put(MI_COUNTIN, 1u); go_page(GR_ROLL); @@ -9045,14 +9107,14 @@ static int test_click_menu(void) ok = transport_req == 2u; events_block(CTL); frame(); - ok &= !seq_counting() && !song.playing && (song.rec & 1u) && px_at(16, CI_Y + 40) == px_at(16 + 56, CI_Y + 40); + ok &= !seq_counting() && !song.playing && (song.rec & 1u) && px_at(28, CI_Y + 40) == px_at(28 + 56, CI_Y + 40); bad += check("PLAY while counting in stops it: nothing plays, still armed, the page back", ok); press(B_PLAY); events_block(CTL); ok = seq_counting() && cin_left == 4u; for (i = 0; i < 4u; i++) cin_beat(); frame(); - ok &= !seq_counting() && song.playing && trk[0].seq_idx == 0u && px_at(16, CI_Y + 40) == px_at(16 + 56, CI_Y + 40); + ok &= !seq_counting() && song.playing && trk[0].seq_idx == 0u && px_at(28, CI_Y + 40) == px_at(28 + 56, CI_Y + 40); bad += check("PLAY armed and stopped: the count-in again; at its end the sequencer plays from step 1, the page back", ok); press(B_PLAY); events_block(CTL);