mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 21:04:32 +01:00
(the owner: "todos los gráficos del sistema vengan del mismo motor así se achica el espacio que ocupan") - ui_gx.c, the pictures' shared engine: gx_col (heat cells), gx_sine, gx_chip, gx_keys. FX's DELAY (echo columns by FDBK, TIME apart, the one sounding yellow), REVERB (its tail as cells, a sweep), CHORUS (two sines at RATE) and SENDS drawn with it, still moving with the sound; DIST's and MASTER CLIP's curve one routine (fxg_curve); SCL KEY and CHORD keyboards through gx_keys; SAVE's chips through gx_chip. - The room: the V face (big numbers) gone, values in M; the count-in a line "4 3 2 1" (were four cells); FX > MASTER > EQ's curve (BT) gone; SAVE > TOOLS' picture a word; the lists' small beings a mark; LFO's orbit dots gone; ui_gx.c, editor_screen.c, seq_preview.c at minsize. Protected pictures untouched. - SEQ EDIT (SEQ held; the V10.8.52 patch applied): KNOB 1/2 the selection, 3 the ACTION, 4 its amount, D5 / OCT+ does it, F#5 UNDO / REDO named. New: GENERATE (the track's generator inside the selection only, KNOB 4 the genre, a new seed each time: "GEN TECHNO 5-8 #1791"; trackgen_make(lo, cnt)) and RANDOM (notes in the scale on a 1/4 1/8 1/16 1/32 grid, DRUM: hits). - Banners: GLO mutes ("T3 MUTED" / "KICK ON"), UNMUTE ALL ("ALL UNMUTED"), SCL ROOT ("ROOT D"), REC B3 ("QUANTIZE ON"). - tests: ui_test's SEQ TOOLS checks rewritten for SEQ EDIT (selection, STRETCH/SQUEEZE/REPEAT, DUP, REVERSE, ROTATE, CLEAR, CLR AUTO, UNDO/REDO key, GENERATE, RANDOM, LEDs), the count-in's figures; track_generator_test for trackgen_make(0, 0). Layout recorded again (FELUCCA_REPIN=keep); the plain build passes. Image 584308 of 584336 (28 B free), BT segment 73724 of 73728, RAM code unchanged (32688). audio.c as V23's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
573 lines
29 KiB
C
573 lines
29 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) */
|
|
/* (0.8.5) SAVE's lens (ui.c save_*): the panels of its three levels, drawn as the approved HTML mock-up (SAVE, the
|
|
* proposal "LENTE"), in the lens's panel (240 x 140 at y 84; the mock-up's coordinates less 84). Included by
|
|
* ui_graph.c.
|
|
* LIBRARY PROJECT: the eight projects as tiles (4 x 2, 56 x 66): the number, the name (its section A's), its four
|
|
* sections as chips A..D (stored: the section's colour; empty: dark), the project shown TINT with a THEME
|
|
* frame, its section picked framed TEXT. TOOLS: the six tools as rows (the one picked TINT).
|
|
* PROJECT the project's four sections large (stored: their colour, the one picked full with a TEXT frame, the
|
|
* others half; the music's: NOW), ARRANGE and the song's rows as chips ("A16"; a scene: a dot; ARRANGE's
|
|
* row picked full and framed), the song as a strip (its rows by their bars, the one picked full; playing:
|
|
* a TEXT line where it is) and its length and END under it.
|
|
* SOUND the track's being (its engine's species, its HOME knobs, moving with its sound) with the track and its
|
|
* sound under it; USER: the 32 slots (4 x 8; a stored one its engine's being small and its name, the one
|
|
* picked TINT with a THEME frame); PRESETS: the sounds around the one loaded (TINT), their engine at the
|
|
* right, a favourite's star.
|
|
* The other projects' sections and names come from their flash headers (project.c lib_scan), one project a frame,
|
|
* cached here until a project is written, loaded or renamed (lib_gen). */
|
|
/* a section's chip colour: stored, its colour (half: mixed with BG); empty: BG */
|
|
static uint16_t lz_sec(uint32_t s, int used, int half)
|
|
{
|
|
uint16_t c = used ? sec_col(s) : half < 0 ? ux_mix(T_BG, T_RAISE, 50) : T_BG;
|
|
return used && half ? ux_mix(T_BG, c, 50) : c;
|
|
}
|
|
#define LZ_TX(c) (4 + (int32_t)(c) * 117 / 2) /* four columns of 56 px, 58 or 59 apart (the mock-up's 58.5) */
|
|
static void graph_lib(void)
|
|
{
|
|
uint32_t i, j;
|
|
for (i = 0; i < NSONG; i++) {
|
|
int32_t x = LZ_TX(i % 4u), y = (int32_t)(i / 4u) * 70;
|
|
int cur = i == song_cur && !song_draft;
|
|
int pick = i == song_save_target;
|
|
uint16_t bg = pick ? T_TINT : T_RAISE;
|
|
char b[4], nm[13];
|
|
cv_rect(x, y, 56, 66, bg);
|
|
if (pick)
|
|
cv_frame(x, y, 56, 66, T_THEME);
|
|
fmt_int(b, (int32_t)i + 1);
|
|
GFX_HOOK_ALIGN(0, y + 3, 0, y + 14, AL_V | AL_PASS, "library tile number");
|
|
cv_text_on(x + 4, y + 3, &AF_X, b, cur ? T_THEME : T_DIM, bg);
|
|
if (cur)
|
|
str_cpy(nm, graph_project_used(0) ? graph_project_name(0) : "", sizeof nm);
|
|
else
|
|
str_cpy(nm, lib.name[i], sizeof nm);
|
|
if (!nm[0] && (cur ? graph_project_used(0) : (lib.mask[i] & 1u)))
|
|
str_cpy(nm, "USED", sizeof nm);
|
|
cv_clip_text(x + 4, y + 14, &AF_X, nm[0] ? nm : "--", nm[0] ? T_TEXT : T_DIM, bg, 50);
|
|
for (j = 0; j < 4u; j++) {
|
|
int32_t sx = x + 4 + (int32_t)(j % 2u) * 25, sy = y + 28 + (int32_t)(j / 2u) * 18;
|
|
int used = cur ? graph_project_used(j) : (int)((lib.mask[i] >> j) & 1u);
|
|
uint16_t c = lz_sec(j, used, 0);
|
|
char l[2] = {(char)('A' + j), 0};
|
|
gx_chip(sx, sy, 23, 15, c, l, used ? T_INK : T_DIM);
|
|
if (cur && (int32_t)j + 1 == song.g[G_SLOT])
|
|
cv_frame(sx - 1, sy - 1, 25, 17, T_TEXT);
|
|
}
|
|
}
|
|
}
|
|
/* (V10.24, the user's pick A) TOOLS by scope: at the left a picture of what the action takes (the steps, the sound's
|
|
* wave, the song's rows, everything), at the right the scope's actions; under them a bar fills while OCT+ is held */
|
|
static __attribute__((noinline)) void graph_lz_tools(void)
|
|
{
|
|
static const char *const WHAT[6] = {"CLEAR PROJECT", "CLEAR SEQ", "INIT SOUND", "DELETE ROW", "CLEAR SONG", "CPU TEST"};
|
|
static const char *const ON[6] = {"EVERYTHING", "STEPS + AUTO", "ENGINE DEFAULT", "", "ALL ROWS", "HEAVY SONG"};
|
|
uint32_t a = ui.act ? ui.act - 1u : 0u, sc = TL_SC[a], c, n = 0, h = graph_h(), i;
|
|
int32_t hold = tl_t0 ? (int32_t)(fm1_ms - tl_t0) * 232 / (int32_t)TL_HOLD : 0;
|
|
uint16_t col = !ui.act ? T_DIM : sc == 1u ? T_THEME : sc == 2u ? T_ACCENT : sc == 3u ? T_MID : T_TEXT;
|
|
char b[12];
|
|
{ /* what the action takes, a word in its scope's colour (V10.8.53: its picture, the steps, a wave, the rows, gone) */
|
|
static const char *const SCW[5] = {"PROJECT", "TRACK", "SOUND", "SONG", "SYSTEM"};
|
|
cv_frame(4, 4, 76, 76, col);
|
|
cv_text_in(4, 38, 76, &AF_X, SCW[sc % 5u], col, T_SURF);
|
|
}
|
|
for (c = 0; c < 6u; c++) { /* the scope's actions */
|
|
int32_t y = 4 + (int32_t)n * 26;
|
|
int sel = ui.act == c + 1u;
|
|
uint16_t bg = sel ? T_TINT : T_SURF;
|
|
if (TL_SC[c] != sc) continue;
|
|
n++;
|
|
cv_rect(88, y, 148, 24, bg);
|
|
GFX_HOOK_ALIGN(0, y, 0, y + 12, AL_V, "tools row text centred up/down");
|
|
cv_text_on(94, y + CAP_IN(M, 14), &AF_M, WHAT[c], sel ? T_TEXT : T_MID, bg);
|
|
if (c == 3u) { str_cpy(b, "ROW ", sizeof b); fmt_int(b + 4, (int32_t)ui.song_row + 1); }
|
|
cv_text(94, y + 15, &AF_X, c == 3u ? b : ON[c], sel ? T_MID : T_DIM);
|
|
}
|
|
cv_rect(4, (int32_t)h - 20, 232, 6, T_RAISE); /* OCT+ held: the bar */
|
|
if (hold > 0) cv_rect(4, (int32_t)h - 20, hold > 232 ? 232 : hold, 6, col);
|
|
if (ui.act > 1u) cv_text_in(4, (int32_t)h - 11, 232, &AF_X, "HOLD OCT+", T_MID, T_SURF); /* (V10.8.27: hints cut) */
|
|
}
|
|
/* the song's length and END ("120 BARS . LOOP") into b (24) */
|
|
static void song_len_txt(char *b, uint32_t total)
|
|
{
|
|
uint32_t end = SONG_END(&chain_config);
|
|
fmt_int(b, (int32_t)total);
|
|
str_cpy(b + str_len(b), " BARS \xB7 ", 9);
|
|
if (end == SONG_FOREVER) str_cpy(b + str_len(b), "END REPEAT", 11);
|
|
else if (end >= 2u) { uint32_t k = str_len(b); b[k] = 'x'; fmt_int(b + k + 1u, (int32_t)end); }
|
|
else str_cpy(b + str_len(b), "STOP", 6);
|
|
}
|
|
static uint32_t song_bars(uint32_t s) /* the song's bars (s 4), part s's in it */
|
|
{
|
|
uint32_t i, t = 0;
|
|
for (i = 0; i < chain_config.count; i++)
|
|
if (s > 3u || chain_config.row[i].slot == s) t += chain_config.row[i].bars;
|
|
return t;
|
|
}
|
|
/* (V10.6o) the song as a strip of blocks at y, h high in x 4..236 (a row its bars wide, its part's colour; hl: the part
|
|
* lit, the others half; 4 all lit, 5 the cursor's, 6 none; the cursor's framed on PARTS; tl: TIMELINE's, a row with
|
|
* tracks of its own (FROM, VAR) half below, its letter and bars, the cursor's framed twice); playing, a line where it is */
|
|
static void song_strip(int32_t y, int32_t h, uint32_t hl, int tl)
|
|
{
|
|
uint32_t i, n = chain_config.count, t = song_bars(4u), acc = 0, played = 0;
|
|
char b[8];
|
|
for (i = 0; i < n && t; i++) {
|
|
const chain_row_t *rw = &chain_config.row[i];
|
|
uint32_t sl = rw->slot & 3u;
|
|
int32_t x = 4 + (int32_t)(acc * 232u / t), w = 4 + (int32_t)((acc + rw->bars) * 232u / t) - x - 1;
|
|
uint16_t c = lz_sec(sl, 1, hl < 4u ? sl != hl : hl != 4u && (hl == 6u || i != ui.song_row));
|
|
if (w < 1) w = 1;
|
|
cv_rect(x, y, w, h, c);
|
|
if (tl) {
|
|
if (song_idx.tsrc[song_cur][i] || song_idx.tvar[song_cur][i])
|
|
cv_rect(x, y + h - 4, w, 4, ux_mix(T_SURF, c, 50));
|
|
if (w >= 12) {
|
|
b[0] = (char)('A' + sl); b[1] = 0;
|
|
if (w >= 24) fmt_int(b + 1, rw->bars);
|
|
GFX_HOOK_ALIGN(0, y, 0, y + h - 4, AL_V | AL_PASS, "timeline block letter");
|
|
cv_text_on(x + 3, y + CAP_IN(X, h - 4), &AF_X, b, T_INK, c);
|
|
}
|
|
}
|
|
if (i == ui.song_row && (tl || hl < 4u)) {
|
|
cv_frame(x - 1, y - 1, w + 2, h + 2, T_TEXT);
|
|
if (tl) cv_frame(x, y, w, h, T_TEXT);
|
|
}
|
|
if (chain.running && i < chain.row) played += rw->bars;
|
|
acc += rw->bars;
|
|
}
|
|
if (chain.running && chain.row < n && t) {
|
|
played += chain_config.row[chain.row].bars - chain.remaining;
|
|
cv_rect(4 + (int32_t)(played * 232u / t), y - 2, 1, h + 4, T_TEXT);
|
|
}
|
|
}
|
|
/* (V10.6o, the owner's mock-up A) PARTS: the four sections as cards (2 x 2, their colours): the letter, the name (else
|
|
* GENE's or PART), its bars in the song, its tracks that play (six marks); KNOB 1's ringed, the one looping a ring
|
|
* pulsing; under them the song, the part's rows lit (the cursor's, OCT-'s, framed) */
|
|
static void graph_parts(void)
|
|
{
|
|
uint32_t s, k;
|
|
char b[24];
|
|
for (s = 0; s < 4u; s++) {
|
|
int32_t x = 4 + (int32_t)(s & 1u) * 118, y = 2 + (int32_t)(s >> 1) * 52;
|
|
int used = graph_project_used(s), loop = used && live.cur == (int8_t)s && song.playing && !chain.running;
|
|
uint16_t c = used ? sec_col(s) : T_RAISE, ink = used ? T_INK : T_DIM;
|
|
const char *nm = graph_project_name(s);
|
|
cv_rect(x, y, 114, 48, c);
|
|
b[0] = (char)('A' + s); b[1] = 0;
|
|
cv_text_on(x + 6, y + 4, &AF_M, b, ink, c);
|
|
if (used && song_bars(s)) { /* (its bars in the song) */
|
|
fmt_int(b, (int32_t)song_bars(s));
|
|
str_cpy(b + str_len(b), " BARS", 6);
|
|
cv_text_r(x + 109, y + 5, &AF_X, b, ink, c);
|
|
}
|
|
cv_free_text(x + 6, y + 22, &AF_X, !used ? "EMPTY" : nm[0] ? nm : (dice_secs >> s) & 1u ? "GENE" : "PART", ink, c, 102);
|
|
for (k = 0; used && k < NTRK; k++) /* the tracks that play in it */
|
|
cv_rect(x + 6 + (int32_t)k * 17, y + 37, 15, 5, (part_play.b[s] >> k) & 1u ? ink : ux_mix(c, T_INK, 30));
|
|
if (s == ui.part || loop) {
|
|
uint16_t rc = loop && (anim_fr / 8u) & 1u ? T_THEME : T_TEXT;
|
|
cv_frame(x - 2, y - 2, 118, 52, rc);
|
|
if (s == ui.part) cv_frame(x - 1, y - 1, 116, 50, rc);
|
|
}
|
|
}
|
|
if (chain_config.count)
|
|
song_strip(110, 10, ui.part & 3u, 0);
|
|
else
|
|
cv_text(4, 110, &AF_X, "NO SONG ROWS", T_DIM);
|
|
}
|
|
/* (V10.6s, the owner's mock-up C) CLIPS: the six tracks x the four parts, a cell a track's pattern in a part (its part's
|
|
* colour calm where it plays there, grey where silent or the part empty); the part each track sounds framed in its
|
|
* colour, the cell asked for (in on the next bar) framed dashed (a stop: the sounding frame dashed); the cell KNOB 1 / 2
|
|
* pick ringed; SONG REC on the right */
|
|
static void clip_dash(int32_t x, int32_t y, uint16_t c) /* a cell's frame, dashed */
|
|
{
|
|
int32_t i;
|
|
for (i = 0; i < 50; i += 4) {
|
|
cv_rect(x + i, y, 2, 2, c); cv_rect(x + i, y + 13, 2, 2, c);
|
|
if (i < 15) { cv_rect(x, y + i, 2, 2, c); cv_rect(x + 48, y + i, 2, 2, c); }
|
|
}
|
|
}
|
|
/* (V10.8, V10.8.2 the owner's mock-up D2) the JAM take: each track a lane, its sequences' colours as they sounded (REC:
|
|
* as it grows), the player's over it in LOCK white till the take's next change there; LOCK: where it plays; sel: a
|
|
* change ringed (TAKE) */
|
|
static int jam_full(void) { return live.srec == 2u || jam_tr || (jam_lock && jam_len()); }
|
|
static void jam_lanes(int32_t y, int32_t dy, int32_t h, int32_t sel)
|
|
{
|
|
uint32_t len = jam_len(), k, i, x0, x1, xe = 236u, xp = 0, s, p, e, rel = 0, nx;
|
|
if (live.srec == 2u) { /* (REC: the take so far, a bar more) */
|
|
p = gl_step_at(0) - jam_t0;
|
|
len = (p / 16u + 1u) * 16u;
|
|
xe = 24u + p * 212u / len;
|
|
} else if (jam_lock && song.playing && len) {
|
|
rel = (gl_step_at(0) - jam_base) % len;
|
|
xp = 24u + rel * 212u / len;
|
|
}
|
|
if (!len) return;
|
|
for (k = 0; k < NTRK; k++, y += dy) {
|
|
for (x0 = 24, s = 0, nx = 0, i = 0; i < JAM_N && (e = live.jam[i]) && JE_K(e) != 7u; i++) {
|
|
if (JE_K(e) != k) continue;
|
|
p = JE_POS(e);
|
|
x1 = 24u + (p < len ? p : len) * 212u / len;
|
|
if (x1 > x0) cv_rect((int32_t)x0, y, (int32_t)(x1 - x0), h, sec_col(s));
|
|
if (!nx && p > rel) nx = x1;
|
|
if ((int32_t)i == sel) cv_frame((int32_t)x1 - 2, y - 2, 4, h + 4, T_TEXT);
|
|
x0 = x1; s = JE_S(e);
|
|
}
|
|
if (xe > x0) cv_rect((int32_t)x0, y, (int32_t)(xe - x0), h, sec_col(s));
|
|
if (xp && ((jam_vos >> k) & 1u)) { /* (the player's, over the take: YOU, white to its next change) */
|
|
if (!nx || nx < xp) nx = 236u;
|
|
cv_rect((int32_t)xp, y, (int32_t)(nx - xp), h, T_TEXT);
|
|
if (h > 8) cv_text((int32_t)xp + 2, y + CAP_IN(X, h), &AF_X, "YOU", T_BG);
|
|
}
|
|
}
|
|
if (xp) cv_rect((int32_t)xp, y - dy * NTRK - 2, 1, dy * NTRK + 2, T_TEXT);
|
|
}
|
|
static void graph_clips(void) /* (V10.8.2) and TAKE: the take full screen, the change picked */
|
|
{ /* ringed, its track lit */
|
|
uint32_t s, k, i, tk = SONG_TAKE(cur_page()), full = tk || jam_full(), hi = song.sel;
|
|
char b[3] = "T1";
|
|
if (tk) { if (take_i >= jam_end()) take_i = 0; hi = JE_K(live.jam[take_i]); }
|
|
if (live.srec || jam_tr)
|
|
cv_text(4, 2, &AF_X, "REC", T_ACCENT);
|
|
for (k = 0; k < NTRK; k++) {
|
|
int32_t y = 13 + (int32_t)k * 18;
|
|
b[1] = (char)('1' + k);
|
|
cv_text(4, y + CAP_IN(X, 15), &AF_X, b, trk_col(k)); /* (V10.8.10: the track's colour; the one picked marked) */
|
|
if (k == hi) cv_rect(0, y + 2, 2, 11, trk_col(k));
|
|
for (s = 0; s < 4u && !full; s++) {
|
|
int32_t x = 24 + (int32_t)s * 53;
|
|
uint16_t c = sec_col(s);
|
|
int used = graph_project_used(s);
|
|
if (!k) { /* (the parts' letters over them) */
|
|
char l[2] = {(char)('A' + s), 0};
|
|
cv_text(x + 22, 2, &AF_X, l, used ? c : T_DIM);
|
|
}
|
|
cv_rect(x, y, 50, 15, lz_sec(s, used && (part_play.b[s] >> k) & 1u, -1 + 2 * (used && (part_play.b[s] >> k) & 1u)));
|
|
if (clip_now[k] == s + 1u) {
|
|
if (clip_go[k] == CLIP_STOP) clip_dash(x, y, c);
|
|
else { cv_frame(x, y, 50, 15, c); cv_frame(x + 1, y + 1, 48, 13, c); }
|
|
} else if (clip_go[k] == s + 1u)
|
|
clip_dash(x, y, c);
|
|
if (k == song.sel && s == ui.part)
|
|
cv_frame(x - 2, y - 2, 54, 19, T_TEXT);
|
|
}
|
|
}
|
|
if (full) {
|
|
jam_lanes(13, 18, 15, tk ? (int32_t)take_i : -1);
|
|
if (tk && take_i < jam_end()) { /* (TAKE: the change's bar, its track's 16ths as they sound) */
|
|
uint32_t b = JE_POS(live.jam[take_i]) & ~15u, q, kk = JE_K(live.jam[take_i]);
|
|
for (q = 0; q < 16u; q++) {
|
|
for (s = 0, i = 0; i < JAM_N && live.jam[i] && JE_K(live.jam[i]) != 7u; i++)
|
|
if (JE_K(live.jam[i]) == kk && JE_POS(live.jam[i]) <= b + q) s = JE_S(live.jam[i]);
|
|
cv_rect(24 + (int32_t)q * 13, 124, 12, 12, sec_col(s));
|
|
if (b + q == JE_POS(live.jam[take_i])) cv_frame(23 + (int32_t)q * 13, 123, 14, 14, T_TEXT);
|
|
}
|
|
}
|
|
} else if (jam_len())
|
|
jam_lanes(120, 3, 2, -1);
|
|
}
|
|
/* (V10.6o, the owner's mock-up B) TIMELINE: the song as blocks (the cursor's row framed), what plays; under it the row
|
|
* opened: each track's bar (its own part's colour calm, another part's bright with FROM and its letter,
|
|
* MUTE dark, silent in its part --), its VAR on the right; ALGORITHM's track lit */
|
|
static uint32_t tl_muted(uint32_t r, uint32_t k)
|
|
{
|
|
uint32_t j = r + 1u;
|
|
const scene_t *sc;
|
|
if (row_var(r, k) == RV_MUTE) return 1;
|
|
while (j-- > 0u && !song_idx.scene[song_cur][j].on) {}
|
|
if (j > r) return 0;
|
|
sc = &song_idx.scene[song_cur][j];
|
|
return k < 4u ? (sc->mute >> k) & 1u : (sc->on >> (k - 3u)) & 1u;
|
|
}
|
|
static __attribute__((noinline)) void graph_tl(void)
|
|
{
|
|
uint32_t n = chain_config.count, r = ui.song_row < n ? ui.song_row : n - 1u, k;
|
|
char b[24];
|
|
if (!n) {
|
|
cv_text_in(4, 60, 232, &AF_X, "NO ROWS", T_MID, T_SURF);
|
|
return;
|
|
}
|
|
song_strip(3, 18, 4u, 1);
|
|
if (chain.running && !chain.loop) {
|
|
str_cpy(b, chain.hold ? "LOOP ROW " : "ROW ", sizeof b);
|
|
fmt_int(b + str_len(b), (int32_t)chain.row + 1);
|
|
} else b[0] = 0;
|
|
cv_text(4, 25, &AF_X, b, chain.hold ? T_THEME : T_DIM);
|
|
song_len_txt(b, song_bars(4u));
|
|
cv_text_r(236, 25, &AF_X, b, T_DIM, T_SURF);
|
|
for (k = 0; k < NTRK; k++) {
|
|
int32_t y = 38 + (int32_t)k * 14;
|
|
uint32_t sl = chain_config.row[r].slot & 3u, src = row_src(r, k, sl), v = row_var(r, k), mu = tl_muted(r, k);
|
|
uint32_t on = !mu && ((part_play.b[src] >> k) & 1u);
|
|
uint16_t c = src != sl ? sec_col(src) : lz_sec(src, 1, 1), ink = src != sl ? T_INK : T_TEXT;
|
|
b[0] = 'T'; b[1] = (char)('1' + k); b[2] = 0;
|
|
GFX_HOOK_ALIGN(0, y, 0, y + 12, AL_V | AL_PASS, "timeline track row");
|
|
cv_text(4, y + CAP_IN(X, 12), &AF_X, b, k == song.sel ? T_THEME : T_MID);
|
|
if (k == song.sel) cv_rect(0, y + 2, 2, 8, T_THEME);
|
|
if (!on) {
|
|
cv_frame(24, y, 212, 12, T_DIM);
|
|
cv_text(28, y + CAP_IN(X, 12), &AF_X, mu ? "MUTE" : "--", T_DIM);
|
|
} else {
|
|
cv_rect(24, y, 212, 12, c);
|
|
if (src != sl) {
|
|
str_cpy(b, "FROM ", sizeof b); b[5] = (char)('A' + src);
|
|
cv_text_on(28, y + CAP_IN(X, 12), &AF_X, b, ink, c);
|
|
}
|
|
}
|
|
if (v > RV_MUTE) {
|
|
cv_rect(195, y + 1, 1, 10, T_SURF);
|
|
cv_rect(196, y + 1, 39, 10, T_ACCENT);
|
|
GFX_HOOK_ALIGN(196, y + 1, 235, y + 11, AL_HV, "timeline variation chip");
|
|
cv_text_in(196, y + 1 + CAP_IN(X, 10), 39, &AF_X, RV_NAME[v < RV_N ? v : 0], T_INK, T_ACCENT);
|
|
}
|
|
}
|
|
cv_text(4, 128, &AF_X, "KEYS: F3-D4 MUTE \xB7 F4-B4 FROM", T_MID);
|
|
}
|
|
/* (V10.8.14, the owner's "partitura viva") ARRANGE and GENE: the song as blocks as wide as their bars (32 bars at most
|
|
* on the screen, round the playhead or the row picked), the parts' strip on top (the row picked, GENE the row playing,
|
|
* its part's colour, the others dim; its bars when not 4), a lane a track in its colour, a part's letter only where the
|
|
* track plays another part than its row's (a VAR MUTE: an empty frame); the playhead a white line */
|
|
static void graph_score(int gen)
|
|
{
|
|
uint32_t n = chain_config.count, t = 0, i, k, acc, play = 0, f = 0, W, w0 = 0;
|
|
uint32_t sel = gen ? (chain.running ? chain.row : 255u) : ui.song_row;
|
|
char b[8];
|
|
for (i = 0; i < n; i++) {
|
|
if (i < sel) f += chain_config.row[i].bars;
|
|
if (chain.running && i < chain.row) play += chain_config.row[i].bars;
|
|
t += chain_config.row[i].bars;
|
|
}
|
|
if (chain.running && chain.row < n) play += chain_config.row[chain.row].bars - chain.remaining;
|
|
if (chain.running) f = play;
|
|
W = t < 32u ? t : 32u;
|
|
if (t > W) w0 = f > 8u ? f - 8u : 0u;
|
|
if (w0 + W > t) w0 = t - W;
|
|
for (k = 0; k < NTRK; k++) {
|
|
b[0] = 'T'; b[1] = (char)('1' + k); b[2] = 0;
|
|
cv_text(4, 21 + (int32_t)k * 16, &AF_X, b, trk_col(k));
|
|
}
|
|
for (i = 0, acc = 0; i < n && W; acc += chain_config.row[i].bars, i++) {
|
|
const chain_row_t *r = &chain_config.row[i];
|
|
uint32_t s = r->slot & 3u, a = acc > w0 ? acc : w0, e = acc + r->bars < w0 + W ? acc + r->bars : w0 + W;
|
|
int32_t x, w;
|
|
uint16_t c = sec_col(s), cf;
|
|
if (acc + r->bars <= w0 || acc >= w0 + W)
|
|
continue;
|
|
x = 24 + (int32_t)((a - w0) * 212u / W);
|
|
w = 24 + (int32_t)((e - w0) * 212u / W) - x - 1;
|
|
if (w < 1) w = 1;
|
|
cf = i == sel ? c : ux_mix(T_SURF, c, 40);
|
|
b[0] = w >= 9 ? (char)('A' + s) : 0; b[1] = 0;
|
|
if (w >= 18 && r->bars != 4u) fmt_int(b + 1, r->bars);
|
|
gx_chip(x, 2, w, 14, cf, b, i == sel ? T_INK : T_TEXT);
|
|
if (song_idx.scene[song_cur][i].on) cv_rect(x + w - 3, 4, 2, 2, T_TEXT); /* a scene: a dot */
|
|
for (k = 0; k < NTRK; k++) {
|
|
int32_t y = 19 + (int32_t)k * 16;
|
|
uint32_t src = row_src(i, k, s);
|
|
uint16_t tc = trk_col(k);
|
|
if (row_var(i, k) == RV_MUTE) {
|
|
cv_frame(x, y, w, 12, ux_mix(T_SURF, tc, 30));
|
|
continue;
|
|
}
|
|
cv_rect(x, y, w, 12, ux_mix(T_SURF, tc, i == sel ? 60 : 24));
|
|
if (src != s && w >= 9) { /* another part: its letter in a pill of its colour */
|
|
b[0] = (char)('A' + src); b[1] = 0;
|
|
gx_chip(x + w / 2 - 5, y, 11, 12, sec_col(src), b, T_INK);
|
|
}
|
|
}
|
|
}
|
|
if (chain.running && play >= w0 && play <= w0 + W && W)
|
|
cv_rect(24 + (int32_t)((play - w0) * 212u / W), 0, 1, 114, T_TEXT);
|
|
if (gen)
|
|
return;
|
|
if (!n) {
|
|
cv_text_in(4, 128, 232, &AF_X, "NO ROWS", T_MID, T_SURF);
|
|
return;
|
|
}
|
|
if (ui.song_row < n) { /* the row picked: ROW n/N . its part and bars */
|
|
char v[24] = "ROW ";
|
|
fmt_int(v + 4, (int32_t)ui.song_row + 1);
|
|
k = str_len(v); v[k++] = '/'; fmt_int(v + k, (int32_t)n);
|
|
k = str_len(v); v[k++] = ' '; v[k++] = '\xB7'; v[k++] = ' '; v[k++] = (char)('A' + (chain_config.row[ui.song_row].slot & 3u));
|
|
fmt_int(v + k, chain_config.row[ui.song_row].bars);
|
|
cv_text(4, 128, &AF_X, v, T_TEXT);
|
|
} else
|
|
cv_text(4, 128, &AF_X, "END", T_THEME);
|
|
{
|
|
char v[24];
|
|
song_len_txt(v, t);
|
|
cv_text_r(236, 128, &AF_X, v, T_MID, T_SURF);
|
|
}
|
|
}
|
|
/* PROJECT: the sections, the arrangement's chips, the song's strip (V10.8.18: ARRANGE's own, ar, gone: graph_score) */
|
|
static uint8_t proj_nofoot; /* (gen.c: GENE draws its own words where the song's length stands) */
|
|
static void graph_proj(void)
|
|
{
|
|
uint32_t i, total = 0, sel = (uint32_t)song.g[G_SLOT] - 1u, n = chain_config.count;
|
|
char b[24];
|
|
for (i = 0; i < 4u; i++) {
|
|
int32_t x = LZ_TX(i);
|
|
int used = graph_project_used(i), pick = i == (sel & 3u);
|
|
uint16_t c = lz_sec(i, used, used ? !pick : -1), ink = used ? T_INK : T_DIM;
|
|
const char *nm = graph_project_name(i);
|
|
b[0] = (char)('A' + i); b[1] = 0;
|
|
cv_rect(x, 2, 56, 49, c);
|
|
GFX_HOOK_ALIGN(0, 8, 0, 19, AL_V | AL_PASS, "project section letter");
|
|
cv_text_on(x + 6, 4, &AF_M, b, ink, c);
|
|
if (used && !nm[0]) { /* (V10.8.47, the owner) no name: its bars in the song ("0 BARS": in no row) */
|
|
fmt_int(b, (int32_t)song_bars(i));
|
|
str_cpy(b + str_len(b), " BARS", 6);
|
|
nm = b;
|
|
}
|
|
cv_free_text(x + 6, 25, &AF_X, used ? nm : "EMPTY", ink, c, 47);
|
|
if (live.cur == (int8_t)i && used)
|
|
cv_text_r(x + 52, 38, &AF_X, "PLAYING", ink, c);
|
|
if (pick) { /* (2 px, round it) */
|
|
cv_frame(x - 2, 0, 60, 53, T_TEXT);
|
|
cv_frame(x - 1, 1, 58, 51, T_TEXT);
|
|
}
|
|
}
|
|
GFX_HOOK_ALIGN(0, 58, 0, 69, AL_V | AL_PASS, "project arrange title");
|
|
cv_text(6, 58, &AF_X, "ARRANGE PART+BARS", T_DIM);
|
|
for (i = 0; i < n && i < CHAIN_ROWS; i++) {
|
|
const chain_row_t *r = &chain_config.row[i];
|
|
int32_t x = 4 + (int32_t)(i % 8u) * 293 / 10, y = 72 + (int32_t)(i / 8u) * 22;
|
|
int used = graph_project_used(r->slot);
|
|
uint16_t c = used ? lz_sec(r->slot, 1, 1) : T_RAISE; /* (a row of an empty section: a well, its words DIM;
|
|
* DIM on the section's colour could not be read) */
|
|
b[0] = (char)('A' + (r->slot & 3u));
|
|
fmt_int(b + 1, r->bars);
|
|
cv_rect(x, y, 27, 20, c);
|
|
cv_text_in(x, y + CAP_IN(X, 20), 27, &AF_X, b, used ? T_INK : T_DIM, c);
|
|
if (song_idx.scene[song_cur][i].on) /* a scene: a dot */
|
|
cv_rect(x + 22, y + 3, 2, 2, T_TEXT);
|
|
if (song_idx.tsrc[song_cur][i] || song_idx.tvar[song_cur][i]) /* (add15) tracks of their own: a dot below */
|
|
cv_rect(x + 3, y + 15, 2, 2, T_TEXT);
|
|
total += r->bars;
|
|
}
|
|
song_strip(118, 6, 6u, 0); /* the song: its rows by their bars (V10.6o: song_strip's) */
|
|
if (proj_nofoot)
|
|
return;
|
|
song_len_txt(b, total);
|
|
GFX_HOOK_ALIGN(0, 128, 0, 139, AL_V | AL_PASS, "project song length");
|
|
cv_text_r(236, 128, &AF_X, n ? b : "NO ROWS", T_MID, T_SURF);
|
|
}
|
|
/* an engine's mark small at (cx, cy), r its half size, in c (V10.8.53: the being's outline gone, its room) */
|
|
static void lz_mini_being(uint32_t e, int32_t cx, int32_t cy, int32_t r, uint16_t c)
|
|
{
|
|
(void)e;
|
|
cv_rrect(cx - r, cy - r, 2 * r + 1, 2 * r + 1, r, c, cv_bg);
|
|
}
|
|
/* SOUND: the track's being (as an engine page's: its HOME knobs, alive with its sound), the track and its sound */
|
|
static void lz_track_being(void)
|
|
{
|
|
static uint32_t tm, f0;
|
|
const track_t *t = TSEL;
|
|
const genome_t *g = &GENOME[EGEN[trk_eng(t)]];
|
|
int32_t en = bg_energy();
|
|
bfeat_t f;
|
|
char b[20];
|
|
bg_feat(t, g, trk_engp(t)->knob, &f);
|
|
bg_excite(&f, en, 2);
|
|
if (en > 2) tm += (anim_fr - f0) * (uint32_t)(160 + en * 3);
|
|
f0 = anim_fr;
|
|
being_lines(g, &f, 42 * 16, 40 * 16, (8 * 16) * (256 + en / 3) / 256, en, tm); /* (its spikes inside 4 .. 82) */
|
|
b[0] = 'T'; b[1] = (char)('1' + song.sel % NTRK); b[2] = 0;
|
|
GFX_HOOK_ALIGN(4, 0, 82, 0, AL_H | AL_PASS, "sound track centred");
|
|
cv_text_in(4, 85, 78, &AF_X, b, T_THEME, T_SURF);
|
|
sound_name(t, b);
|
|
cv_free_text(42 - HALF_UP(text_w(&AF_X, b) < 76 ? text_w(&AF_X, b) : 76), 99, &AF_X, b, T_TEXT, T_SURF, 76);
|
|
}
|
|
static __attribute__((noinline)) void graph_sound(void)
|
|
{
|
|
uint32_t k;
|
|
lz_track_being();
|
|
for (k = 0; k < UP_SLOTS; k++) {
|
|
int32_t x = 88 + (int32_t)(k % 4u) * 37, y = 2 + (int32_t)(k / 4u) * 17;
|
|
int sel = k == ui.uslot, used = up_used(k);
|
|
uint16_t bg = sel ? T_TINT : T_RAISE;
|
|
char b[13];
|
|
cv_rect(x, y, 35, 15, bg);
|
|
if (used) {
|
|
lz_mini_being(up_engine(k), x + 5, y + 7, 3, bg_col(150));
|
|
up_name(k, b);
|
|
cv_clip_text(x + 10, y + CAP_IN(X, 15), &AF_X, b, T_TEXT, bg, 24);
|
|
} else {
|
|
up_slot_label(b, k);
|
|
gx_chip(x, y, 35, 15, bg, b, T_DIM);
|
|
}
|
|
if (sel)
|
|
cv_frame(x, y, 35, 15, T_THEME);
|
|
}
|
|
}
|
|
/* (V10.24, the user's pick A) PRESETS in two columns: at the left the engines (their being, how many presets), the
|
|
* selected track's lit; at the right the list (LIST's) around the sound, its engine named only when another's. KNOB 1
|
|
* plays each as it passes; OCT+ keeps it, OCT- brings back the sound from before the browse (ui_input.c br_undo) */
|
|
static __attribute__((noinline)) void graph_lz_presets(void)
|
|
{
|
|
uint32_t total, cur = preset_pos(&total), e, k, i, first, r, rc = 0, rows = (graph_h() - 2u) / 15u;
|
|
rows = rows > 9u ? 9u : rows;
|
|
for (r = 0; r < NENG_SHOWN; r++) if (eng_vis(r) == TSEL->eng_req) rc = r;
|
|
first = rc < rows / 2u ? 0u : rc - rows / 2u;
|
|
if (first + rows > NENG_SHOWN) first = NENG_SHOWN > rows ? NENG_SHOWN - rows : 0u;
|
|
for (r = first; r < NENG_SHOWN && r < first + rows; r++) {
|
|
int32_t y = 2 + (int32_t)(r - first) * 15;
|
|
int sel = r == rc;
|
|
char n[4];
|
|
e = eng_vis(r);
|
|
lz_mini_being(e, 9, y + 7, 3, sel ? bg_col(230) : ux_mix(bg_col(120), T_SURF, 45));
|
|
cv_clip_text(21, y + CAP_IN(X, 14), &AF_X, ENGINES[e]->name, sel ? T_TEXT : T_DIM, T_SURF, 46);
|
|
n[0] = 0; fmt_int(n, (int32_t)preset_shown(e));
|
|
cv_text_r(82, y + CAP_IN(X, 14), &AF_X, n, sel ? T_MID : T_DIM, T_SURF);
|
|
if (sel) cv_rect(0, y + 2, 2, 10, T_ACCENT);
|
|
}
|
|
cv_rect(86, 2, 1, (int32_t)rows * 15 - 2, T_DIM);
|
|
if (!total) {
|
|
cv_text_in(88, 63, 148, &AF_X, "NO FAVORITES", T_MID, T_SURF);
|
|
return;
|
|
}
|
|
first = cur < rows / 2u ? 0u : cur - rows / 2u;
|
|
if (total > rows && first + rows > total)
|
|
first = total - rows;
|
|
for (i = first; i < total && i < first + rows; i++) {
|
|
int32_t y = 2 + (int32_t)(i - first) * 15;
|
|
int sel = i == cur;
|
|
uint16_t bg = sel ? T_TINT : T_SURF;
|
|
char nm[13];
|
|
const char *en;
|
|
e = preset_at(i, &k);
|
|
if (e == NENGINES) {
|
|
up_name(k, nm);
|
|
en = "USER";
|
|
} else {
|
|
str_cpy(nm, ENGINES[e]->presets[k].name, sizeof nm);
|
|
en = ENGINES[e]->name;
|
|
}
|
|
if (sel)
|
|
cv_rect(90, y, 146, 14, bg);
|
|
GFX_HOOK_ALIGN(0, y, 0, y + 14, AL_V, "sound preset row centred up/down");
|
|
cv_free_text(96, y + CAP_IN(X, 14), &AF_X, nm, sel ? T_TEXT : T_MID, bg, 92);
|
|
if (favorite_has(e, k)) {
|
|
GFX_HOOK_ALIGN(0, y, 0, y + 14, AL_V, "sound preset star centred up/down");
|
|
cv_text_on(226, y + CAP_IN(S, 14), &AF_S, "*", T_ACCENT, bg); /* (a favourite; 0.8.5 no icons) */
|
|
}
|
|
if (e != TSEL->eng_req) { /* (another engine's: LIST crosses engines) */
|
|
GFX_HOOK_ALIGN(0, y, 0, y + 14, AL_V, "sound preset row centred up/down");
|
|
cv_text_r(220, y + CAP_IN(X, 14), &AF_X, eng_abbr(en), T_DIM, bg);
|
|
}
|
|
}
|
|
}
|
|
/* the lens's panel for the SAVE page shown */
|
|
static void graph_save_lz(const page_t *pg)
|
|
{
|
|
uint32_t lv = save_level();
|
|
if (pg->graph == GR_TOOLS) graph_lz_tools();
|
|
else if (SONG_TRK(pg)) graph_tl();
|
|
else if (SONG_PARTS(pg)) graph_parts();
|
|
else if (SONG_CLIPS(pg) || SONG_TAKE(pg)) graph_clips();
|
|
else if (pg->graph == GR_SONG) graph_score(0); /* (V10.8.14: ARRANGE's partitura viva) */
|
|
else if (pg->graph == GR_SLOTS) { if (lv == SV_PROJ) graph_proj(); else graph_lib(); }
|
|
else if (pg->graph == GR_USER) graph_sound();
|
|
else graph_lz_presets();
|
|
}
|
|
|