diff --git a/firmware/src/ui_graph.c b/firmware/src/ui_graph.c index 2fb568cc..08ea7d45 100644 --- a/firmware/src/ui_graph.c +++ b/firmware/src/ui_graph.c @@ -62,22 +62,47 @@ static void graph_adsr(const track_t *t, uint16_t c) px = x3 + i; py = EGY(sus * e >> 15); } + if (pg->id[0] == P_ATK) { /* (JIANT 0.5) the track's envelope now: the loudest voice's */ + const voice_t *bv = 0; /* level as a dot on the curve, a line down to the axis */ + int32_t lvl, x; + for (i = 0; i < NVOICE; i++) + if (t->v[i].stage && t->v[i].stage < 4u && (!bv || t->v[i].env > bv->env)) + bv = &t->v[i]; + if (bv) { + lvl = (int32_t)(((int64_t)bv->env * 1000) >> 24); + if (bv->stage == 1u) + x = x0 + a * lvl / 1000; + else if (bv->stage == 2u) + x = x1 + (sus < 1000 ? clamp((1000 - lvl) * d / (1000 - sus), 0, d) : 0); + else + x = x3 + (sus > 0 ? clamp((sus - lvl) * r / sus, 0, r) : r); + cv_rect(x, EGY(lvl), 1, bot + 2 - EGY(lvl), T_MID); + cv_rrect(x - 3, EGY(lvl) - 3, 7, 7, 3, T_TEXT, T_SURF); + } + } #undef EGY } +/* LFO: the wave as it runs (JIANT 0.5): the phase now at the playhead (a quarter in), two cycles across, scrolling + * at the LFO's own rate; behind the playhead dimmer (what it played), the level now a dot, its depth after FADE */ static void graph_lfo(const track_t *t, uint16_t c) { - int32_t x, cy = graph_ht / 2, a = 38 * graph_ht / 100, py = cy; - uint32_t ph = (uint32_t)t->p[P_LPHASE] << 25; + int32_t x, cy = graph_ht / 2, a = 38 * graph_ht / 100, py = cy, xp = PANEL_W / 4; + uint32_t span = 0xFFFFFFFFu / (PANEL_W / 2u), ph = t->lfo_ph - (uint32_t)xp * span; + int32_t now = cy - mulq15(t->lfo_val, t->lfo_fade) * a / 32768; cv_rect(PANEL_X0, cy, PANEL_W, 1, T_RAISE); - for (x = 0; x < PANEL_W; x++) { /* two cycles (lfo_wave only reads the track) */ - int32_t y = cy - lfo_wave((track_t *)t, ph + (uint32_t)x * (0xFFFFFFFFu / (PANEL_W / 2u))) * a / 32768; - if (t->p[P_LWAVE] == 4) - y = cy - ((int32_t)((x / 20 * 2654435761u) >> 16) - 32768) * a / 32768; + for (x = 0; x < PANEL_W; x++) { /* (lfo_wave only reads the track) */ + uint32_t px = ph + (uint32_t)x * span; + int32_t y = cy - lfo_wave((track_t *)t, px) * a / 32768; + if (t->p[P_LWAVE] == 4) /* S&H: a value per cycle part, held */ + y = cy - ((int32_t)((((px >> 29) + 1u) * 2654435761u) >> 16) - 32768) * a / 32768; if (x) - cv_line_t(PANEL_X0 + x - 1, py, PANEL_X0 + x, y, heat_y(y, cy - a, cy + a, c), 2); + cv_line_t(PANEL_X0 + x - 1, py, PANEL_X0 + x, y, + x < xp ? ux_mix(T_SURF, heat_y(y, cy - a, cy + a, c), 45) : heat_y(y, cy - a, cy + a, c), 2); py = y; } + cv_rect(PANEL_X0 + xp, cy - a - 4, 1, 2 * a + 8, T_MID); /* the playhead */ + cv_rrect(PANEL_X0 + xp - 3, now - 3, 7, 7, 3, T_TEXT, T_SURF); } /* step bar x of step i of a 16-step row: 4 groups, as the footer (9 px bars, 13 px apart, 4 px between groups), @@ -353,10 +378,11 @@ static void graph_fx(const track_t *t, uint16_t c) uint32_t i; for (i = 0; i < 4u; i++) { int32_t h = t->p[P_DIST + i] * 76 / 127, x = CARD_X(i) + 26; + uint16_t hc = settings.palette == UI_JIANT_INDEX ? heat_col(t->p[P_DIST + i] * 256 / 127) : c; /* (JIANT: heat) */ cv_rrect(x, 6, 4, 82, 2, T_RAISE, T_SURF); if (h > 3) - cv_rrect(x, 88 - h, 4, h, 2, c, T_RAISE); - cv_rrect(x - 4, 85 - h, 12, 6, 3, c, T_SURF); + cv_rrect(x, 88 - h, 4, h, 2, hc, T_RAISE); + cv_rrect(x - 4, 85 - h, 12, 6, 3, hc, T_SURF); } } /* SLICER page: the pattern's 16 steps, a 'x' step a full bar; a '.' step: GATE a bar as high as it stays @@ -776,6 +802,11 @@ static uint32_t graph_signature(void) if (strip_kind() == SK_TITLE) /* MENU > LARGE: the page's title (its engine, its number) */ return h ^ 0x5A17u; if (pg->graph == GR_NONE || pg->graph == GR_ARP || pg->graph == GR_MOTION) h ^= ui.frame / 2u; + if (pg->graph == GR_LFO) /* (JIANT 0.5) the LFO runs: its phase, its level */ + h ^= (t->lfo_ph >> 23) * 2654435761u ^ (uint32_t)(t->lfo_val * t->lfo_fade >> 22); + if (pg->graph == GR_ADSR) /* the envelope's dot: every voice's stage and level */ + for (i = 0; i < NVOICE; i++) + h = (h ^ ((uint32_t)t->v[i].stage << 24 | (uint32_t)t->v[i].env >> 16)) * 16777619u; for (i = 0; i < P_COUNT; i++) h = (h ^ (uint32_t)t->p[i]) * 16777619u; h ^= (uint32_t)TSEL->preset * 7u + (uint32_t)song.g[G_SLOT] * 13u + TSEL->user * 257u + up_gen * 7919u + ui.uslot * 104729u + @@ -1346,6 +1377,7 @@ static void graph_song(void) } } } +#include "ui_tech.c" /* (JIANT 0.5) the technical graphs (FX, DEST, VOICE, GLOBAL) */ static void draw_graph(void) { const page_t *pg = cur_page(); @@ -1455,7 +1487,12 @@ static void draw_graph(void) else if ((pg->scope == SC_ENGINE || pg->id[0] == P_FM1_LEVEL) && t->eng_req % NENGINES == ENGI_DIGITAL) graph_fm(t, c); /* (OP LEVEL too: the levels on the chart) */ #endif - else { cv_oy = 0; graph_being(t); } /* (JIANT 0.5: the being, was the scope) */ + else if (pg->scope == SC_ENGINE) { cv_oy = 0; graph_being(t); } /* (JIANT 0.5: the being, was the scope) */ + else { /* the FX, DEST, VOICE, GLOBAL pages: their graphs (else the scope) */ + cv_oy = 0; + if (!graph_tech(t, pg)) + graph_scope(c); + } break; } } diff --git a/firmware/src/ui_tech.c b/firmware/src/ui_tech.c new file mode 100644 index 00000000..db1e0e28 --- /dev/null +++ b/firmware/src/ui_tech.c @@ -0,0 +1,305 @@ +/* SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments + * JIANT 0.5: the technical graphs of the pages that had none (they showed the scope): what the four knobs do, drawn + * as an engineer would, live where the sound is (thermal colours: heat_col / heat_y). + * DIST the transfer curve of the drive's TYPE (in -> out), the unity line, the level now as a dot on it; the + * tone as a low-pass response at the right + * DLY the echoes as an impulse train: the first at MIX, each FDBK lower, TIME apart; a playhead at tempo + * DLY 2 the echoes left (top) and right (bottom): WIDTH sets the right ones later, PITCH steps them up / down, + * SPRAY scatters them + * REVERB the impulse response: PRE's gap, then a dense tail as long as SIZE, cooling as fast as DAMP (SPRING: a + * chirp) + * REVERB 2 the tail left (up) and right (down), WIDE apart, MOD wobbling it (at RATE, while it sounds), FILT tilting + * CHORUS the taps' delay lines: three sines a third apart, as deep as DEPTH, running at RATE while it sounds + * MASTER CLIP's curve with the level now; PUNCH's transient shape; DUCK's gain now as a meter + * ENV / LFO DEST the source now (the envelope's level, the LFO's value) into four bipolar columns under the cards, + * each as long as its amount and lit by what it sends now + * VOICE the track's voices: one slot each, as full as its envelope now; the glide as a curve between two notes + * GLOBAL a bar of 16 steps with SWING moving the off-beats, the playhead, the beat */ +#define TK_X0 PANEL_X0 +#define TK_X1 (PANEL_X0 + PANEL_W) +#define TK_Y0 8 +#define TK_Y1 112 +/* the current page's knob c as 0..1000 (no knob: 500) */ +static int32_t tk(uint32_t c) +{ + int16_t *vp; + const param_desc_t *d = page_desc(cur_page(), c, &vp); + int32_t r = d && d->label && d->label[0] != '-' ? RATIO(d, enum_rank(d, *vp)) : -1; + return r < 0 ? 500 : r; +} +/* .. as an amount -500..500: a bipolar knob about its middle, a unipolar one from 0 up */ +static int32_t tk_amt(uint32_t c) +{ + int16_t *vp; + const param_desc_t *d = page_desc(cur_page(), c, &vp); + return d && d->min >= 0 ? tk(c) / 2 : tk(c) - 500; +} +static void tk_axes(int32_t x0, int32_t y0, int32_t x1, int32_t y1) /* a plot's frame: corner ticks, the axes */ +{ + cv_rect(x0, y1, x1 - x0, 1, T_RAISE); + cv_rect(x0, y0, 1, y1 - y0, T_RAISE); + cv_rect(x1 - 4, y0, 5, 1, T_RAISE); + cv_rect(x1, y0, 1, 5, T_RAISE); +} +static void tk_dot(int32_t x, int32_t y) { cv_rrect(x - 3, y - 3, 7, 7, 3, T_TEXT, T_SURF); } + +/* DIST: in -> out of dist_shape's maths (the input's full scale +-131072 as the track's mix sees it) */ +static int32_t tk_dist_y(uint32_t type, int32_t x, int32_t g, int32_t d) +{ + int32_t v = ((x >> 2) * g) >> 10, a; + switch (type) { + case DT_HARD: return clamp(v, -22000, 22000) * 32767 / 26000; + case DT_FOLD: + v = clamp(v, -110000, 110000); + for (a = 0; a < 3; a++) + v = v > 22000 ? 44000 - v : v < -22000 ? -44000 - v : v; + return v * 32767 / 26000; + case DT_CRUSH: { + uint32_t sh = 4u + (uint32_t)d / 12u; + x = (int32_t)((uint32_t)(clamp(x, -131072, 131068) >> sh) << sh); + return clamp(((x >> 2) * g) >> 10, -26000, 26000) * 32767 / 26000; + } + case DT_RECT: a = x < 0 ? -x : x; return softclip((((a - 65536) >> 2) * g) >> 10); + default: return softclip(v + 2400) - softclip(2400); + } +} +static void tech_dist(const track_t *t) +{ + int32_t d = t->p[P_DIST], g = 4096 + d * d * 2, i, py = 0, x0 = 22, y0 = TK_Y0, s = 100, cx = x0 + s / 2; + int32_t cy = y0 + s / 2, en = bg_energy(), tone = t->p[P_DTONE]; + uint32_t type = (uint32_t)t->p[P_DTYPE] > DT_RECT ? DT_SOFT : (uint32_t)t->p[P_DTYPE]; + tk_axes(x0, y0, x0 + s, y0 + s); + cv_rect(x0, cy, s, 1, T_LINE); + cv_rect(cx, y0, 1, s, T_LINE); + for (i = 0; i <= s; i += 4) /* the unity line, dotted */ + cv_rect(x0 + i, y0 + s - i, 1, 1, T_DIM); + for (i = 0; i <= s; i++) { + int32_t x = (i - s / 2) * 131072 / (s / 2), y = cy - tk_dist_y(type, x, d ? g : 4096, d) * (s / 2) / 32767; + y = clamp(y, y0, y0 + s); + if (i) + cv_line_t(x0 + i - 1, py, x0 + i, y, heat_y(y < cy ? y : 2 * cy - y, y0, cy, T_THEME), 2); + py = y; + } + if (en > 2) { /* the level now, on the curve */ + int32_t xi = s / 2 + en * (s / 2) / 256; + tk_dot(x0 + xi, clamp(cy - tk_dist_y(type, en * 512, d ? g : 4096, d) * (s / 2) / 32767, y0, y0 + s)); + } + { /* the tone: a low-pass's response, its corner from TONE and DRIVE (fx.c track_dist k) */ + int32_t k = clamp(32000 - d * 95 + tone * 300, 2500, 32767), fx = 140, fw = 82, fc = fx + 8 + (k - 2500) * (fw - 34) / 30267, f; + tk_axes(fx, y0 + 30, fx + fw, y0 + s); + py = y0 + 34; + for (f = 0; f <= fw; f++) { + int32_t r = fx + f <= fc ? 0 : (fx + f - fc) * (fx + f - fc) / 6, y = clamp(y0 + 34 + r, y0 + 34, y0 + s); + if (f) + cv_line_t(fx + f - 1, py, fx + f, y, heat_y(y, y0 + 34, y0 + s, T_THEME), 2); + py = y; + } + } +} + +/* DLY: the echoes. span: six of them */ +static void tech_dly(void) +{ + int32_t time = (int32_t)delay_samples(), mix = song.g[G_DMIX], fb = song.g[G_DFDBK], amp = mix * 1000 / 127, n; + int32_t x0 = TK_X0 + 6, w = PANEL_W - 12, base = TK_Y1 - 4, h = 88, tone = song.g[G_DCOLOR] - 64; + tk_axes(x0, TK_Y0, x0 + w, base); + cv_rect(x0, base - h, 3, h, T_TEXT); /* the dry hit */ + for (n = 1; n <= 6 && amp > 4; n++) { + int32_t x = x0 + n * w / 7, bh = amp * h / 1000; + int32_t heat = clamp(60 + amp * 180 / 1000 + tone * n, 8, 250); /* (the tone: each repeat warmer / colder) */ + cv_rect(x - 2, base - bh, 4, bh, heat_col(heat)); + amp = amp * (fb > 100 ? 100 : fb) / 100; /* (past 100: it grows, held at the top here) */ + if (fb > 100) amp = 1000; + } + if (song.playing && time > 0) { /* the playhead: where the echo period is now */ + int32_t x = x0 + (int32_t)((ms_clock % (uint32_t)(time * 7)) * (uint32_t)w / (uint32_t)(time * 7)); + cv_rect(x, TK_Y0, 1, base - TK_Y0, T_MID); + } +} + +/* DLY 2: left echoes on top, right below */ +static void tech_dly2(void) +{ + int32_t wd = tk(0), pit = song.g[G_DPIT], spry = tk(2), n, x0 = TK_X0 + 6, w = PANEL_W - 12, mid = (TK_Y0 + TK_Y1) / 2; + cv_rect(x0, mid, w, 1, T_RAISE); + for (n = 1; n <= 6; n++) { + int32_t jit = (int32_t)((n * 2654435761u) >> 27) - 16, x = x0 + n * w / 7 + jit * spry / 1000; + int32_t up = clamp(pit * n * 2, -36, 36), hot = 220 - n * 26; + cv_rect(x - 2, mid - 8 - 30 + up / 2, 4, 30, heat_col(hot)); /* left */ + cv_rect(x - 2 + wd * 18 / 1000, mid + 8 - up / 2, 4, 30, heat_col(hot - 10)); /* right, WIDTH later */ + } +} + +/* REVERB: the impulse response */ +static void tech_rev(void) +{ + int32_t size = song.g[G_RSIZE], damp = song.g[G_RDAMP], pre = song.g[G_RPRE], spring = song.g[G_RTYPE] == 1; + int32_t x0 = TK_X0 + 6, w = PANEL_W - 12, base = TK_Y1 - 4, h = 92, len = 40 + size * (w - 50) / 127, gap = pre * 40 / 100; + int32_t i; + tk_axes(x0, TK_Y0, x0 + w, base); + cv_rect(x0, base - h, 3, h, T_TEXT); /* the dry hit */ + for (i = 0; i < len && x0 + 6 + gap + i < x0 + w; i += 2) { + int32_t env = 1000 - i * 1000 / len, r = (int32_t)(((uint32_t)(i + 7) * 2654435761u) >> 22) % 1000; + int32_t bh = env * (400 + r * 6 / 10) / 1000 * h / 1000; + int32_t heat = clamp(env * 230 / 1000 - i * damp / (len + 1), 6, 236); + if (spring) + bh = bh * (600 + (bg_sin((uint32_t)(i * i * 9)) >> 6) * 400 / 512) / 1000; + if (bh > 0) + cv_rect(x0 + 6 + gap + i, base - bh, 1, bh, heat_col(heat)); + } +} + +/* REVERB 2: the tail left (up) and right (down) */ +static void tech_rev2(void) +{ + int32_t mod = tk(0), wide = tk(3), filt = song.g[G_RFILT], x0 = TK_X0 + 6, w = PANEL_W - 12, mid = (TK_Y0 + TK_Y1) / 2; + int32_t i, ph = bg_energy() > 2 ? (int32_t)ui.frame * (8 + tk(1) / 20) : 0; + cv_rect(x0, mid, w, 1, T_RAISE); + for (i = 0; i < w; i += 2) { + int32_t env = 1000 - i * 1000 / w, wob = (bg_sin((uint32_t)(i * 700 + ph * 64)) * mod / 1000) >> 12; + int32_t bh = env * 44 / 1000, off = wide * 6 / 1000; + int32_t heat = clamp(env * 200 / 1000 + filt, 6, 236); + if (bh <= 0) continue; + cv_rect(x0 + i + wob, mid - 2 - off - bh, 1, bh, heat_col(heat)); + cv_rect(x0 + i - wob, mid + 2 + off, 1, bh, heat_col(heat - 12)); + } +} + +/* CHORUS: three taps' delay modulation */ +static void tech_chorus(void) +{ + int32_t rate = tk(0), depth = tk(1), x0 = TK_X0 + 6, w = PANEL_W - 12, mid = (TK_Y0 + TK_Y1) / 2, k, i; + uint32_t ph = bg_energy() > 2 ? ui.frame * (uint32_t)(40 + rate) * 8u : 0u; + cv_rect(x0, mid, w, 1, T_RAISE); + for (k = 0; k < 3; k++) { + int32_t py = mid; + for (i = 0; i <= w; i++) { + int32_t y = mid - ((bg_sin((uint32_t)(i * (60 + rate / 4)) + ph + (uint32_t)k * 21845u) * depth / 1000 * 40) >> 15); + if (i) + cv_line_t(x0 + i - 1, py, x0 + i, y, heat_y(y, mid - 40, mid + 40, T_THEME), k ? 1 : 2); + py = y; + } + } +} + +/* MASTER: the clipper's curve, PUNCH's shape, DUCK's gain now */ +static void tech_master(void) +{ + int32_t clip = song.g[G_CLIP], g = 1024 + clip * 31, i, py = 0, x0 = 22, y0 = TK_Y0, s = 100, cy = y0 + s / 2; + int32_t en = bg_energy(), punch = song.g[G_PUNCH], duck = song.g[G_DUCK]; + tk_axes(x0, y0, x0 + s, y0 + s); + cv_rect(x0, cy, s, 1, T_LINE); + for (i = 0; i <= s; i++) { + int32_t x = (i - s / 2) * 32767 / (s / 2), y = cy - softclip(x * g >> 10) * (s / 2) / 32767; + if (i) + cv_line_t(x0 + i - 1, py, x0 + i, y, heat_y(y < cy ? y : 2 * cy - y, y0, cy, T_THEME), 2); + py = y; + } + if (en > 2) + tk_dot(x0 + s / 2 + en * (s / 2) / 256, cy - softclip(en * 128 * g >> 10) * (s / 2) / 32767); + { /* PUNCH: a drum hit's envelope, its first 8 ms up to +6 dB, the tail down */ + int32_t px0 = 136, pw = 60, b = y0 + s, py2 = b - 50; + tk_axes(px0, y0 + 20, px0 + pw, b); + for (i = 0; i <= pw; i++) { + int32_t e = 60 * (pw - i) / pw, y = b - e - (i < 8 ? punch * 20 / 100 : 0) + (i >= 8 ? punch * e / 400 : 0); + if (i) + cv_line_t(px0 + i - 1, py2, px0 + i, y, heat_y(y, y0 + 20, b, T_THEME), 2); + py2 = y; + } + } + { /* DUCK: the gain the other parts get now (full: no duck) */ + int32_t mx = 210, mh = s, gh = duck_g1 * mh / 32767; + cv_rect(mx, y0, 10, mh, T_RAISE); + cv_rect(mx, y0 + mh - gh, 10, gh, duck ? heat_col(60 + gh * 180 / mh) : T_DIM); + } +} + +/* ENV DEST / LFO DEST: the source now into four bipolar columns, one under each card */ +static void tech_dest(const track_t *t, int lfo) +{ + int32_t src = 0, c, mid = (TK_Y0 + TK_Y1) / 2, half = 44; + uint32_t i; + if (lfo) + src = mulq15(t->lfo_val, t->lfo_fade); + else + for (i = 0; i < NVOICE; i++) + if (t->v[i].stage && t->v[i].stage < 4u && (t->v[i].env >> 9) > src) + src = t->v[i].env >> 9; /* Q15 */ + for (c = 0; c < 4; c++) { + int32_t x = CARD_X(c) + 22, amt = tk_amt((uint32_t)c), bh = amt * half / 500, live = bh * src / 32767; + cv_rect(x - 6, mid, 25, 1, T_RAISE); + cv_rect(x + 6, mid - half, 1, 2 * half, T_LINE); + if (bh > 0) cv_rect(x, mid - bh, 13, bh, ux_mix(T_SURF, T_THEME, 35)); + else if (bh < 0) cv_rect(x, mid, 13, -bh, ux_mix(T_SURF, T_THEME, 35)); + if (live > 0) cv_rect(x, mid - live, 13, live, heat_col(80 + live * 170 / half)); + else if (live < 0) cv_rect(x, mid, 13, -live, heat_col(80 - live * 170 / half)); + } + { /* the source: its level now as a bar at the left edge */ + int32_t sh = (src < 0 ? -src : src) * half / 32767; + cv_rect(TK_X0, src >= 0 ? mid - sh : mid, 3, sh ? sh : 1, T_TEXT); + } +} + +/* VOICE: the track's voices now; the glide between two notes */ +static void tech_voice(const track_t *t) +{ + uint32_t i, nv = trk_nvoice(t) ? trk_nvoice(t) : NVOICE; + int32_t sw = PANEL_W / (int32_t)NVOICE, glide = t->p[P_GLIDE], py = 0, x; + for (i = 0; i < NVOICE; i++) { + int32_t x0 = TK_X0 + (int32_t)i * sw + 2, h = 40, lv = 0; + if (t->v[i].stage && t->v[i].stage < 4u) + lv = (int32_t)(((int64_t)t->v[i].env * h) >> 24); + cv_rrect(x0, TK_Y0, sw - 4, h, 2, i < nv ? T_RAISE : T_LINE, T_SURF); + if (lv > 0) + cv_rect(x0 + 1, TK_Y0 + h - lv, sw - 6, lv, heat_col(60 + lv * 190 / h)); + } + for (x = 0; x <= PANEL_W - 20; x++) { /* the glide: low note to high, as slow as GLIDE */ + int32_t tm = glide ? x * 127 * 6 / (glide * 4 + 1) : 1000, k = tm > 255 ? 255 : tm; + int32_t y = TK_Y1 - 4 - 40 * (x < 30 ? 0 : (k * (255 - (255 - k) * (255 - k) / 255)) / 255) / 255; + if (x < 30) y = TK_Y1 - 4; + if (x) + cv_line_t(TK_X0 + 10 + x - 1, py, TK_X0 + 10 + x, y, heat_y(y, TK_Y1 - 44, TK_Y1 - 4, T_THEME), 2); + py = y; + } +} + +/* GLOBAL: a bar of sixteenths, the off-beats late by SWING; the playhead */ +static void tech_global(void) +{ + int32_t sw = song.g[G_SWING], i, x0 = TK_X0 + 8, w = PANEL_W - 16, y = 40, step = w / 16; + cv_rect(x0, y + 20, w, 1, T_RAISE); + for (i = 0; i < 16; i++) { + int32_t x = x0 + i * step + ((i & 1) ? sw * step / 200 : 0), hh = i % 4 == 0 ? 30 : 16; + cv_rect(x, y + 20 - hh, 3, hh, i % 4 == 0 ? T_TEXT : heat_col(60 + (i & 1) * sw * 15 / 10)); + } + if (song.playing) { + uint32_t bar = div_samples(2) * 16u; + int32_t x = bar ? x0 + (int32_t)((ms_clock % bar) * (uint32_t)w / bar) : x0; + cv_rect(x, y - 16, 1, 50, T_ACCENT); + } +} + +/* the page's technical graph, if it has one (1) */ +static int graph_tech(const track_t *t, const page_t *pg) +{ + if (pg->scope != SC_GLOBAL) + switch (pg->id[0]) { + case P_DIST: tech_dist(t); return 1; + case P_ED_FLT: tech_dest(t, 0); return 1; + case P_LD_PIT: tech_dest(t, 1); return 1; + case P_VOICE: tech_voice(t); return 1; + case P_MSDIV: cv_oy = GOY; graph_mseq(t, T_THEME); return 1; /* (MSEQ's, on the 100 px scale) */ + default: return 0; + } + switch (pg->id[0]) { + case G_DTIME: tech_dly(); return 1; + case G_WIDTH: tech_dly2(); return 1; + case G_RTYPE: tech_rev(); return 1; + case G_RMOD: tech_rev2(); return 1; + case G_CRATE: tech_chorus(); return 1; + case G_CLIP: tech_master(); return 1; + case G_BPM: tech_global(); return 1; + default: return 0; + } +} diff --git a/tests/ui_render.c b/tests/ui_render.c index 8ced10f1..4f39906f 100644 --- a/tests/ui_render.c +++ b/tests/ui_render.c @@ -648,7 +648,7 @@ enum { S_HOME, S_HOME_IDLE, S_MESSAGE, S_MESSAGE_KEY, S_MESSAGE_NOFILE, S_PRESET S_NAME_USER, S_NAME_TYPING, S_NAME_123, S_NAME_EMPTY, S_NAME_FULL, S_NAME_PLAYING, S_PROJECT_NAMED, S_SONG_NAMED, S_USER_FOOT, S_ROLL_EMPTY, S_ROLL_ACID, S_ROLL_CHORDS, S_ROLL_TIES, S_ROLL_LEN32, S_ROLL_HIGH, S_ROLL_LOW, S_ROLL_WIDE, S_ROLL_PLAYING, - S_ROLL_LOCKS, S_ROLL_LOCK_HELD, S_DRUM_LOCKS, S_DRUM_LOCK_HELD, S_MOTION_LOCKS, S_AUTO_LIST, S_AUTO_LIST_ADD, S_AUTO_LIST_DRUM, S_REC_LAYER, S_REC_LAYER_SET, S_REC_LAYER_SONG, S_MACRO_LAYER, S_MSEQ, S_DIST_PAGE, + S_ROLL_LOCKS, S_ROLL_LOCK_HELD, S_DRUM_LOCKS, S_DRUM_LOCK_HELD, S_MOTION_LOCKS, S_AUTO_LIST, S_AUTO_LIST_ADD, S_AUTO_LIST_DRUM, S_REC_LAYER, S_REC_LAYER_SET, S_REC_LAYER_SONG, S_MACRO_LAYER, S_MSEQ, S_DIST_PAGE, S_DLY2, S_REVERB2, S_CHORUS, S_MASTER, S_LFO_DEST, S_COUNTIN, S_COUNTIN2, S_MENU_AUDIO, S_HEAD_PLAY_REC, S_HEAD_REC_OTHER, S_HEAD_BPM_TURN, S_HEAD_BPM_LOCK, S_HEAD_BPM_LOCKED, S_HEAD_GLO_TURN, S_HEAD_DOWNBEAT, S_HEAD_BEAT_2, S_MOCK_HOME, S_MOCK_PRESETS, S_MOCK_SEQ, S_MOCK_DRUM, S_MOCK_MIXER, S_MOCK_DIALOG, S_MOCK_MENU, S_COUNT }; @@ -666,7 +666,7 @@ static const char *const S_NAME[S_COUNT] = {"home", "home_idle", "message", "mes "name_user", "name_typing", "name_123", "name_empty", "name_full", "name_playing", "project_named", "song_named", "user_foot", "roll_empty", "roll_acid", "roll_chords", "roll_ties", "roll_len32_p2", "roll_high", "roll_low", "roll_wide", "roll_playing", - "roll_locks", "roll_lock_held", "drum_locks", "drum_lock_held", "motion_locks", "auto_list", "auto_list_add", "auto_list_drum", "layer_rec", "layer_rec_set", "layer_rec_song", "layer_macro", "mseq", "dist", + "roll_locks", "roll_lock_held", "drum_locks", "drum_lock_held", "motion_locks", "auto_list", "auto_list_add", "auto_list_drum", "layer_rec", "layer_rec_set", "layer_rec_song", "layer_macro", "mseq", "dist", "dly2", "reverb2", "chorus", "master", "lfo_dest", "countin", "countin_2bars", "menu_audio", "head_play_rec", "head_rec_other", "head_bpm_turn", "head_bpm_lock", "head_bpm_locked", "head_glo_turn", "head_downbeat", "head_beat_2", "mock_home", "mock_presets", "mock_seq", "mock_drum", "mock_mixer", "mock_dialog", "mock_menu"}; @@ -861,6 +861,12 @@ static void setup(int s) break; } case S_DIST_PAGE: TSEL->p[P_DIST] = 70; TSEL->p[P_DTYPE] = 2; TSEL->p[P_DTONE] = 20; go_title("DIST"); break; + /* (JIANT 0.5) the technical graphs (ui_tech.c) */ + case S_DLY2: song.g[G_WIDTH] = 90; song.g[G_DPIT] = 5; song.g[G_DSPRY] = 60; go_title("DLY 2"); break; + case S_REVERB2: song.g[G_RMOD] = 80; song.g[G_RWIDE] = 100; go_title("REVERB 2"); break; + case S_CHORUS: song.g[G_CDEPTH] = 90; go_title("CHORUS"); break; + case S_MASTER: song.g[G_CLIP] = 60; song.g[G_PUNCH] = 50; song.g[G_DUCK] = 40; go_title("MASTER"); break; + case S_LFO_DEST: TSEL->p[P_LD_PIT] = 20; TSEL->p[P_LD_FLT] = -40; TSEL->p[P_LD_AMP] = 60; go_title("LFO DEST"); break; case S_MACRO_LAYER: /* M1: T1 CUT and T4's MRPH; M2: CLIP; M3 at 0, M4 none */ go_home(); ui.layer = LAYER_MACRO; macro_v[0] = 90; macro_v[1] = 40; macro_v[3] = 127;