mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-05 12:24:42 +01:00
V10.8.53: the pictures' shared engine (room), SEQ EDIT with GENERATE and RANDOM, banners
(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
This commit is contained in:
19 files changed
+2448
-3044
No files matched your search
@@ -1,739 +0,0 @@
|
||||
SEQ EDIT (V10.8.52, parked: 3308 B over the app slot with everything below; apply with git apply on V10.8.52 and free the room first).
|
||||
SEQ held on a SEQ page: the roll / lane grid, K1 START (MOVE) K2 END (WIDTH) K3 ACTION K4 AMOUNT, OCT+ or D5 does it, OCT- or G3 ALL STEPS,
|
||||
A3 K1/K2 MOVE-WIDTH, B3-E4 BAR 1-4, F#5 UNDO/REDO; actions STRETCH SQUEEZE REPEAT NUDGE ROTATE SHIFT REVERSE DUP COPY PASTE CLEAR CLR AUTO CLR STEP
|
||||
VEL RND NOTE RND HUMANIZE TRANSP OCTAVE THIN INVERT STUTTER ARP MUTATE; the selection per track (clay_sp[2+track]).
|
||||
|
||||
diff -ru a/firmware/src/ui_input.c b/firmware/src/ui_input.c
|
||||
--- a/firmware/src/ui_input.c 2026-11-26 14:04:11.344289341 +0000
|
||||
+++ b/firmware/src/ui_input.c 2026-11-26 14:04:11.357522047 +0000
|
||||
@@ -862,10 +862,10 @@
|
||||
}
|
||||
|
||||
/* (V10.8.51) step keys held on SEQ's roll, two or more: "SEL 5-8", the range kept (cp_sel: its first | its last << 8, bit
|
||||
- * 15 on) for SEQ TOOLS' STRETCH SQUEEZE REPEAT (ui_tools.c tl_shape: once). Only a key pressed changes it (keys let go
|
||||
+ * 15 on) for SEQ EDIT (ui_tools.c se_do; V10.8.52: kept until SEQ EDIT's OCT- / G3, each track its own). Only a key pressed changes it (keys let go
|
||||
* keep it): two or more held, their range; one alone, none. (In clay.c's clay_sp, unused since V10.8.21: no RAM of its
|
||||
* own, nothing of the sound moved; [1] the bar's keys held the pass before) */
|
||||
-#define cp_sel (clay_sp[0])
|
||||
+#define cp_sel (clay_sp[2u + song.sel % NTRK]) /* (V10.8.52: the track's own, ui_tools.c sel_of) */
|
||||
static void sel_poll(void)
|
||||
{
|
||||
uint64_t m;
|
||||
Only in b/firmware/src: ui_input.c.orig
|
||||
diff -ru a/firmware/src/ui_layer.c b/firmware/src/ui_layer.c
|
||||
--- a/firmware/src/ui_layer.c 2026-11-26 14:04:11.338906016 +0000
|
||||
+++ b/firmware/src/ui_layer.c 2026-11-26 14:04:23.317622925 +0000
|
||||
@@ -61,7 +61,7 @@
|
||||
{B_SCL, LK_SET, FAM_SCL, "[SCL] SET", {{KC_KEYS, "ROOT"}, {KC_SCL, "DONE"}, {0, 0}}},
|
||||
{B_EDIT, LK_SET, FAM_EDIT, "[EDIT] SET", {{KC_SELECT, "DICE"}, {KC_K14, "TWEAK"}, {KC_KEYS, "INIT / RECALL"}}}, /* (0.9.9-seq2e:
|
||||
* KNOB 1..4 MOMENTARY: mom_knob; seq2f: SELECT the sound dice) */
|
||||
- {B_SEQ, LK_SET, FAM_SEQ, "[SEQ] TOOLS", {{KC_REC, "CLEAR ALL"}, {KC_SEQ, "DONE"}, {KC_PLAY, "RESYNC"}}}, /* (0.6.14: REC, all six
|
||||
+ {B_SEQ, LK_SET, FAM_SEQ, "[SEQ] EDIT", {{KC_OCTUP, "DO IT"}, {KC_OCTDN, "ALL STEPS"}, {KC_KEYS, "F#5 UNDO"}}}, /* (0.6.14: REC, all six
|
||||
* tracks cleared, shown: it was nowhere) */
|
||||
{B_REC, LK_SET, FAM_HOME, "[REC] SET", {{KC_KEYS, "RECORDING"}, {KC_REC, "DONE"}, {0, 0}}},
|
||||
{B_SAVE, LK_SET, FAM_HOME, "[SAVE] SONG", {{KC_KEYS, "PLAY"}, {KC_OCTUP, "SAVE"}, {KC_OCTDN, "RECALL"}}},
|
||||
@@ -491,29 +491,52 @@
|
||||
}
|
||||
}
|
||||
|
||||
-/* SEQ TOOLS: white key place p's action on the selected track (ui_tools.c), "SONG PLAYS: STOP IT TO EDIT" while a song plays */
|
||||
+/* (V10.8.52) SEQ EDIT's white keys (ui_tools.c): F3 CLEAR, G3 ALL (no selection), A3 KNOB 1 / 2 START END <-> MOVE
|
||||
+ * WIDTH, B3 .. E4 BAR 1 .. 4 selected, F4 CLR AUTO, G4 .. B4 the lane's (DRUM), C5 DUP, D5 the ACTION, E5 COPY, F5
|
||||
+ * PASTE, G5 CLR STEP; black: the lanes (DRUM), C#5 / D#5 NUDGE < / > (ui_tools.c se_do: the steps selected or all) */
|
||||
static void tools_key(uint32_t p)
|
||||
{
|
||||
- const char *m;
|
||||
- if (!tl_cell(TSEL, p))
|
||||
- return;
|
||||
- if (chain_busy()) {
|
||||
- ui_message("SONG PLAYS: STOP IT TO EDIT");
|
||||
- return;
|
||||
+ uint32_t len = tl_len(TSEL), a = p == 0u ? SE_CLEAR : p == 7u ? SE_CAUTO : p == 11u ? SE_DUP : p == 13u ? SE_COPY :
|
||||
+ p == 14u ? SE_PASTE : p == 15u ? SE_CSTEP : SE_N;
|
||||
+ if (a < SE_N) se_do(a, 0);
|
||||
+ else if (p == 1u) { cp_sel = 0; ui_message("ALL STEPS"); }
|
||||
+ else if (p == 2u) se_st ^= 128;
|
||||
+ else if (p == 12u) se_do((uint32_t)se_st & 127u, se_md);
|
||||
+ else if (p >= 3u && p <= 6u) {
|
||||
+ if ((p - 3u) * 16u >= len) ui_message("NO SUCH BAR");
|
||||
+ else sel_set((p - 3u) * 16u, (p - 3u) * 16u + 15u < len ? (p - 3u) * 16u + 15u : len - 1u);
|
||||
+ } else if (drum_track(TSEL) && !chain_busy()) {
|
||||
+ undo_mark();
|
||||
+ ui_message(tl_do(TSEL, p, ui.lane));
|
||||
}
|
||||
- if (!(m = tl_do(TSEL, p, ui.lane)))
|
||||
- return;
|
||||
- ui_message(m);
|
||||
ui.force = 1;
|
||||
}
|
||||
-
|
||||
-/* (V10.8.49, the owner) SEQ TOOLS' black C#5 / D#5: NUDGE the track's notes a 16th of a step earlier / later */
|
||||
+/* KNOB 1 START (MOVE), 2 END (WIDTH): the selection, 3 the ACTION, 4 its amount */
|
||||
+static void se_knob(uint32_t k, int32_t d)
|
||||
+{
|
||||
+ uint32_t len = tl_len(TSEL), lo, n, a, b, act = (uint32_t)se_st & 127u;
|
||||
+ d = d > 0 ? 1 : -1;
|
||||
+ (void)seq_sel(TSEL, &lo, &n, len);
|
||||
+ a = lo; b = lo + n - 1u;
|
||||
+ if (k == 2u) { act = (uint32_t)clamp((int32_t)act + d, 0, SE_N - 1); se_st = (int16_t)((se_st & 128) | act); se_md = SE[act].def; return; }
|
||||
+ if (k == 3u) { se_md = (int16_t)clamp(se_md + d, SE[act].lo, SE[act].hi); return; }
|
||||
+ if (se_st & 128) { /* MOVE, WIDTH */
|
||||
+ if (!k) a = (uint32_t)clamp((int32_t)a + d, 0, (int32_t)(len - 1u - (b - a))), b = a + n - 1u;
|
||||
+ else b = (uint32_t)clamp((int32_t)b + d, (int32_t)a, (int32_t)len - 1);
|
||||
+ } else if (!k) { a = (uint32_t)clamp((int32_t)a + d, 0, (int32_t)len - 1); if (b < a) b = a; }
|
||||
+ else { b = (uint32_t)clamp((int32_t)b + d, 0, (int32_t)len - 1); if (a > b) a = b; }
|
||||
+ sel_set(a, b);
|
||||
+ if (k) ui.bank = (uint8_t)(b / 16u);
|
||||
+}
|
||||
+/* (V10.8.49, the owner) SEQ TOOLS' black C#5 / D#5: NUDGE the notes (selected: theirs) a 16th of a step earlier / later */
|
||||
static void nudge_key(uint32_t up)
|
||||
{
|
||||
const char *m;
|
||||
+ uint32_t lo, n;
|
||||
if (chain_busy()) { ui_message("SONG PLAYS: STOP IT TO EDIT"); return; }
|
||||
undo_mark();
|
||||
- if ((m = tl_nudge(TSEL, up ? 4 : -4))) { ui_message(m); ui.force = 1; }
|
||||
+ (void)seq_sel(TSEL, &lo, &n, tl_len(TSEL));
|
||||
+ if ((m = tl_nudge(TSEL, up ? 4 : -4, lo, n, 0))) { ui_message(m); ui.force = 1; }
|
||||
}
|
||||
|
||||
/* Shared by GLO + G4 and REC + A3. One global undo/redo snapshot. */
|
||||
@@ -595,10 +618,6 @@
|
||||
#define SK_REC 13u
|
||||
#define SK_PAGE 15u
|
||||
#define SK_NAME 11u /* (0.9.2) C5: NAME, the slot's rename (EDIT's until 0.9.1) */
|
||||
-#define TL_COPY 13u
|
||||
-#define TL_PASTE 14u
|
||||
-#define TL_DUP 11u /* (V10.8.50) C5: DUP (ui_input.c cp_seq) */
|
||||
-#define TL_STEP 15u /* (0.9.2) SEQ's G5: CLR STEP (ui_input.c seq_clr_step) */
|
||||
static void song_key(uint32_t p)
|
||||
{
|
||||
uint32_t k;
|
||||
@@ -760,14 +779,12 @@
|
||||
if (!key_black(k) && p < 4u)
|
||||
rec_key(p);
|
||||
} else if (l == LAYER_SEQ) {
|
||||
- if (!key_black(k) && (p == TL_COPY || p == TL_PASTE || p == TL_DUP))
|
||||
- cp_seq(p == TL_DUP ? 2u : p - TL_COPY);
|
||||
- else if (!key_black(k) && p == TL_STEP)
|
||||
- seq_clr_step(); /* (0.9.2) G5: CLR STEP (AUTO LIST: the record) */
|
||||
- else if (!key_black(k))
|
||||
+ if (!key_black(k))
|
||||
tools_key(p);
|
||||
else if (p == 8u || p == 9u)
|
||||
nudge_key(p == 9u); /* (V10.8.49) C#5 / D#5: NUDGE < / > */
|
||||
+ else if (p == 10u)
|
||||
+ se_undo(); /* (V10.8.52) F#5: UNDO / REDO the last edit */
|
||||
else if (p < NLANE && drum_track(TSEL))
|
||||
ui.lane = (uint8_t)p; /* (black keys 1..8: the lane, as on the grid) */
|
||||
} else if (l == LAYER_SAVE && !key_black(k)) {
|
||||
@@ -805,6 +822,9 @@
|
||||
*vp = (int16_t)clamp(*vp + accel(EN_K1 + k, s, TP[P_LEVEL].max - TP[P_LEVEL].min), TP[P_LEVEL].min,
|
||||
TP[P_LEVEL].max);
|
||||
motion_capture(t, P_LEVEL, *vp);
|
||||
+ } else if (l == LAYER_SEQ) { /* (V10.8.52) SEQ EDIT */
|
||||
+ se_knob(k, s);
|
||||
+ ui.force = 1;
|
||||
} else if (l == LAYER_SAVE) { /* KNOB 1: the song (in when SAVE lets go); 2..4: none */
|
||||
if (k == 0u)
|
||||
lys.song = (uint8_t)(clamp((int32_t)(lys.song ? lys.song - 1u : song_cur) + (s > 0 ? 1 : -1), 0,
|
||||
@@ -868,6 +888,8 @@
|
||||
if (ui.ly && (pressed & (1u << dn | 1u << up)))
|
||||
lys.used = 1; /* (0.6.44: an OCT with it: no FX lock) */
|
||||
mine = oct & lys.oct;
|
||||
+ if (lys.l == LAYER_SEQ && mine) /* (V10.8.52) SEQ EDIT: OCT+ the ACTION, OCT- ALL STEPS */
|
||||
+ tools_key(mine & 2u ? 12u : 1u);
|
||||
if ((mine & 1u) && lys.l == LAYER_FX) { /* OCT- (FX LATCH): every effect and macro off */
|
||||
perf_latched = 0;
|
||||
perf_k[0] = perf_k[1] = perf_k[2] = perf_k[3] = 0;
|
||||
@@ -924,9 +946,9 @@
|
||||
} else if (l == LAYER_EDIT && p < NLANE && drum_track(TSEL)) { /* DRUM: a sound sounding lit, muted dark */
|
||||
on = !dx_lane_muted(p);
|
||||
} else if (l == LAYER_SEQ) { /* the tools breathe (not while a song plays); DRUM: the lane */
|
||||
- on = b && p < NLANE && drum_track(TSEL) && p == ui.lane; /* lit, the other lanes breathe */
|
||||
- can = b ? (p < NLANE && drum_track(TSEL)) || ((p == 8u || p == 9u) && !chain_busy()) : p == TL_COPY ? 1u : p == TL_PASTE || p == TL_DUP ? clip.n && !chain_busy() : tl_cell(TSEL, p) && !chain_busy() &&
|
||||
- (p != TL_CAUTO || motion_count(TSEL)); /* (CLR AUTO: automation to clear; REVERT: an anchor) */
|
||||
+ on = b ? p < NLANE && drum_track(TSEL) && p == ui.lane : p == 2u && (se_st & 128); /* lit, the other lanes breathe */
|
||||
+ can = b ? (p < NLANE && drum_track(TSEL)) || ((p == 8u || p == 9u) && !chain_busy()) :
|
||||
+ !chain_busy() && (p < 8u || p > 10u || drum_track(TSEL)) && (p != 14u || clip.n);
|
||||
} else if (l == LAYER_SAVE && !b) { /* the section playing lit, the saved ones and the */
|
||||
on = (p < SK_STORE && live.cur == (int8_t)p) || (p == SK_REC && live.srec) || /* actions breathe */
|
||||
(p == SK_MODE && live.mode);
|
||||
@@ -959,8 +981,6 @@
|
||||
static const uint8_t PK_BLK[11] = {1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 15}; /* a black key: left of white key n */
|
||||
enum { LS_OFF, LS_SEL, LS_HELD, LS_WAIT, LS_DIM, LS_MUTE };
|
||||
static const char *const GLO_GROUP[4] = {"KICK", "SNARE", "HAT", "PERC"};
|
||||
-static const char *const TL_NAME[TL_N] = {"CLEAR", "REVERSE", "SHIFT <", "SHIFT >", "STRETCH", "SQUEEZE", "REPEAT", "CLR AUTO",
|
||||
- "CLR", "REV", "FILL", "RND"};
|
||||
#define LMC_TW 140 /* MACRO's routes: their width (x 92 .. 232) */
|
||||
static uint32_t macro_routes(uint32_t m, char *b, uint32_t n)
|
||||
{
|
||||
@@ -1069,35 +1089,6 @@
|
||||
str_cpy(nm, p == LY_INIT ? (drum_track(TSEL) ? "INIT+KIT" : "INIT") : drum_track(TSEL) ? "RCL+KIT" : "RECALL", 12);
|
||||
return p == LY_RECALL ? (edit_recallable() ? LS_OFF : LS_DIM) : busy; /* (V10.6z8: RECALL in a song too) */
|
||||
}
|
||||
- if (l == LAYER_SEQ) {
|
||||
- if (blk) {
|
||||
- if (p < NLANE && drum_track(TSEL)) {
|
||||
- str_cpy(nm, drum_lane_abbr(TSEL, p), 12);
|
||||
- return p == ui.lane % NLANE ? LS_SEL : LS_OFF;
|
||||
- }
|
||||
- if (p == 8u || p == 9u) { /* (V10.8.49) NUDGE */
|
||||
- str_cpy(nm, p == 9u ? "NUDGE >" : "NUDGE <", 12);
|
||||
- return busy;
|
||||
- }
|
||||
- return LS_OFF;
|
||||
- }
|
||||
- if (p == TL_COPY || p == TL_PASTE || p == TL_DUP) {
|
||||
- str_cpy(nm,p == TL_COPY ? "COPY SEQ" : p == TL_DUP ? "DUP" : "PASTE SEQ",12);
|
||||
- return p != TL_COPY && (!clip.n || chain_busy()) ? LS_DIM : LS_OFF;
|
||||
- }
|
||||
- if (p == TL_STEP) { /* (0.9.2) G5 */
|
||||
- str_cpy(nm, cur_page()->graph == GR_EVENTS ? "DEL REC" : "CLR STEP", 12);
|
||||
- return busy;
|
||||
- }
|
||||
- if (!tl_cell(TSEL, p))
|
||||
- return LS_OFF;
|
||||
- str_cpy(nm, TL_NAME[p], 12);
|
||||
- if (p >= TL_LCLR) { /* the lane's: "CLR BD" */
|
||||
- str_cpy(nm + str_len(nm), " ", 2);
|
||||
- str_cpy(nm + str_len(nm), drum_lane_abbr(TSEL, ui.lane), 12 - str_len(nm));
|
||||
- }
|
||||
- return busy;
|
||||
- }
|
||||
if (l == LAYER_REC) {
|
||||
if (blk || p > 3u)
|
||||
return LS_OFF;
|
||||
@@ -1454,6 +1445,16 @@
|
||||
rec_columns();
|
||||
} else if (l == LAYER_EDIT) { /* (0.9.9-seq2f) ENG, No. (PRESETS), FAV (ui_draw.c) */
|
||||
engine_columns();
|
||||
+ } else if (l == LAYER_SEQ) { /* (V10.8.52) SEQ EDIT: START END (MOVE WIDTH), ACTION, AMOUNT */
|
||||
+ uint32_t lo, n, a = (uint32_t)se_st & 127u, on = (uint32_t)seq_sel(TSEL, &lo, &n, tl_len(TSEL)), mv = (uint32_t)se_st >> 7 & 1u;
|
||||
+ fmt_int(val, (int32_t)lo + 1);
|
||||
+ text_column(0, mv ? "MOVE" : "START", on ? val : "ALL", on ? VAL(0u) : T_DIM);
|
||||
+ fmt_int(val, (int32_t)(mv ? n : lo + n));
|
||||
+ text_column(1, mv ? "WIDTH" : "END", on ? val : "ALL", on ? VAL(1u) : T_DIM);
|
||||
+ hot_text_column(2, "ACTION", SE[a].nm);
|
||||
+ se_amt(a, val);
|
||||
+ text_column(3, SE[a].f == 'p' ? "MODE" : SE[a].f == '%' ? "AMOUNT" : SE[a].f == 'n' ? "64THS" : SE[a].f ? "BY" : "",
|
||||
+ val, SE[a].f ? VAL(3u) : T_DIM);
|
||||
} else { /* the page's four (SCL: LY_SCL) */
|
||||
uint8_t h = ui.home, pg = ui.page, nm[sizeof ui.nmem];
|
||||
memcpy(nm, ui.nmem, sizeof nm);
|
||||
@@ -1625,7 +1626,9 @@
|
||||
live.dirty * 977u + lys.nqc * 4099u + (chain.running ? chain.row * 13u + chain.remaining * 17u : 0u) +
|
||||
(lys.song * 8u + song_cur) * 65537u;
|
||||
else if (l == LAYER_SEQ)
|
||||
- sig += (uint32_t)drum_track(TSEL) * 31u + ui.lane * 5u + (uint32_t)chain_busy() * 3u + (uint32_t)TSEL->p[P_E0] * 131u + song.sel * 977u;
|
||||
+ sig += (uint32_t)drum_track(TSEL) * 31u + ui.lane * 5u + (uint32_t)chain_busy() * 3u + steps_hash(TSEL) * 131u + song.sel * 977u +
|
||||
+ (uint16_t)cp_sel * 7u + ui.bank * 13u + ui.cursor * 17u + (song.playing ? pr_head_step(TSEL, 0) * 4099u : 0u) +
|
||||
+ (uint32_t)TSEL->p[P_SLEN] * 65537u;
|
||||
else
|
||||
sig += snd_id() * 31u + (uint32_t)preset_favorite() * 13u + (uint32_t)chain_busy() * 3u + (uint32_t)(project_recall_slot() + 1) * 5u + dx_mute * 7919u +
|
||||
(uint32_t)drum_track(TSEL) * 11u + up_gen * 101u;
|
||||
@@ -1635,7 +1638,16 @@
|
||||
cv_rrect(4, 0, 232, (int32_t)graph_h(), 6, T_SURF, T_BG);
|
||||
cv_bg = T_SURF;
|
||||
if (l == LAYER_FX && !pk.edit) ly_fx_cells(); /* (V10.7.77, the owner) FX: the effects as cells, as before 0.8.9 */
|
||||
- else ly_piano(l); /* MAP: the keyboard (V10.7.66: KNOBS / STATE gone) */
|
||||
+ else if (l == LAYER_SEQ) { /* (V10.8.52) SEQ EDIT: the roll (the lanes), the steps selected */
|
||||
+ uint32_t lo, n, i, dr = (uint32_t)drum_track(TSEL), on = (uint32_t)seq_sel(TSEL, &lo, &n, tl_len(TSEL));
|
||||
+ int32_t x, w;
|
||||
+ if (dr) graph_grid(TSEL, T_THEME); else graph_roll(TSEL, 0);
|
||||
+ for (i = 0; on && i < 16u; i++)
|
||||
+ if (ui.bank * 16u + i >= lo && ui.bank * 16u + i < lo + n) {
|
||||
+ seq_col(dr, i, &x, &w);
|
||||
+ cv_rect(x, 0, w + 1, 3, T_ACCENT);
|
||||
+ }
|
||||
+ } else ly_piano(l); /* MAP: the keyboard (V10.7.66: KNOBS / STATE gone) */
|
||||
if (l == LAYER_FX && !pk.edit && bn_on(2)) /* (V10.8.9, the owner) the punch-in held, large (V10.8.13: */
|
||||
hold_banner(bn_nm, bn_k, pfx_rec_ok()); /* 0.6 s after the key, never a latch's) */
|
||||
cv_blit(0, graph_y());
|
||||
diff -ru a/firmware/src/ui_tools.c b/firmware/src/ui_tools.c
|
||||
--- a/firmware/src/ui_tools.c 2026-11-26 14:04:11.349569528 +0000
|
||||
+++ b/firmware/src/ui_tools.c 2026-11-26 14:04:11.357971427 +0000
|
||||
@@ -7,6 +7,8 @@
|
||||
* F4 CLR AUTO (JIANT 0.6.8) the track's automation (V10.6: C4 RANDOM D4 COOK
|
||||
* E4 BEAT and C5 the lane's RANDOM gone: SEQ > EUCLID generates)
|
||||
* G4 CLEAR A4 REVERSE B4 FILL the selected lane (DRUM: ui.lane, black keys 1..8 pick it)
|
||||
+ * (V10.8.52: the SEQ EDIT page, se_do below, does them on the steps selected; the keys F3 CLEAR, F4 CLR AUTO, G4-B4 the
|
||||
+ * lane's, C5 DUP, E5 COPY, F5 PASTE, G5 CLR STEP stay; G3 ALL, A3 KNOB 1 / 2 MOVE, B3-E4 BAR 1-4, D5 DO IT.)
|
||||
* Each works on the selected track's steps 1..LEN (the steps past LEN stay); the track's automation stays (but
|
||||
* CLR AUTO's: it clears the track's automation and locks, every step, the steps stay). No undo
|
||||
* (TONIC): the song layer's RECALL brings the section back as it was stored.
|
||||
@@ -23,12 +25,6 @@
|
||||
static uint32_t tl_rnd(uint32_t n) { return n ? rng() % n : 0u; }
|
||||
static int tl_gate(const step_t *s) { return s->time == ST_NOTE && s->n; }
|
||||
static uint32_t tl_lane(const step_t *s, uint32_t l) { return (step_lanes_of(TSEL,s) >> l) & 1u; }
|
||||
-/* place p's action is there for this track (the lane row and BEAT: DRUM only) */
|
||||
-static int tl_cell(const track_t *t, uint32_t p) /* (V10.6) RANDOM COOK BEAT and the lane's RANDOM gone: EUCLID */
|
||||
-{
|
||||
- return p <= TL_CAUTO || (drum_track(t) && p >= TL_LCLR && p < TL_LRND);
|
||||
-}
|
||||
-
|
||||
/* the steps of t as they are now, before an action */
|
||||
static void tl_take(const track_t *t) { memcpy(tl_src, t->step, sizeof tl_src); }
|
||||
|
||||
@@ -68,19 +64,20 @@
|
||||
motion_unguard(f);
|
||||
}
|
||||
|
||||
-/* REVERSE: the mirror order; a note's ties (after it) would come before it, so the note goes first again */
|
||||
-static void tl_reverse(track_t *t, uint32_t len)
|
||||
+/* REVERSE: steps lo .. lo+n-1 in the mirror order; a note's ties (after it) would come before it, so the note goes
|
||||
+ * first again */
|
||||
+static void tl_reverse(track_t *t, uint32_t lo, uint32_t n, uint32_t len)
|
||||
{
|
||||
uint8_t src[NSTEP], h;
|
||||
uint32_t j, e, x;
|
||||
for (j = 0; j < len; j++)
|
||||
- src[j] = (uint8_t)(len - 1u - j);
|
||||
- for (j = 0; j < len; j++) {
|
||||
- for (e = j; e < len && tl_src[src[e]].time == ST_TIE; e++)
|
||||
+ src[j] = (uint8_t)(j < lo || j >= lo + n ? j : 2u * lo + n - 1u - j);
|
||||
+ for (j = lo; j < lo + n; j++) {
|
||||
+ for (e = j; e < lo + n && tl_src[src[e]].time == ST_TIE; e++)
|
||||
;
|
||||
if (e == j)
|
||||
continue;
|
||||
- if (e < len && tl_src[src[e]].time == ST_NOTE) { /* ties j .. e - 1, their note at e: the note to j */
|
||||
+ if (e < lo + n && tl_src[src[e]].time == ST_NOTE) { /* ties j .. e - 1, their note at e: the note to j */
|
||||
for (h = src[e], x = e; x > j; x--)
|
||||
src[x] = src[x - 1u];
|
||||
src[j] = h;
|
||||
@@ -90,15 +87,16 @@
|
||||
tl_order(t, len, src);
|
||||
}
|
||||
|
||||
-/* SHIFT: rotated by one step inside LEN, d = 1 later (>), len - 1 earlier (<) */
|
||||
-static void tl_shift(track_t *t, uint32_t len, uint32_t d)
|
||||
+/* (V10.8.52) ROTATE: steps a .. b-1 turned by d (d > 0 later), inside them; the rest stay */
|
||||
+static void tl_rot(track_t *t, uint32_t a, uint32_t b, int32_t d, uint32_t len)
|
||||
{
|
||||
uint8_t src[NSTEP];
|
||||
- uint32_t j;
|
||||
+ uint32_t j, w = b - a;
|
||||
for (j = 0; j < len; j++)
|
||||
- src[j] = (uint8_t)((j + len - d) % len);
|
||||
+ src[j] = (uint8_t)(j < a || j >= b ? j : a + (j - a + w * 64u - (uint32_t)d) % w);
|
||||
tl_order(t, len, src);
|
||||
}
|
||||
+static void tl_shift(track_t *t, uint32_t len, uint32_t d) { tl_take(t); tl_rot(t, 0, len, (int32_t)d, len); }
|
||||
|
||||
/* ------------------------------------------------------------- drums --- */
|
||||
static void tl_lane_clear(track_t *t, uint32_t len, uint32_t l)
|
||||
@@ -123,138 +121,287 @@
|
||||
return e;
|
||||
}
|
||||
|
||||
-/* ----------------------------------------------------------- melodic --- */
|
||||
-/* ------------------------------------------------------------ actions --- */
|
||||
-/* (V10.8.49) SEQ TOOLS' STRETCH x2 / SQUEEZE /2 / REPEAT x2; (V10.8.51) on the range held on SEQ's roll (SEL 5-8: cp_sel,
|
||||
- * taken once) or else the whole track */
|
||||
-static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t lo, uint32_t n, uint32_t len);
|
||||
-static const char *tl_shape(track_t *t, uint32_t p, uint32_t len, char *b)
|
||||
-{
|
||||
- uint32_t s = (uint16_t)cp_sel, sel = s >> 15, lo = sel ? s & 63u : 0u, n = sel ? ((s >> 8) & 63u) - lo + 1u : len, nl;
|
||||
- cp_sel = 0;
|
||||
- if (lo + n > len) lo = 0, n = len, sel = 0; /* (LEN shortened since: the whole track) */
|
||||
- nl = tl_reshape(t, p == TL_BEAT ? 0 : p == TL_RANDOM ? 2 : -2, lo, n, len);
|
||||
- if (!nl) { ui_message(p == TL_COOK ? "TOO SHORT" : "64 STEPS ALREADY"); return 0; }
|
||||
- if (sel) {
|
||||
- cp_say(p == TL_BEAT ? "REPEAT " : p == TL_RANDOM ? "STRETCH " : "SQUEEZE ", lo, n);
|
||||
- return ui.msg;
|
||||
+/* ------------------------------------------------- (V10.8.52) SEQ EDIT --- */
|
||||
+/* The owner's SEQ EDIT (SEQ held on a SEQ page): the roll (DRUM: the lanes' grid) over KNOB 1 START, 2 END (A3: MOVE
|
||||
+ * and WIDTH), 3 the ACTION, 4 its amount; OCT+ (or D5) does it on the steps selected, or on the whole sequence while
|
||||
+ * none is (OCT- or G3: none). One UNDO point each (GLO + G4). The selection is the track's own (sel_of: its first | its
|
||||
+ * last << 8, bit 15 on; step keys held on the roll set it too, ui_input.c sel_poll): any SEQ page can read it (seq_sel) */
|
||||
+enum { SE_STRETCH, SE_SQUEEZE, SE_REPEAT, SE_NUDGE, SE_ROTATE, SE_SHIFT, SE_REVERSE, SE_DUP, SE_COPY, SE_PASTE, SE_CLEAR,
|
||||
+ SE_CAUTO, SE_CSTEP, SE_VEL, SE_NOTES, SE_HUMAN, SE_TRANSP, SE_OCT, SE_THIN, SE_INVERT, SE_STUT, SE_ARP, SE_MUTATE, SE_N };
|
||||
+typedef struct { char nm[9]; int8_t lo, hi, def; char f; } se_t;
|
||||
+static const se_t SE[SE_N] = {
|
||||
+ {"STRETCH", 2, 4, 2, 'x'}, {"SQUEEZE", 2, 4, 2, '/'}, {"REPEAT", 2, 9, 2, 'x'}, {"NUDGE", -32, 31, 4, 'n'},
|
||||
+ {"ROTATE", -15, 15, 1, 's'}, {"SHIFT", -16, 16, 1, 's'}, {"REVERSE", 0, 0, 0, 0}, {"DUP", 0, 0, 0, 0},
|
||||
+ {"COPY", 0, 0, 0, 0}, {"PASTE", 0, 1, 0, 'p'}, {"CLEAR", 0, 0, 0, 0}, {"CLR AUTO", 0, 0, 0, 0},
|
||||
+ {"CLR STEP", 0, 0, 0, 0}, {"VEL RND", 5, 100, 25, '%'}, {"NOTE RND", 1, 7, 2, 's'}, {"HUMANIZE", 1, 16, 4, 'n'},
|
||||
+ {"TRANSP", -12, 12, 1, 's'}, {"OCTAVE", -2, 2, 1, 's'}, {"THIN", 5, 100, 25, '%'},
|
||||
+ {"INVERT", 0, 0, 0, 0}, {"STUTTER", 2, 4, 2, 'x'}, {"ARP", 0, 3, 0, 'a'}, {"MUTATE", 5, 100, 25, '%'}};
|
||||
+#define sel_of(k) (clay_sp[2u + (k) % NTRK])
|
||||
+#define se_st (clay_sp[8]) /* the ACTION | KNOB 1 / 2 MOVE and WIDTH << 7 */
|
||||
+#define se_md (clay_sp[9]) /* its amount */
|
||||
+
|
||||
+/* track t's steps selected (lo, n): bit 15, inside LEN; else the whole sequence (0, len). 1 = a selection */
|
||||
+static int seq_sel(const track_t *t, uint32_t *lo, uint32_t *n, uint32_t len)
|
||||
+{
|
||||
+ uint32_t s = (uint16_t)sel_of(trk_index(t)), a = s & 63u, b = (s >> 8) & 63u;
|
||||
+ if (!(s >> 15) || b >= len || a > b) { *lo = 0; *n = len; return 0; }
|
||||
+ *lo = a; *n = b - a + 1u;
|
||||
+ return 1;
|
||||
+}
|
||||
+static void sel_set(uint32_t a, uint32_t b) { cp_sel = (int16_t)(0x8000u | b << 8 | a); ui.bank = (uint8_t)(a / 16u); }
|
||||
+
|
||||
+/* the amount's words: "x2", "/3", "+4", "25%", "FILL", "INSERT"; "-" none */
|
||||
+static void se_amt(uint32_t a, char *b)
|
||||
+{
|
||||
+ int32_t m = se_md;
|
||||
+ char f = SE[a].f;
|
||||
+ b[0] = f == 'x' || f == '/' ? f : 0; b[1] = 0;
|
||||
+ if (!f) str_cpy(b, "-", 4);
|
||||
+ else if (f == 'p') str_cpy(b, m ? "INSERT" : "OVER", 8);
|
||||
+ else if (f == 'a') str_cpy(b, m == 0 ? "UP" : m == 1 ? "DOWN" : m == 2 ? "UP+DN" : "RANDOM", 8);
|
||||
+ else if (a == SE_REPEAT && m > 8) str_cpy(b, "FILL", 8);
|
||||
+ else {
|
||||
+ if ((f == 'n' || f == 's') && m > 0) b[0] = '+';
|
||||
+ fmt_int(b + str_len(b), m);
|
||||
+ if (f == '%') str_cpy(b + str_len(b), "%", 2);
|
||||
}
|
||||
- str_cpy(b, "LEN ", 24); fmt_int(b + 4, (int32_t)len); str_cpy(b + str_len(b), " > ", 4);
|
||||
- fmt_int(b + str_len(b), (int32_t)nl);
|
||||
- return b;
|
||||
}
|
||||
-/* (V10.8.49, the owner) SEQ TOOLS' C#5 / D#5: NUDGE, every note step's MICRO d 64ths of a step later (d < 0: earlier)
|
||||
- * together, each held at MICRO's range (no step passes another); the first note's MICRO said */
|
||||
-static __attribute__((noinline)) const char *tl_nudge(track_t *t, int32_t d)
|
||||
+
|
||||
+/* (V10.8.49) NUDGE: every note step's MICRO in lo .. lo+n-1 d 64ths of a step later (d < 0: earlier) together, each
|
||||
+ * held at MICRO's range; the first note's MICRO said. (V10.8.52) HUMANIZE (h): each its own, up to d either way */
|
||||
+static __attribute__((noinline)) const char *tl_nudge(track_t *t, int32_t d, uint32_t lo, uint32_t n, int h)
|
||||
{
|
||||
static char b[16];
|
||||
- uint32_t len = tl_len(t), i, n = 0, f = 0;
|
||||
+ uint32_t i, c = 0, f = 0;
|
||||
int32_t m = 0, v;
|
||||
- for (i = 0; i < len; i++) {
|
||||
+ for (i = lo; i < lo + n; i++) {
|
||||
step_t *s = &t->step[i];
|
||||
if (s->time != ST_NOTE)
|
||||
continue;
|
||||
- v = clamp(ST_MICRO(s) + d, MICRO_MIN, MICRO_MAX);
|
||||
+ v = clamp(ST_MICRO(s) + (h ? (int32_t)tl_rnd(2u * (uint32_t)d + 1u) - d : d), MICRO_MIN, MICRO_MAX);
|
||||
if (!f++) m = v;
|
||||
- if (v != ST_MICRO(s)) { ST_MICRO_SET(s, v); n++; }
|
||||
+ if (v != ST_MICRO(s)) { ST_MICRO_SET(s, v); c++; }
|
||||
}
|
||||
- if (!n) { ui_message(f ? "NUDGE: AT ITS LIMIT" : "NO NOTES"); return 0; }
|
||||
+ if (!c) { ui_message(f ? "NUDGE: AT ITS LIMIT" : "NO NOTES"); return 0; }
|
||||
str_cpy(b, m > 0 ? "NUDGE +" : "NUDGE ", sizeof b);
|
||||
fmt_int(b + str_len(b), m);
|
||||
str_cpy(b + str_len(b), "/64", 4);
|
||||
- return b;
|
||||
+ return h ? "HUMANIZED" : b;
|
||||
}
|
||||
-/* the action of place p on track t (lane l): its message; 0 = nothing done (said why) */
|
||||
-static __attribute__((noinline)) const char *tl_do(track_t *t, uint32_t p, uint32_t l)
|
||||
-{
|
||||
- static char b[24];
|
||||
- uint32_t len = tl_len(t), i, n = 0;
|
||||
+
|
||||
+static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t f, uint32_t lo, uint32_t n, uint32_t len);
|
||||
+/* action a (SE_*) with amount m on track t's selection (or all of it): 0 nothing done (said why) */
|
||||
+static __attribute__((noinline)) void se_do(uint32_t a, int32_t m)
|
||||
+{
|
||||
+ track_t *t = TSEL;
|
||||
+ char b[24];
|
||||
+ uint32_t len = tl_len(t), lo, n, i, j, sel = (uint32_t)seq_sel(t, &lo, &n, len), dr = (uint32_t)drum_track(t), nl;
|
||||
uint64_t was = tl_used(t, len);
|
||||
const char *msg = 0;
|
||||
- l %= NLANE;
|
||||
- if (p == TL_CAUTO) { /* (JIANT 0.6.8) the automation and locks, every step */
|
||||
- if (!motion_count(t)) {
|
||||
- ui_message("NOTHING TO CLEAR");
|
||||
- return 0;
|
||||
+ if (chain_busy()) { ui_message("SONG PLAYS: STOP IT TO EDIT"); return; }
|
||||
+ if (a == SE_CSTEP) { seq_clr_step(); return; }
|
||||
+ if (a >= SE_NOTES && a != SE_HUMAN && a != SE_THIN && a != SE_STUT && a != SE_MUTATE && dr) { ui_message("NOTES ONLY"); return; }
|
||||
+ clay_sp[10] = (int16_t)((a + 1u) | (uint32_t)(uint8_t)m << 8); /* (the UNDO key's words: the last action) */
|
||||
+ clay_sp[11] = (int16_t)(lo | n << 6);
|
||||
+ if (a == SE_COPY || a == SE_DUP) {
|
||||
+ cp_add = cp_add_acc = 0;
|
||||
+ cp_copy((~(uint64_t)0 >> (NSTEP - n)) << lo); /* ("COPY 5-8") */
|
||||
+ if (a == SE_COPY) return;
|
||||
+ if (lo + n >= NSTEP) { ui_message("NO ROOM"); return; }
|
||||
+ cp_put(t, lo + n, 2u); /* (DUP: right after them, LEN grown; one UNDO) */
|
||||
+ if (sel) sel_set(lo + n, lo + 2u * n - 1u < NSTEP ? lo + 2u * n - 1u : NSTEP - 1u);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (a == SE_PASTE) {
|
||||
+ if (!clip.n) { ui_message("NOTHING COPIED"); return; }
|
||||
+ if (!sel) { cp_put(t, 0, 1u); return; } /* (the whole sequence: PASTE SEQ, as before) */
|
||||
+ if (m) { /* INSERT: the steps from lo on moved along, LEN grown */
|
||||
+ nl = len + clip.n < NSTEP ? len + clip.n : NSTEP;
|
||||
+ undo_mark();
|
||||
+ for (i = len; i < nl; i++) { step_clear(&t->step[i]); (void)motion_clear_locks(t, i); }
|
||||
+ tl_take(t);
|
||||
+ tl_rot(t, lo, nl, (int32_t)(nl - len), nl);
|
||||
+ t->p[P_SLEN] = (int16_t)nl;
|
||||
}
|
||||
- motion_clear(t);
|
||||
- return "AUTOMATION CLEARED";
|
||||
+ cp_put(t, lo, 0);
|
||||
+ return;
|
||||
}
|
||||
+ undo_mark(); /* (one UNDO point each) */
|
||||
tl_take(t);
|
||||
- switch (p) {
|
||||
- case TL_CLEAR: { /* (0.6.28: names the track, ends its held / repeated notes) */
|
||||
- static char cb[20];
|
||||
- for (i = 0; i < len; i++)
|
||||
- step_clear(&t->step[i]);
|
||||
- latch_drop_req |= (uint8_t)(1u << trk_index(t));
|
||||
- str_cpy(cb, "T1 CLEARED", sizeof cb);
|
||||
- cb[1] = (char)('1' + trk_index(t));
|
||||
- msg = cb;
|
||||
+ switch (a) {
|
||||
+ case SE_STRETCH: case SE_SQUEEZE: case SE_REPEAT:
|
||||
+ if (a == SE_REPEAT && m > 8) m = (int32_t)((NSTEP - len + n) / n); /* (FILL: as many as fit in 64) */
|
||||
+ nl = m < 2 ? 0u : tl_reshape(t, a == SE_STRETCH ? 1 : a == SE_SQUEEZE ? -1 : 0, (uint32_t)m, lo, n, len);
|
||||
+ if (!nl) { ui_message(a == SE_SQUEEZE ? "TOO SHORT" : "64 STEPS ALREADY"); return; }
|
||||
+ if (sel) sel_set(lo, lo + n - 1u + nl - len < NSTEP ? lo + n - 1u + nl - len : NSTEP - 1u);
|
||||
+ len = nl; /* (the emptied: of the new LEN) */
|
||||
+ break;
|
||||
+ case SE_NUDGE: case SE_HUMAN:
|
||||
+ if (!(msg = tl_nudge(t, m, lo, n, a == SE_HUMAN))) return;
|
||||
+ break;
|
||||
+ case SE_ROTATE: tl_rot(t, lo, lo + n, m, len); break;
|
||||
+ case SE_SHIFT: /* the steps slid m along, the ones there round them */
|
||||
+ i = m < 0 ? (uint32_t)clamp((int32_t)lo + m, 0, (int32_t)lo) : lo;
|
||||
+ j = m > 0 ? (uint32_t)clamp((int32_t)(lo + n) + m, (int32_t)(lo + n), (int32_t)len) : lo + n;
|
||||
+ if (j - i <= n) { ui_message("AT THE EDGE"); return; }
|
||||
+ tl_rot(t, i, j, m < 0 ? (int32_t)(i - lo) : (int32_t)(j - lo - n), len);
|
||||
+ if (sel) sel_set(m < 0 ? i : j - n, (m < 0 ? i : j - n) + n - 1u);
|
||||
+ break;
|
||||
+ case SE_REVERSE: tl_reverse(t, lo, n, len); break;
|
||||
+ case SE_CAUTO: { /* the automation and locks of the steps (none selected: all) */
|
||||
+ uint32_t f = motion_guard(), k = trk_index(t), c = 0;
|
||||
+ for (i = 0; i < motion.count; i++) {
|
||||
+ motion_event_t e = motion.event[i];
|
||||
+ if (MOTION_TRK(&e) != k || MOTION_STEP(&e) < lo || MOTION_STEP(&e) >= lo + n) motion.event[c++] = e;
|
||||
+ }
|
||||
+ j = motion.count - c;
|
||||
+ memset(motion.event + c, 0, (MOTION_MAX - c) * sizeof motion.event[0]);
|
||||
+ motion.count = (uint8_t)c;
|
||||
+ motion_unguard(f);
|
||||
+ if (!sel) motion_clear(t);
|
||||
+ if (!j && !sel) { ui_message("NOTHING TO CLEAR"); return; }
|
||||
break;
|
||||
}
|
||||
- case TL_REV: tl_reverse(t, len); msg = "REVERSED"; break;
|
||||
- case TL_LEFT: tl_shift(t, len, len - 1u); msg = "SHIFTED LEFT"; break;
|
||||
- case TL_RIGHT: tl_shift(t, len, 1u); msg = "SHIFTED RIGHT"; break;
|
||||
- case TL_RANDOM: case TL_COOK: case TL_BEAT: /* (V10.8.49, the owner) SEQ TOOLS: STRETCH x2, SQUEEZE /2, REPEAT x2 */
|
||||
- return tl_shape(t, p, len, b);
|
||||
- default: /* the lane's */
|
||||
- str_cpy(b, drum_lane_name(t, l), sizeof b);
|
||||
- if (p == TL_LCLR) {
|
||||
- tl_lane_clear(t, len, l);
|
||||
- msg = " CLEARED";
|
||||
- } else if (p == TL_LREV) {
|
||||
- for (i = 0; i < len; i++) {
|
||||
- const step_t *s = &tl_src[len - 1u - i];
|
||||
- grid_hit(t, i, l, tl_lane(s, l));
|
||||
- if (tl_lane(s, l))
|
||||
- grid_acc(t, i, l, (step_accents_of(TSEL,s) >> l) & 1u);
|
||||
+ case SE_ARP: { /* a chord's notes one a step, over the TIEs it holds on */
|
||||
+ uint32_t c = 0, k = 0, v = 100, q;
|
||||
+ uint8_t nt[4];
|
||||
+ for (i = lo; i < lo + n; i++) {
|
||||
+ step_t *x = &t->step[i];
|
||||
+ if (x->time == ST_NOTE && x->n > 1u) {
|
||||
+ c = x->n; v = x->vel; k = 0;
|
||||
+ memcpy(nt, x->note, 4);
|
||||
+ for (j = 1; j < c; j++) for (q = j; q && nt[q - 1u] > nt[q]; q--) { uint8_t e = nt[q]; nt[q] = nt[q - 1u]; nt[q - 1u] = e; }
|
||||
+ } else if (!c || x->time != ST_TIE) { c = 0; continue; }
|
||||
+ x->time = ST_NOTE; x->vel = (uint8_t)v;
|
||||
+ q = k % (2u * c - 2u);
|
||||
+ j = m == 3 ? tl_rnd(c) : m == 2 ? (q < c ? q : 2u * c - 2u - q) : m ? c - 1u - k % c : k % c;
|
||||
+ x->n = 1; x->note[0] = nt[j]; k++;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ default: /* CLEAR, and each step of them on its own */
|
||||
+ if (a == SE_INVERT) { /* round the middle of the lowest and the highest note */
|
||||
+ uint32_t lo2 = 127, hi = 0;
|
||||
+ for (i = lo; i < lo + n; i++)
|
||||
+ for (j = 0; t->step[i].time == ST_NOTE && j < t->step[i].n; j++) {
|
||||
+ if (t->step[i].note[j] < lo2) lo2 = t->step[i].note[j];
|
||||
+ if (t->step[i].note[j] > hi) hi = t->step[i].note[j];
|
||||
+ }
|
||||
+ m = (int32_t)(lo2 + hi);
|
||||
+ }
|
||||
+ for (i = lo; i < lo + n; i++) {
|
||||
+ step_t *x = &t->step[i];
|
||||
+ if (a == SE_CLEAR) { step_clear(x); continue; }
|
||||
+ if (x->time != ST_NOTE || (!x->n && !x->hit)) continue;
|
||||
+ if (a == SE_VEL) x->vel = (uint8_t)clamp((int32_t)x->vel + (int32_t)tl_rnd(254u * (uint32_t)m / 100u + 1u) -
|
||||
+ 127 * m / 100, 1, 127);
|
||||
+ else if (a == SE_THIN) { if (tl_rnd(100u) < (uint32_t)m) step_clear(x); }
|
||||
+ else if (a == SE_STUT) x->flags = (uint8_t)((x->flags & ~SF_RATCH) | (uint32_t)(m - 1) << SF_RATCH_SH);
|
||||
+ else if (a == SE_MUTATE) { /* each step, m %: a degree or two, its velocity, its place */
|
||||
+ if (tl_rnd(100u) >= (uint32_t)m) continue;
|
||||
+ if (!dr) x->note[0] = (uint8_t)clamp(scale_steps(t, x->note[0], (int32_t)tl_rnd(5u) - 2), 0, 127);
|
||||
+ x->vel = (uint8_t)clamp((int32_t)x->vel + (int32_t)tl_rnd(41u) - 20, 1, 127);
|
||||
+ ST_MICRO_SET(x, clamp(ST_MICRO(x) + (int32_t)tl_rnd(9u) - 4, MICRO_MIN, MICRO_MAX));
|
||||
}
|
||||
- msg = " REVERSED";
|
||||
- } else {
|
||||
- n = tl_fill(t, len, l);
|
||||
- msg = n == 1u ? " EVERY STEP" : n == 2u ? " EVERY 2ND" : n ? " EVERY 4TH" : " CLEARED";
|
||||
+ else
|
||||
+ for (j = 0; j < x->n; j++)
|
||||
+ x->note[j] = (uint8_t)clamp(a == SE_INVERT ? m - x->note[j] : a == SE_TRANSP ? x->note[j] + m : a == SE_OCT ? x->note[j] + 12 * m :
|
||||
+ scale_steps(t, x->note[j], (int32_t)tl_rnd(2u * (uint32_t)m + 1u) - m), 0, 127);
|
||||
}
|
||||
- str_cpy(b + str_len(b), msg, sizeof b - str_len(b));
|
||||
- msg = b;
|
||||
+ if (a == SE_CLEAR && !sel) latch_drop_req |= (uint8_t)(1u << trk_index(t)); /* (its held notes end) */
|
||||
break;
|
||||
}
|
||||
tl_unlock(t, was, len);
|
||||
- return msg;
|
||||
+ if (!msg) {
|
||||
+ str_cpy(b, SE[a].nm, sizeof b);
|
||||
+ if (SE[a].f) { str_cpy(b + str_len(b), " ", 2); se_amt(a, b + str_len(b)); }
|
||||
+ str_cpy(b + str_len(b), " ", 2);
|
||||
+ cp_say(b, lo, n); /* "STRETCH x2 5-8" */
|
||||
+ } else
|
||||
+ ui_message(msg);
|
||||
+ ui.force = 1;
|
||||
+}
|
||||
+
|
||||
+/* (V10.8.52) SEQ EDIT's UNDO key (F#5): the last action back, again: forward ("UNDO STRETCH x2 5-8", "REDO ..") */
|
||||
+static void se_undo(void)
|
||||
+{
|
||||
+ char b[24];
|
||||
+ uint32_t a = ((uint32_t)clay_sp[10] & 255u) - 1u, r = (uint16_t)clay_sp[11];
|
||||
+ int16_t md = se_md;
|
||||
+ if (chain_busy() || undo_do()) { ui_message("NOTHING TO UNDO"); return; }
|
||||
+ clay_sp[11] = (int16_t)(r ^ 0x8000u);
|
||||
+ if (a >= SE_N) { ui_message(r >> 15 ? "REDONE" : "UNDONE"); return; }
|
||||
+ str_cpy(b, r >> 15 ? "REDO " : "UNDO ", sizeof b);
|
||||
+ str_cpy(b + 5, SE[a].nm, sizeof b - 5);
|
||||
+ se_md = (int16_t)(int8_t)(clay_sp[10] >> 8);
|
||||
+ if (SE[a].f) { str_cpy(b + str_len(b), " ", 2); se_amt(a, b + str_len(b)); }
|
||||
+ se_md = md;
|
||||
+ str_cpy(b + str_len(b), " ", 2);
|
||||
+ cp_say(b, r & 63u, (r >> 6) & 127u);
|
||||
+ ui.force = 1;
|
||||
+}
|
||||
+
|
||||
+/* the lane's tools (DRUM: G4 CLR, A4 REV, B4 FILL the lane ui.lane): its message; 0 = nothing done */
|
||||
+static __attribute__((noinline)) const char *tl_do(track_t *t, uint32_t p, uint32_t l)
|
||||
+{
|
||||
+ static char b[24];
|
||||
+ uint32_t len = tl_len(t), i, n;
|
||||
+ const char *msg;
|
||||
+ l %= NLANE;
|
||||
+ undo_mark();
|
||||
+ tl_take(t);
|
||||
+ str_cpy(b, drum_lane_name(t, l), sizeof b);
|
||||
+ if (p == TL_LCLR) {
|
||||
+ tl_lane_clear(t, len, l);
|
||||
+ msg = " CLEARED";
|
||||
+ } else if (p == TL_LREV) {
|
||||
+ for (i = 0; i < len; i++) {
|
||||
+ const step_t *s = &tl_src[len - 1u - i];
|
||||
+ grid_hit(t, i, l, tl_lane(s, l));
|
||||
+ if (tl_lane(s, l))
|
||||
+ grid_acc(t, i, l, (step_accents_of(TSEL,s) >> l) & 1u);
|
||||
+ }
|
||||
+ msg = " REVERSED";
|
||||
+ } else {
|
||||
+ n = tl_fill(t, len, l);
|
||||
+ msg = n == 1u ? " EVERY STEP" : n == 2u ? " EVERY 2ND" : n ? " EVERY 4TH" : " CLEARED";
|
||||
+ }
|
||||
+ str_cpy(b + str_len(b), msg, sizeof b - str_len(b));
|
||||
+ return b;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------- (0.6.85) SEQ > STRETCH --- */
|
||||
/* (V10.8.51) steps lo .. lo+n-1 of the selected track (tl_src: the steps before), the steps after them moved along, LEN
|
||||
- * with them (64 at most: what falls past is cut), their automation and locks with their steps:
|
||||
- * k 2, STRETCH x2: step i to step 2i; a note held into the next step (a TIE after it) holds over the new one
|
||||
- * k -2, SQUEEZE /2: step j takes the first that plays of 2j, 2j+1 (a TIE if the note before holds on)
|
||||
- * k 0, REPEAT x2: the steps again right after them, their automation and locks copied while there is room
|
||||
+ * with them (64 at most: what falls past is cut), their automation and locks with their steps; (V10.8.52) f times:
|
||||
+ * k 1, STRETCH xf: step i to step fi; a note held into the next step (a TIE after it) holds over the new ones
|
||||
+ * k -1, SQUEEZE /f: step j takes the first that plays of fj .. fj+f-1 (a TIE if the note before holds on)
|
||||
+ * k 0, REPEAT xf: the steps f times, their automation and locks copied while there is room
|
||||
* Returns the new LEN (0: nothing to do) */
|
||||
-BTAPP_FN static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t lo, uint32_t n, uint32_t len)
|
||||
+BTAPP_FN static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t q, uint32_t lo, uint32_t n, uint32_t len)
|
||||
{
|
||||
- uint32_t nn = k < 0 ? (n + 1u) / 2u : n * 2u, nlen = len - n + nn, i, j, c, f, tk = trk_index(t);
|
||||
+ uint32_t nn = k < 0 ? (n + q - 1u) / q : n * q, nlen = len - n + nn, i, j, c, f, tk = trk_index(t);
|
||||
if (nlen > NSTEP) nlen = NSTEP;
|
||||
if (nlen == len) return 0;
|
||||
- undo_mark(); /* (V10.8.51: one UNDO point) */
|
||||
for (j = lo; j < (len > nlen ? len : nlen); j++) step_clear(&t->step[j]); /* (past both LENs: as they were) */
|
||||
for (i = lo + n; i < len; i++) /* the steps after the range */
|
||||
if (i - n + nn < NSTEP) t->step[i - n + nn] = tl_src[i];
|
||||
for (i = 0; i < nn && lo + i < NSTEP; i++) {
|
||||
step_t *d = &t->step[lo + i];
|
||||
- if (k > 0) { /* STRETCH: the even ones */
|
||||
- const step_t *s = &tl_src[lo + i / 2u];
|
||||
- if (!(i & 1u)) *d = *s;
|
||||
- else if (s->time == ST_TIE || (s->time == ST_NOTE && s->n && lo + i / 2u + 1u < len &&
|
||||
- tl_src[lo + i / 2u + 1u].time == ST_TIE))
|
||||
+ if (k > 0) { /* STRETCH: every q-th */
|
||||
+ const step_t *s = &tl_src[lo + i / q];
|
||||
+ if (!(i % q)) *d = *s;
|
||||
+ else if (s->time == ST_TIE || (s->time == ST_NOTE && s->n && lo + i / q + 1u < len &&
|
||||
+ tl_src[lo + i / q + 1u].time == ST_TIE))
|
||||
d->time = ST_TIE, d->vel = s->vel;
|
||||
} else if (!k) /* REPEAT */
|
||||
*d = tl_src[lo + i % n];
|
||||
else { /* SQUEEZE */
|
||||
- uint32_t a = lo + 2u * i, tie = 0;
|
||||
- for (j = a; j < a + 2u && j < lo + n; j++) {
|
||||
+ uint32_t a = lo + q * i, tie = 0;
|
||||
+ for (j = a; j < a + q && j < lo + n; j++) {
|
||||
if (tl_src[j].time == ST_NOTE && (tl_src[j].n || tl_src[j].hit)) break;
|
||||
tie |= tl_src[j].time == ST_TIE;
|
||||
}
|
||||
- if (j < a + 2u && j < lo + n) *d = tl_src[j];
|
||||
+ if (j < a + q && j < lo + n) *d = tl_src[j];
|
||||
else if (tie && lo + i) d->time = ST_TIE, d->vel = tl_src[a].vel;
|
||||
}
|
||||
}
|
||||
@@ -265,7 +412,7 @@
|
||||
if (MOTION_TRK(&e) == tk) {
|
||||
if (st >= len) { if (st < nlen) continue; } /* (its step covered now) */
|
||||
else if (st >= lo + n) st = st - n + nn;
|
||||
- else if (st >= lo) st = k < 0 ? lo + (st - lo) / 2u : k ? lo + (st - lo) * 2u : st;
|
||||
+ else if (st >= lo) st = k < 0 ? lo + (st - lo) / q : k ? lo + (st - lo) * q : st;
|
||||
if (st >= nlen) continue; /* (cut with its step) */
|
||||
e.place = (uint8_t)((e.place & 0xC0u) | st);
|
||||
}
|
||||
@@ -273,12 +420,14 @@
|
||||
}
|
||||
memset(motion.event + c, 0, (MOTION_MAX - c) * sizeof motion.event[0]);
|
||||
motion.count = (uint8_t)c;
|
||||
- for (i = 0; !k && i < c; i++) { /* REPEAT: the range's on the copy */
|
||||
+ for (i = 0; !k && i < c; i++) { /* REPEAT: the range's on the copies */
|
||||
motion_event_t e = motion.event[i];
|
||||
uint32_t st = MOTION_STEP(&e);
|
||||
- if (MOTION_TRK(&e) != tk || st < lo || st >= lo + n || st + n >= nlen || motion.count >= MOTION_MAX) continue;
|
||||
- e.place = (uint8_t)((e.place & 0xC0u) | (st + n));
|
||||
- motion.event[motion.count++] = e;
|
||||
+ if (MOTION_TRK(&e) != tk || st < lo || st >= lo + n) continue;
|
||||
+ for (j = st + n; j < lo + nn && j < nlen && motion.count < MOTION_MAX; j += n) {
|
||||
+ e.place = (uint8_t)((e.place & 0xC0u) | j);
|
||||
+ motion.event[motion.count++] = e;
|
||||
+ }
|
||||
}
|
||||
RING_PUBLISH();
|
||||
motion_unguard(f);
|
||||
diff -ru a/tools/build.py b/tools/build.py
|
||||
--- a/tools/build.py 2026-11-26 14:04:11.354507234 +0000
|
||||
+++ b/tools/build.py 2026-11-26 14:04:11.358109184 +0000
|
||||
@@ -411,7 +411,7 @@
|
||||
"""the generator's own constant tables (gen.c, gen_tables.c): out of .rodata like the UI's recorded ones ('n'), so a
|
||||
new one never moves the sound's merged constants after .rodata"""
|
||||
names = set()
|
||||
- for f in ("gen.c", "gen_tables.c", "eng_string.c", "eng_add.c", "ui_engvis.c"): # (0.9.9-snd5: the two engines' own
|
||||
+ for f in ("gen.c", "gen_tables.c", "eng_string.c", "eng_add.c", "ui_engvis.c", "ui_tools.c"): # (V10.8.52: SEQ EDIT's) # (0.9.9-snd5: the two engines' own
|
||||
# tables and descriptors, the creatures' new ones: out of .rodata too, the sound's tables where they were)
|
||||
txt = (FW / "src" / f).read_text()
|
||||
names |= set(re.findall(r"^static const [^=;(]*?\b(\w+)\s*\[", txt, flags=re.M))
|
||||
@@ -49,7 +49,7 @@
|
||||
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
|
||||
#endif
|
||||
#ifndef FELUCCA_VERSION
|
||||
#define FELUCCA_VERSION "V10.8.52" /* (2026-11-26) V10.8.52 (the owner: "don't lose songs"): SAVE + C4..F4 / OCT+ over a part with music asks OVERWRITE A? (OCT+ yes, once a part until another project opens), the part it had back with GLO + G4 UNDO (again: the save again); a GEN draft saved with PROJECTS > SAVE is that project from then on (SAVE + C4, the autosave and RESTORE LAST follow it: they stayed on the music before GEN); V10.8.51 (the owner): projects of before V10.7 no longer migrated (OLD PROJECT: OPEN IN STUDIO, the slot untouched; Studio converts them: web_proj_load / web_proj_save); the MOD MATRIX AMOUNT -200 .. +198 % (100 % a full source the whole range, exactly); GEN's pieces under -1 dBFS before the master (a genre's headroom: were up to +13 dBFS); SEQ TOOLS' STRETCH SQUEEZE REPEAT on the steps held (SEL 5-8); PLAY: THE PART; V10.8.50 (the owner: "copy, paste, duplicate; select"): SEQ TOOLS C5 is DUP (the copied steps again right after them, LEN grown), step keys held + EDIT clear those steps, COPY / PASTE / DUP / CLEAR say the steps ("COPY 5-8"); V10.8.49 (the owner: SEQ TOOLS STRETCH x2, SQUEEZE /2, REPEAT x2 back on C4 D4 E4, NUDGE < / > on C#5 D#5; ABOUT's AUDIO LOAD lines and RAMP's curve out for the room); V10.8.48 (the owner: "everything lacks decay and release, all at sustain 100"; "the leads: decay, little sustain, a lot of release"; "the chords all filtered the same: the bands, the whole generator"): GEN's envelopes by role, a part's filter TYPE its own (BP, HP with KEY TRK), the GAIN making up what they take. V10.8.47 (the owner: "play and edit; the information, the names of the section: parts, song, arrange"): PART SLOTS' LOAD is PLAY/EDIT, STORE is SAVE, PLAY's LOOP is PART, a song's END LOOP is REPEAT, a part with no name its bars in the song, NOW is PLAYING, ARRANGE's tokens PART+BARS, JAM's and TAKE's SEQ is PART, CAMBIO is SWITCH. (2026-11-25) V10.8.46 (the owner): GEN: a part never still (its LFO slow and free on the filter and the shape, the stereo, a note's envelope on the shape), the rows' colours an arc, the envelopes by role, the build's high-pass in sixteenths, phonk the drift one alone; MENU > ABOUT's LAST CRASH back; V10.8.45 (the owner): the ARP on its RATE's grid of the transport while it plays, recorded on its steps; MENU > ABOUT's CPU lines and the velocity diagnostic out, the header's load a number; GEN: sections half as long, a row its own colour (the macros) and a section come again varied, DANCE's kit not longer, the build's filter sweep a bar, the envelopes. (2026-11-25) V10.8.44 (the owner): a GATE on the reverb and on the delay (FX > REVERB / DLY, OCT+ held + KNOB 4), a synth's LEVEL page (GAIN LEVEL PAN) after EDIT; V10.8.43 (BYTE's): RADIO: a STOP on the piece's last bar stops (chain.fin: the song's own END alone the next piece); GEN leaves SCL > HARMONY alone (on: the piece on the tonic chord); a lead's preset on a chord part without its fast vibrato. (2026-11-24) V10.8.42 (PR #241's ideas, in this generator): hard bass's DONK (PHASE's resonant saw), DREAM POP an organ's or a guitar's throw and its tape slower, an accented hit never thinned, IDM's roll in the phrase's turnaround; before: (2026-11-24) V10.8.41 (the owner: "the melodies and the drums sound generic", genre by genre): GEN: the riffs motifs of written rhythm and contour cells with an answer (BAILE FUNK, PHONK, DUBSTEP), JAZZ's comping written and its hats down, IDM GLITCH broken cells and placed rolls (no bursts), the basses under the drums and ducked (gen_stems' check), DUBSTEP low FOLD and chorus, CUMBIA, REGGAETON, HOUSE, HARD BASS, SHOEGAZE, DREAM POP as asked; TECHNO darker (phrygian, a line of 7 or 6 beats over the 4, its filter moving), EXPLORE its own: the minor modes, sevenths and ninths, borrowed chords, the drums edited, a cut, lines that evolve; MOOD: CALM lighter to -25, DANCE keeps a half-time's kick, EXPLORE's tempo; the FUGA genre gone (the owner); code no page reaches removed (no visible change). V10.8.40 (a user, the owner): the tempo exact and every DIV on one grid (a beat a multiple of 24 samples, the sequencer's time giving back what that cuts: fx.c beat_samples, seq.c tempo_acc; a 1/32 track was 12 ms a minute ahead of a 1/16 one at 133 BPM); a track's place from the transport's at every step (seq.c seq_anchor: after a LEN or DIV change, EUCLID, a variation, SWING, it is back with the others); SEQ held + PLAY: RESYNC at the next bar; GEN's MOOD on the drums in every GENRE mode (CALM: the kit down to a closed hat's tick, shorter, darker; DANCE: a kick on every beat, the kit up; MID as it was). V10.8.39 (the owner): GEN: every genre its traits (gen_tables.c GCHAR: hat rolls, ghosts and flams, ratchets, loops of other lengths, octave jumps, a hit's own cutoff or send, the bass's bursts, notes walking), IDM GLITCH far more extreme (two to five edits a bar, bursts x2 x4 x8, the bass and the lead up), AMBIENT and WEIRD deeper, the kick tuned to the key; GEN 4: RADIO (the neLine truncated
|
||||
#define FELUCCA_VERSION "V10.8.53" /* (2026-11-26) V10.8.53 (the owner: "every picture from the same engine, so their room shrinks"): the pictures' shared engine (ui_gx.c: cells, a sine, chips, keys); DELAY REVERB CHORUS SENDS drawn with it, DIST's and CLIP's curve one; the big numbers in M (the V face gone), the count-in on one line, the EQ's curve, the TOOLS picture and the small beings of the lists gone; SEQ EDIT (SEQ held): KNOB 1 / 2 the selection, 3 the ACTION (STRETCH .. MUTATE, GENERATE in the selection with KNOB 4 its genre and a new seed, RANDOM on its grid 1/4 .. 1/32), 4 its amount, OCT+ does it, F#5 UNDO / REDO; GLO's mutes, UNMUTE ALL, SCL's ROOT and REC's QUANTIZE say what they did; V10.8.52 (the owner: "don't lose songs"): SAVE + C4..F4 / OCT+ over a part with music asks OVERWRITE A? (OCT+ yes, once a part until another project opens), the part it had back with GLO + G4 UNDO (again: the save again); a GEN draft saved with PROJECTS > SAVE is that project from then on (SAVE + C4, the autosave and RESTORE LAST follow it: they stayed on the music before GEN); V10.8.51 (the owner): projects of before V10.7 no longer migrated (OLD PROJECT: OPEN IN STUDIO, the slot untouched; Studio converts them: web_proj_load / web_proj_save); the MOD MATRIX AMOUNT -200 .. +198 % (100 % a full source the whole range, exactly); GEN's pieces under -1 dBFS before the master (a genre's headroom: were up to +13 dBFS); SEQ TOOLS' STRETCH SQUEEZE REPEAT on the steps held (SEL 5-8); PLAY: THE PART; V10.8.50 (the owner: "copy, paste, duplicate; select"): SEQ TOOLS C5 is DUP (the copied steps again right after them, LEN grown), step keys held + EDIT clear those steps, COPY / PASTE / DUP / CLEAR say the steps ("COPY 5-8"); V10.8.49 (the owner: SEQ TOOLS STRETCH x2, SQUEEZE /2, REPEAT x2 back on C4 D4 E4, NUDGE < / > on C#5 D#5; ABOUT's AUDIO LOAD lines and RAMP's curve out for the room); V10.8.48 (the owner: "everything lacks decay and release, all at sustain 100"; "the leads: decay, little sustain, a lot of release"; "the chords all filtered the same: the bands, the whole generator"): GEN's envelopes by role, a part's filter TYPE its own (BP, HP with KEY TRK), the GAIN making up what they take. V10.8.47 (the owner: "play and edit; the information, the names of the section: parts, song, arrange"): PART SLOTS' LOAD is PLAY/EDIT, STORE is SAVE, PLAY's LOOP is PART, a song's END LOOP is REPEAT, a part with no name its bars in the song, NOW is PLAYING, ARRANGE's tokens PART+BARS, JAM's and TAKE's SEQ is PART, CAMBIO is SWITCH. (2026-11-25) V10.8.46 (the owner): GEN: a part never still (its LFO slow and free on the filter and the shape, the stereo, a note's envelope on the shape), the rows' colours an arc, the envelopes by role, the build's high-pass in sixteenths, phonk the drift one alone; MENU > ABOUT's LAST CRASH back; V10.8.45 (the owner): the ARP on its RATE's grid of the transport while it plays, recorded on its steps; MENU > ABOUT's CPU lines and the velocity diagnostic out, the header's load a number; GEN: sections half as long, a row its own colour (the macros) and a section come again varied, DANCE's kit not longer, the build's filter sweep a bar, the envelopes. (2026-11-25) V10.8.44 (the owner): a GATE on the reverb and on the delay (FX > REVERB / DLY, OCT+ held + KNOB 4), a synth's LEVEL page (GAIN LEVEL PAN) after EDIT; V10.8.43 (BYTE's): RADIO: a STOP on the piece's last bar stops (chain.fin: the song's own END alone the next piece); GEN leaves SCL > HARMONY alone (on: the piece on the tonic chord); a lead's preset on a chord part without its fast vibrato. (2026-11-24) V10.8.42 (PR #241's ideas, in this generator): hard bass's DONK (PHASE's resonant saw), DREAM POP an organ's or a guitar's throw and its tape slower, an accented hit never thinned, IDM's roll in the phrase's turnaround; before: (2026-11-24) V10.8.41 (the owner: "the melodies and the drums sound generic", genre by genre): GEN: the riffs motifs of written rhythm and contour cells with an answer (BAILE FUNK, PHONK, DUBSTEP), JAZZ's comping written and its hats down, IDM GLITCH broken cells and placed rolls (no bursts), the basses under the drums and ducked (gen_stems' check), DUBSTEP low FOLD and chorus, CUMBIA, REGGAETON, HOUSE, HARD BASS, SHOEGAZE, DREAM POP as asked; TECHNO darker (phrygian, a line of 7 or 6 beats over the 4, its filter moving), EXPLORE its own: the minor modes, sevenths and ninths, borrowed chords, the drums edited, a cut, lines that evolve; MOOD: CALM lighter to -25, DANCE keeps a half-time's kick, EXPLORE's tempo; the FUGA genre gone (the owner); code no page reaches removed (no visible change). V10.8.40 (a user, the owner): the tempo exact and every DIV on one grid (a beat a multiple of 24 samples, the sequencer's time giving back what that cuts: fx.c beat_samples, seq.c tempo_acc; a 1/32 track was 12 ms a minute ahead of a 1/16 one at 133 BPM); a track's place from the transport's at every step (seq.c seq_anchor: after a LEN oLine truncated
|
||||
#endif
|
||||
#if FELUCCA_OTA && !FELUCCA_FLASH
|
||||
#error "FELUCCA_OTA needs FELUCCA_FLASH"
|
||||
|
||||
@@ -29,7 +29,8 @@ BTAPP_FN static void trackgen_cards_bt(void)
|
||||
}
|
||||
static void trackgen_knob(uint32_t k,int32_t s) {if(bt_hw_seg()) trackgen_knob_bt(k,s);}
|
||||
static void trackgen_cards(void) {if(bt_hw_seg()) trackgen_cards_bt();}
|
||||
static __attribute__((noinline)) void trackgen_make(void)
|
||||
/* (V10.8.53) lo, cnt: the steps written (cnt 0: the whole sequence; SEQ EDIT's GENERATE: its selection, the rest kept) */
|
||||
static __attribute__((noinline)) void trackgen_make(uint32_t lo,uint32_t cnt)
|
||||
{
|
||||
track_t *t=TSEL;uint32_t k=trk_index(t),i,j,n,len,f;
|
||||
const tg_config_t *c=&tg_config[k];
|
||||
@@ -82,10 +83,12 @@ static __attribute__((noinline)) void trackgen_make(void)
|
||||
gp=save.p;gs=save.s;gmut=save.g;gx=save.x;gq=save.q;
|
||||
undo_mark();
|
||||
f=motion_guard();
|
||||
memcpy(t->step,temp.step,len*sizeof(step_t));
|
||||
if(!cnt||lo+cnt>len) lo=0,cnt=len;
|
||||
memcpy(t->step+lo,temp.step+lo,cnt*sizeof(step_t));
|
||||
shift_valid[0][k]=shift_valid[1][k]=0;
|
||||
t->rat_left=t->lr_on=t->ss_n=t->ss_i=0;
|
||||
t->arp_from=t->cv_on=t->csp_n=t->jump_to=t->rev=0;t->seq_active=1;
|
||||
motion_unguard(f);
|
||||
ui_message("TRACK GENERATED");ui.force=1;
|
||||
if(cnt==len) ui_message("TRACK GENERATED");
|
||||
ui.force=1;
|
||||
}
|
||||
+1
-1
@@ -35,7 +35,7 @@ static void undo_mark(void); /* (0.6.21) project.c: the music
|
||||
static int trackgen_ok(const track_t *t);
|
||||
static void trackgen_knob(uint32_t k,int32_t s);
|
||||
static void trackgen_cards(void);
|
||||
static void trackgen_make(void);
|
||||
static void trackgen_make(uint32_t lo, uint32_t cnt);
|
||||
static void system_init(void); /* (0.6.40) project.c: INIT SYSTEM */
|
||||
static int project_clear(void); /* (V10.7.22) project.c: CLEAR PROJECT */
|
||||
static int undo_do(void); /* .. back (and again: forward) */
|
||||
|
||||
+19
-43
@@ -506,12 +506,12 @@ static void draw_column_tall(uint32_t c, const char *label, const char *val, con
|
||||
vc == T_ACCENT || vc == T_DIM ? vc : T_KEY, T_INK, T_BG);
|
||||
} else if (val[0]) {
|
||||
int why = !large_face_has(val) ? 1 : ink_w(vf, val) > COL_W - 6 ? 2 : 0;
|
||||
if (why) /* (a number L cannot hold: V, the same 14 px capitals, narrower) */
|
||||
vf = face_has(&AF_V, val) && ink_w(&AF_V, val) <= COL_W - 6 ? &AF_V : &AF_M;
|
||||
if (why) /* (a number L cannot hold: M; V10.8.53 the V face gone, its room) */
|
||||
vf = &AF_M;
|
||||
if (vf == &AF_M && ink_w(vf, val) > COL_W - 6)
|
||||
vf = &AF_S, why = 3;
|
||||
LARGE_HOOK(val, why);
|
||||
vy = vf == &AF_L ? LG_VB - AF_L_CAP_Y : vf == &AF_V ? LG_VB + HALF_UP(AF_L_CAP_H - AF_V_CAP_H) - AF_V_CAP_Y :
|
||||
vy = vf == &AF_L ? LG_VB - AF_L_CAP_Y :
|
||||
vf == &AF_M ? LG_VB + HALF_UP(AF_L_CAP_H - AF_M_CAP_H) - AF_M_CAP_Y
|
||||
: LG_VB + HALF_UP(AF_L_CAP_H - AF_S_CAP_H) - AF_S_CAP_Y;
|
||||
if (vf == &AF_S && ink_w(vf, val) > COL_W - 2) { /* (a value always fits: the lint reports one cut) */
|
||||
@@ -688,10 +688,8 @@ static void draw_column(uint32_t c, const char *label, const char *val, const ch
|
||||
key[n + 12] = (char)(curve == DJF_NOCURVE ? '#' : 0x80 | ((curve + 64) & 127)); /* (0.9.1) the DJ FILTER's curve */
|
||||
key[n + 13] = 0;
|
||||
uw = unit[0] ? text_w(&AF_S, unit) + 3 : 0;
|
||||
if (face_has(&AF_V, val) && val[0] && text_w(&AF_V, val) + uw <= room) /* a number: in V (capitals 14 px) where it and
|
||||
* its unit fit the card; else M (11), else S (9) */
|
||||
vf = &AF_V;
|
||||
else if (text_w(vf, val) + uw > room)
|
||||
if (text_w(vf, val) + uw > room) /* M (11) where it and its unit fit the card, else S (9); (V10.8.53)
|
||||
* the V face (14 px numbers) gone, its room */
|
||||
vf = &AF_S;
|
||||
sig = (uint8_t)str_hash(str_hash(song.sel + TSEL->eng_req * 4u + ux.gen * 64u + lz_on() * 16u, label), unit);
|
||||
snap = ui.force || sig != ui.roll[c].sig; /* what the value is of: label, unit, track, engine, palette */
|
||||
@@ -750,17 +748,16 @@ static void draw_column(uint32_t c, const char *label, const char *val, const ch
|
||||
cv_scroll = 0;
|
||||
if (kid >= 0) /* "[OCT+]": the keycap (accent: it would act; DIM: it would not) */
|
||||
x = cv_keycap(5, ry + 2, (uint32_t)kid, vc == T_ACCENT || vc == T_DIM ? vc : T_KEY, T_INK, cb);
|
||||
else if (vf != &AF_S) { /* (M: its capitals rows ry + 3 .. 13; V: its figures ry .. ry + 15,
|
||||
* inside the strip that rolls; its unit a row lower, on its line) */
|
||||
else if (vf != &AF_S) { /* (M: its capitals rows ry + 3 .. 13, inside the strip that rolls) */
|
||||
if (!ui.roll[c].from[0] && val[0] && vf == &AF_M)
|
||||
GFX_HOOK_ALIGN(0, ry, COL_W, ry + ROLL_H, AL_V, "card value in its roll window");
|
||||
x = roll_text(c, 5, vf == &AF_V ? ry - AF_V_CAP_Y + 1 : ry - 1, val, vc, vf);
|
||||
x = roll_text(c, 5, ry - 1, val, vc, vf);
|
||||
} else if (free) /* (a name: ellipsised where it must be) */
|
||||
x = cv_free_text(5, ry + 2, vf, val, vc, cb, room - uw);
|
||||
else
|
||||
x = cv_text_fit(5, ry + 2, vf, val, vc, cb, room - uw);
|
||||
if (unit[0]) {
|
||||
int32_t uy = vf == &AF_V ? ry - AF_V_CAP_Y + 1 + AF_V.asc - AF_S.asc : ry + 2;
|
||||
int32_t uy = ry + 2;
|
||||
GFX_HOOK_ALIGN(0, 0, 0, uy + AF_S.asc, AL_B, "card unit on its value's baseline");
|
||||
cv_text_on(x + 3, uy, &AF_S, unit, T_MID, cb); /* on the value's baseline (S) */
|
||||
}
|
||||
@@ -1888,52 +1885,31 @@ static void seg_screen(uint32_t full)
|
||||
}
|
||||
|
||||
/* the count-in (seq.c, MENU > COUNT-IN; 1.1, Discussion #131): over the page until the sequencer starts. Its bar's four
|
||||
* beats counted down, 4 3 2 1, in four cells (the beat now filled THEME, those gone dim), with 2 BARS which bar it is;
|
||||
* PLAY stops it. Drawn again on each beat (seq.c's state; the header stays live) */
|
||||
#define CI_Y 88 /* the cells: 4 x 48 px, 8 px apart, 72 tall */
|
||||
#define CI_H 72
|
||||
* beats counted down, "4 3 2 1" on one line (the beat now THEME, those gone dim), with 2 BARS which bar it is; PLAY
|
||||
* stops it. Drawn again on each beat (seq.c's state; the header stays live). (V10.8.53) one line of figures (were four
|
||||
* cells): its room */
|
||||
static __attribute__((noinline)) void draw_countin(void)
|
||||
{
|
||||
static uint32_t shown;
|
||||
uint32_t total = cin_total, e = total - cin_left, j, sig = total * 64u + e + 1u;
|
||||
char sub[16];
|
||||
int full = ui.force || shown / 64u != total; /* (0.9.0) a beat: its cells and the bar only (was the whole screen) */
|
||||
if (!ui.force && shown == sig)
|
||||
return;
|
||||
shown = sig;
|
||||
if (full) { /* (round what it draws, not under it too) */
|
||||
const int16_t R[5][4] = {{0, 44, 240, AF_M.h}, {0, 66, 240, AF_S.h}, {12, CI_Y, 216, CI_H},
|
||||
{0, CI_Y + CI_H + 14, 240, AF_S.h}, {0, 206, 240, KC_H + 2}};
|
||||
fill_around(R, 5);
|
||||
ui.head_sig = ~0u;
|
||||
draw_text_box(0, 44, 240, &AF_M, "COUNT-IN", T_TEXT, 1);
|
||||
}
|
||||
if (total > 4u) {
|
||||
str_cpy(sub, "BAR 1 OF 2", sizeof sub);
|
||||
sub[4] = (char)('1' + e / 4u % 9u);
|
||||
sub[9] = (char)('0' + total / 4u % 10u);
|
||||
} else
|
||||
str_cpy(sub, "1 BAR", sizeof sub);
|
||||
draw_text_box(0, 66, 240, &AF_S, sub, T_MID, 1);
|
||||
cv_begin(216, CI_H, T_BG);
|
||||
lcd_fill(0, H_HEAD, 240, 240u - H_HEAD, T_BG);
|
||||
ui.head_sig = ~0u;
|
||||
draw_text_box(0, 44, 240, &AF_M, "COUNT-IN", T_TEXT, 1);
|
||||
str_cpy(sub, "BAR 1 OF 2", sizeof sub);
|
||||
sub[4] = (char)('1' + e / 4u % 9u);
|
||||
sub[9] = (char)('0' + total / 4u % 10u);
|
||||
draw_text_box(0, 66, 240, &AF_S, total > 4u ? sub : "1 BAR", T_MID, 1);
|
||||
for (j = 0; j < 4u; j++) {
|
||||
int32_t x = (int32_t)j * 56;
|
||||
char d[2] = {(char)('4' - j), 0};
|
||||
int now = j == e % 4u, gone = j < e % 4u;
|
||||
uint16_t fill = now ? T_THEME : T_SURF;
|
||||
cv_rrect(x, 0, 48, CI_H, 8, fill, T_BG);
|
||||
GFX_HOOK_ALIGN(x, 0, x + 48, CI_H, AL_HV, "count-in beat centred in its cell");
|
||||
cv_text_in(x, CAP_IN(L, CI_H), 48, &AF_L, d, now ? T_INK : gone ? T_DIM : T_TEXT, fill);
|
||||
}
|
||||
cv_blit(12, CI_Y);
|
||||
if (!full) {
|
||||
ui.force = 0;
|
||||
return;
|
||||
draw_text_box(36 + (int32_t)j * 44, 110, 36, &AF_L, d, j == e % 4u ? T_THEME : j < e % 4u ? T_DIM : T_TEXT, 1);
|
||||
}
|
||||
{ /* PLAY stops it */
|
||||
int32_t x = HALF_UP(240 - kh_ink(KC_PLAY, "STOP"));
|
||||
cv_begin(240, KC_H + 2, T_BG);
|
||||
GFX_HOOK_ALIGN(0, 0, 240, 0, AL_H | AL_N(2), "count-in key centred");
|
||||
cv_key_hint(x, 1, KC_PLAY, "STOP", 1, T_BG);
|
||||
cv_blit(0, 206);
|
||||
lcd_sync();
|
||||
|
||||
@@ -26,6 +26,7 @@ static void lz_tile(int32_t x, int32_t y, int32_t w, int32_t h, int sel, uint16_
|
||||
/* the height ADSR and LFO are drawn on: 100 px, or (MENU > LARGE's strip: draw_graph) the strip's ~ 56 */
|
||||
static int32_t graph_ht = 100;
|
||||
#include "ui_organic.c" /* JIANT FM's organic line art (drawn by code) */
|
||||
#include "ui_gx.c" /* (V10.8.53) the pictures' shared engine */
|
||||
static uint16_t heat_col(int32_t v);
|
||||
static uint16_t note_col(uint32_t n); /* (V10.6i) ui_lzpage.c: a note's own colour */
|
||||
#include "ui_scene.c" /* (V10.25) SCL > SCENE: the multitimbral page */
|
||||
@@ -156,8 +157,7 @@ static void graph_lfo(const track_t *t, uint16_t c)
|
||||
uint16_t tc = TRK_COL[(uint32_t)(t - trk) % 6u];
|
||||
char b[16];
|
||||
(void)c;
|
||||
for (i = 0; i < 64; i += 2) /* its orbit, dotted; the axis */
|
||||
cv_pset(ox + (a * og_cos((uint32_t)i * 1024u) >> 15), cy + (a * og_sin((uint32_t)i * 1024u) >> 15), T_DIM);
|
||||
/* (V10.8.53) the axis (its orbit's dots gone: the room) */
|
||||
for (x = PANEL_X0; x < PANEL_X0 + PANEL_W; x += 3) cv_pset(x, cy, T_LINE);
|
||||
for (x = 0; x < PANEL_X0 + PANEL_W - x0; x++) { /* the wave it wrote, the newest nearest */
|
||||
uint32_t ph = t->lfo_ph - (uint32_t)x * span;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only
|
||||
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) */
|
||||
/* (V10.8.53, the owner: "todos los gráficos del sistema vengan del mismo motor así se achica el espacio que ocupan")
|
||||
* the pictures' shared engine: a few primitives every lens and page picture draws with (included by ui_graph.c)
|
||||
* gx_col a column of 5 px cells from yb up (v 0..1000 of h lit, the rest SURF; c 0: the heat ramp by its row)
|
||||
* gx_sine a sine's line (k cycles over w, phase ph, amplitude a, clamped to lo .. hi)
|
||||
* gx_chip a box with its word centred (X), the pictures' chips and tags
|
||||
* gx_keys oct octaves of keys from x (white keys sp apart, wh tall; the black ones 2/3 of them), col[r] the colour
|
||||
* of semitone r (0: the key's own), lab[r] its word on it (0: none) */
|
||||
static uint16_t heat_col(int32_t v);
|
||||
static int32_t bg_sin(uint32_t a);
|
||||
static void gx_col(int32_t x, int32_t yb, int32_t cw, int32_t h, int32_t v, uint16_t c)
|
||||
{
|
||||
int32_t r, nr = h / 6, on = clamp(v, 0, 1000) * nr / 1000;
|
||||
for (r = 0; r < nr; r++)
|
||||
cv_rect(x, yb - (r + 1) * 6, cw, 5, r < on ? (c ? c : heat_col(60 + r * 190 / (nr ? nr : 1))) : T_SURF);
|
||||
}
|
||||
static void gx_sine(int32_t x, int32_t mid, int32_t w, int32_t a, uint32_t k, uint32_t ph, uint16_t c, int32_t lo, int32_t hi)
|
||||
{
|
||||
int32_t i, py = 0;
|
||||
for (i = 0; i <= w; i++) {
|
||||
int32_t yy = clamp(mid + (bg_sin((uint32_t)(i * 65536 / (w ? w : 1)) * k + ph) * a >> 15), lo, hi);
|
||||
if (i) cv_line_t(x + i - 1, py, x + i, yy, c, 2);
|
||||
py = yy;
|
||||
}
|
||||
}
|
||||
static void gx_chip(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t bg, const char *s, uint16_t ink)
|
||||
{
|
||||
cv_rect(x, y, w, h, bg);
|
||||
if (s && s[0])
|
||||
cv_text_in(x, y + CAP_IN(X, h), w, &AF_X, s, ink, bg);
|
||||
}
|
||||
static void gx_keys(int32_t x, int32_t y, uint32_t oct, int32_t sp, int32_t wh, const uint16_t *col, const char *const *lab)
|
||||
{
|
||||
static const uint8_t WK[7] = {0, 2, 4, 5, 7, 9, 11}, BK[5] = {1, 3, 6, 8, 10}, BX[5] = {1, 2, 4, 5, 6};
|
||||
uint32_t o, k;
|
||||
int32_t bw = sp * 2 / 3, bh = wh * 6 / 10;
|
||||
for (o = 0; o < oct; o++)
|
||||
for (k = 0; k < 12u; k++) {
|
||||
int blk = k >= 7u;
|
||||
uint32_t r = o * 12u + (blk ? BK[k - 7u] : WK[k]);
|
||||
int32_t kx = x + (int32_t)(o * 7u) * sp + (blk ? (int32_t)BX[k - 7u] * sp - bw / 2 : (int32_t)k * sp);
|
||||
int32_t kw = blk ? bw : sp - 1, kh = blk ? bh : wh;
|
||||
uint16_t c = col[r] ? col[r] : blk ? 0x10A2u : T_RAISE;
|
||||
gx_chip(kx, y + kh - 14, kw, 14, c, lab[r], T_INK);
|
||||
cv_rect(kx, y, kw, kh - 14, c);
|
||||
}
|
||||
}
|
||||
@@ -862,10 +862,10 @@ BTAPP_FN static void cp_say(const char *what, uint32_t lo, uint32_t n) /* (V10
|
||||
}
|
||||
|
||||
/* (V10.8.51) step keys held on SEQ's roll, two or more: "SEL 5-8", the range kept (cp_sel: its first | its last << 8, bit
|
||||
* 15 on) for SEQ TOOLS' STRETCH SQUEEZE REPEAT (ui_tools.c tl_shape: once). Only a key pressed changes it (keys let go
|
||||
* 15 on) for SEQ EDIT (ui_tools.c se_do; V10.8.52: kept until SEQ EDIT's OCT- / G3, each track its own). Only a key pressed changes it (keys let go
|
||||
* keep it): two or more held, their range; one alone, none. (In clay.c's clay_sp, unused since V10.8.21: no RAM of its
|
||||
* own, nothing of the sound moved; [1] the bar's keys held the pass before) */
|
||||
#define cp_sel (clay_sp[0])
|
||||
#define cp_sel (clay_sp[2u + song.sel % NTRK]) /* (V10.8.52: the track's own, ui_tools.c sel_of) */
|
||||
static void sel_poll(void)
|
||||
{
|
||||
uint64_t m;
|
||||
@@ -1737,7 +1737,7 @@ static __attribute__((noinline)) void act_do(void)
|
||||
uint32_t c = act_col(), id, k = (uint32_t)song.g[G_SLOT] - 1u;
|
||||
if (!c--)
|
||||
return;
|
||||
if(cur_page()->graph==GR_TRACKGEN) {trackgen_make();return;}
|
||||
if(cur_page()->graph==GR_TRACKGEN) {trackgen_make(0,0);return;}
|
||||
if (cur_page()->graph == GR_MOTION) {
|
||||
if (chain_busy()) { ui_message("SONG PLAYS: STOP IT TO EDIT"); return; }
|
||||
confirm_open(CF_CLEAR_MOTION, song.sel);
|
||||
|
||||
+82
-62
@@ -61,7 +61,7 @@ static const layer_t LAYERS[LAYER_N] = {
|
||||
{B_SCL, LK_SET, FAM_SCL, "[SCL] SET", {{KC_KEYS, "ROOT"}, {KC_SCL, "DONE"}, {0, 0}}},
|
||||
{B_EDIT, LK_SET, FAM_EDIT, "[EDIT] SET", {{KC_SELECT, "DICE"}, {KC_K14, "TWEAK"}, {KC_KEYS, "INIT / RECALL"}}}, /* (0.9.9-seq2e:
|
||||
* KNOB 1..4 MOMENTARY: mom_knob; seq2f: SELECT the sound dice) */
|
||||
{B_SEQ, LK_SET, FAM_SEQ, "[SEQ] TOOLS", {{KC_REC, "CLEAR ALL"}, {KC_SEQ, "DONE"}, {KC_PLAY, "RESYNC"}}}, /* (0.6.14: REC, all six
|
||||
{B_SEQ, LK_SET, FAM_SEQ, "[SEQ] EDIT", {{KC_OCTUP, "DO IT"}, {KC_OCTDN, "ALL STEPS"}, {KC_KEYS, "F#5 UNDO"}}}, /* (0.6.14: REC, all six
|
||||
* tracks cleared, shown: it was nowhere) */
|
||||
{B_REC, LK_SET, FAM_HOME, "[REC] SET", {{KC_KEYS, "RECORDING"}, {KC_REC, "DONE"}, {0, 0}}},
|
||||
{B_SAVE, LK_SET, FAM_HOME, "[SAVE] SONG", {{KC_KEYS, "PLAY"}, {KC_OCTUP, "SAVE"}, {KC_OCTDN, "RECALL"}}},
|
||||
@@ -491,29 +491,52 @@ static void glo_tap(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* SEQ TOOLS: white key place p's action on the selected track (ui_tools.c), "SONG PLAYS: STOP IT TO EDIT" while a song plays */
|
||||
/* (V10.8.52) SEQ EDIT's white keys (ui_tools.c): F3 CLEAR, G3 ALL (no selection), A3 KNOB 1 / 2 START END <-> MOVE
|
||||
* WIDTH, B3 .. E4 BAR 1 .. 4 selected, F4 CLR AUTO, G4 .. B4 the lane's (DRUM), C5 DUP, D5 the ACTION, E5 COPY, F5
|
||||
* PASTE, G5 CLR STEP; black: the lanes (DRUM), C#5 / D#5 NUDGE < / > (ui_tools.c se_do: the steps selected or all) */
|
||||
static void tools_key(uint32_t p)
|
||||
{
|
||||
const char *m;
|
||||
if (!tl_cell(TSEL, p))
|
||||
return;
|
||||
if (chain_busy()) {
|
||||
ui_message("SONG PLAYS: STOP IT TO EDIT");
|
||||
return;
|
||||
uint32_t len = tl_len(TSEL), a = p == 0u ? SE_CLEAR : p == 7u ? SE_CAUTO : p == 11u ? SE_DUP : p == 13u ? SE_COPY :
|
||||
p == 14u ? SE_PASTE : p == 15u ? SE_CSTEP : SE_N;
|
||||
if (a < SE_N) se_do(a, 0);
|
||||
else if (p == 1u) { cp_sel = 0; ui_message("ALL STEPS"); }
|
||||
else if (p == 2u) se_st ^= 128;
|
||||
else if (p == 12u) se_do((uint32_t)se_st & 127u, se_md);
|
||||
else if (p >= 3u && p <= 6u) {
|
||||
if ((p - 3u) * 16u >= len) ui_message("NO SUCH BAR");
|
||||
else sel_set((p - 3u) * 16u, (p - 3u) * 16u + 15u < len ? (p - 3u) * 16u + 15u : len - 1u);
|
||||
} else if (drum_track(TSEL) && !chain_busy()) {
|
||||
undo_mark();
|
||||
ui_message(tl_do(TSEL, p, ui.lane));
|
||||
}
|
||||
if (!(m = tl_do(TSEL, p, ui.lane)))
|
||||
return;
|
||||
ui_message(m);
|
||||
ui.force = 1;
|
||||
}
|
||||
|
||||
/* (V10.8.49, the owner) SEQ TOOLS' black C#5 / D#5: NUDGE the track's notes a 16th of a step earlier / later */
|
||||
/* KNOB 1 START (MOVE), 2 END (WIDTH): the selection, 3 the ACTION, 4 its amount */
|
||||
static void se_knob(uint32_t k, int32_t d)
|
||||
{
|
||||
uint32_t len = tl_len(TSEL), lo, n, a, b, act = (uint32_t)se_st & 127u;
|
||||
d = d > 0 ? 1 : -1;
|
||||
(void)seq_sel(TSEL, &lo, &n, len);
|
||||
a = lo; b = lo + n - 1u;
|
||||
if (k == 2u) { act = (uint32_t)clamp((int32_t)act + d, 0, SE_N - 1); se_st = (int16_t)((se_st & 128) | act); se_md = SE[act].def; return; }
|
||||
if (k == 3u) { se_md = (int16_t)clamp(se_md + d, SE[act].lo, act == SE_GEN ? (int32_t)NGENRE : SE[act].hi); return; }
|
||||
if (se_st & 128) { /* MOVE, WIDTH */
|
||||
if (!k) a = (uint32_t)clamp((int32_t)a + d, 0, (int32_t)(len - 1u - (b - a))), b = a + n - 1u;
|
||||
else b = (uint32_t)clamp((int32_t)b + d, (int32_t)a, (int32_t)len - 1);
|
||||
} else if (!k) { a = (uint32_t)clamp((int32_t)a + d, 0, (int32_t)len - 1); if (b < a) b = a; }
|
||||
else { b = (uint32_t)clamp((int32_t)b + d, 0, (int32_t)len - 1); if (a > b) a = b; }
|
||||
sel_set(a, b);
|
||||
if (k) ui.bank = (uint8_t)(b / 16u);
|
||||
}
|
||||
/* (V10.8.49, the owner) SEQ TOOLS' black C#5 / D#5: NUDGE the notes (selected: theirs) a 16th of a step earlier / later */
|
||||
static void nudge_key(uint32_t up)
|
||||
{
|
||||
const char *m;
|
||||
uint32_t lo, n;
|
||||
if (chain_busy()) { ui_message("SONG PLAYS: STOP IT TO EDIT"); return; }
|
||||
undo_mark();
|
||||
if ((m = tl_nudge(TSEL, up ? 4 : -4))) { ui_message(m); ui.force = 1; }
|
||||
(void)seq_sel(TSEL, &lo, &n, tl_len(TSEL));
|
||||
if ((m = tl_nudge(TSEL, up ? 4 : -4, lo, n, 0))) { ui_message(m); ui.force = 1; }
|
||||
}
|
||||
|
||||
/* Shared by GLO + G4 and REC + A3. One global undo/redo snapshot. */
|
||||
@@ -575,6 +598,7 @@ static void rec_key(uint32_t p)
|
||||
if (p == 2u) { undo_ui(); return; } /* A3: UNDO / REDO */
|
||||
if (p == 3u) { /* B3: hard quantization off / on */
|
||||
TSEL->p[P_HRQ] = TSEL->p[P_HRQ] ? 0 : 127;
|
||||
ui_say("QUANTIZE ", TSEL->p[P_HRQ] ? "ON" : "OFF"); /* (V10.8.53: said) */
|
||||
return;
|
||||
}
|
||||
if (p == 0u) {
|
||||
@@ -595,10 +619,6 @@ static void rec_key(uint32_t p)
|
||||
#define SK_REC 13u
|
||||
#define SK_PAGE 15u
|
||||
#define SK_NAME 11u /* (0.9.2) C5: NAME, the slot's rename (EDIT's until 0.9.1) */
|
||||
#define TL_COPY 13u
|
||||
#define TL_PASTE 14u
|
||||
#define TL_DUP 11u /* (V10.8.50) C5: DUP (ui_input.c cp_seq) */
|
||||
#define TL_STEP 15u /* (0.9.2) SEQ's G5: CLR STEP (ui_input.c seq_clr_step) */
|
||||
static void song_key(uint32_t p)
|
||||
{
|
||||
uint32_t k;
|
||||
@@ -721,6 +741,7 @@ static void session_dice(uint32_t seed)
|
||||
}
|
||||
|
||||
/* GLO's white keys after the SOLOs (F3 ..): unmute all, tap tempo; KNOB 1..4: the levels from track trk_base4() */
|
||||
static const char *const GLO_GROUP[4]; /* (the DRUM group's names, below) */
|
||||
#define GLO_ALL ((uint32_t)NTRK)
|
||||
#define GLO_TAP 7u
|
||||
#define GLO_UNDO 8u /* (0.6.21) G4: UNDO the last big change (project.c undo_do) */
|
||||
@@ -729,17 +750,22 @@ static __attribute__((noinline)) void layer_key(uint32_t l, uint32_t k)
|
||||
{
|
||||
uint32_t p = key_place(k), i;
|
||||
if (l == LAYER_GLO) {
|
||||
if (key_black(k)) {
|
||||
if (p < NTRK)
|
||||
if (key_black(k)) { /* (V10.8.53, the owner: every combination says what it did) */
|
||||
char n[3] = {'T', (char)('1' + p), 0};
|
||||
if (p < NTRK) {
|
||||
trk[p].p[P_MUTE] = (int16_t)!trk[p].p[P_MUTE];
|
||||
else if (p < NTRK + 4u)
|
||||
ui_say(n, trk[p].p[P_MUTE] ? " MUTED" : " ON");
|
||||
} else if (p < NTRK + 4u) {
|
||||
dx_mute_set(dx_mute ^ (1u << (p - NTRK)));
|
||||
ui_say(GLO_GROUP[p - NTRK], (dx_mute >> (p - NTRK)) & 1u ? " MUTED" : " ON");
|
||||
}
|
||||
} else if (p < NTRK) {
|
||||
lys.solo |= 1u << k; /* (layer_masks: perf_solo while held) */
|
||||
} else if (p == GLO_ALL) {
|
||||
for (i = 0; i < NTRK; i++)
|
||||
trk[i].p[P_MUTE] = 0;
|
||||
dx_mute_set(0);
|
||||
ui_message("ALL UNMUTED");
|
||||
} else if (p == GLO_TAP) {
|
||||
glo_tap();
|
||||
} else if (p == GLO_UNDO) {
|
||||
@@ -747,6 +773,7 @@ static __attribute__((noinline)) void layer_key(uint32_t l, uint32_t k)
|
||||
}
|
||||
} else if (l == LAYER_SCL) {
|
||||
TSEL->p[P_ROOT] = (int16_t)((k + 5u) % 12u); /* the key's note name (F3 = F) */
|
||||
ui_say("ROOT ", NN12[TSEL->p[P_ROOT]]);
|
||||
} else if (l == LAYER_EDIT && key_black(k) && p < NLANE && drum_track(TSEL)) {
|
||||
dx_mute_set(dx_mute ^ DXM_LANE(p)); /* DRUM: black keys 1..8 mute each sound (lit = sounding) */
|
||||
} else if (l == LAYER_EDIT && !key_black(k) && p <= LY_RECALL) {
|
||||
@@ -760,14 +787,12 @@ static __attribute__((noinline)) void layer_key(uint32_t l, uint32_t k)
|
||||
if (!key_black(k) && p < 4u)
|
||||
rec_key(p);
|
||||
} else if (l == LAYER_SEQ) {
|
||||
if (!key_black(k) && (p == TL_COPY || p == TL_PASTE || p == TL_DUP))
|
||||
cp_seq(p == TL_DUP ? 2u : p - TL_COPY);
|
||||
else if (!key_black(k) && p == TL_STEP)
|
||||
seq_clr_step(); /* (0.9.2) G5: CLR STEP (AUTO LIST: the record) */
|
||||
else if (!key_black(k))
|
||||
if (!key_black(k))
|
||||
tools_key(p);
|
||||
else if (p == 8u || p == 9u)
|
||||
nudge_key(p == 9u); /* (V10.8.49) C#5 / D#5: NUDGE < / > */
|
||||
else if (p == 10u)
|
||||
se_undo(); /* (V10.8.52) F#5: UNDO / REDO the last edit */
|
||||
else if (p < NLANE && drum_track(TSEL))
|
||||
ui.lane = (uint8_t)p; /* (black keys 1..8: the lane, as on the grid) */
|
||||
} else if (l == LAYER_SAVE && !key_black(k)) {
|
||||
@@ -805,6 +830,9 @@ static void layer_knob(uint32_t k, int32_t s)
|
||||
*vp = (int16_t)clamp(*vp + accel(EN_K1 + k, s, TP[P_LEVEL].max - TP[P_LEVEL].min), TP[P_LEVEL].min,
|
||||
TP[P_LEVEL].max);
|
||||
motion_capture(t, P_LEVEL, *vp);
|
||||
} else if (l == LAYER_SEQ) { /* (V10.8.52) SEQ EDIT */
|
||||
se_knob(k, s);
|
||||
ui.force = 1;
|
||||
} else if (l == LAYER_SAVE) { /* KNOB 1: the song (in when SAVE lets go); 2..4: none */
|
||||
if (k == 0u)
|
||||
lys.song = (uint8_t)(clamp((int32_t)(lys.song ? lys.song - 1u : song_cur) + (s > 0 ? 1 : -1), 0,
|
||||
@@ -868,6 +896,8 @@ static uint32_t layer_oct(uint32_t pressed, uint32_t oct)
|
||||
if (ui.ly && (pressed & (1u << dn | 1u << up)))
|
||||
lys.used = 1; /* (0.6.44: an OCT with it: no FX lock) */
|
||||
mine = oct & lys.oct;
|
||||
if (lys.l == LAYER_SEQ && mine) /* (V10.8.52) SEQ EDIT: OCT+ the ACTION, OCT- ALL STEPS */
|
||||
tools_key(mine & 2u ? 12u : 1u);
|
||||
if ((mine & 1u) && lys.l == LAYER_FX) { /* OCT- (FX LATCH): every effect and macro off */
|
||||
perf_latched = 0;
|
||||
perf_k[0] = perf_k[1] = perf_k[2] = perf_k[3] = 0;
|
||||
@@ -924,9 +954,9 @@ static uint32_t layer_leds(uint32_t *br)
|
||||
} else if (l == LAYER_EDIT && p < NLANE && drum_track(TSEL)) { /* DRUM: a sound sounding lit, muted dark */
|
||||
on = !dx_lane_muted(p);
|
||||
} else if (l == LAYER_SEQ) { /* the tools breathe (not while a song plays); DRUM: the lane */
|
||||
on = b && p < NLANE && drum_track(TSEL) && p == ui.lane; /* lit, the other lanes breathe */
|
||||
can = b ? (p < NLANE && drum_track(TSEL)) || ((p == 8u || p == 9u) && !chain_busy()) : p == TL_COPY ? 1u : p == TL_PASTE || p == TL_DUP ? clip.n && !chain_busy() : tl_cell(TSEL, p) && !chain_busy() &&
|
||||
(p != TL_CAUTO || motion_count(TSEL)); /* (CLR AUTO: automation to clear; REVERT: an anchor) */
|
||||
on = b ? p < NLANE && drum_track(TSEL) && p == ui.lane : p == 2u && (se_st & 128); /* lit, the other lanes breathe */
|
||||
can = b ? (p < NLANE && drum_track(TSEL)) || ((p == 8u || p == 9u) && !chain_busy()) :
|
||||
!chain_busy() && (p < 8u || p > 10u || drum_track(TSEL)) && (p != 14u || clip.n);
|
||||
} else if (l == LAYER_SAVE && !b) { /* the section playing lit, the saved ones and the */
|
||||
on = (p < SK_STORE && live.cur == (int8_t)p) || (p == SK_REC && live.srec) || /* actions breathe */
|
||||
(p == SK_MODE && live.mode);
|
||||
@@ -959,8 +989,6 @@ static const char B_NOTE[11] = {'F', 'G', 'A', 'C', 'D', 'F', 'G', 'A', 'C', 'D'
|
||||
static const uint8_t PK_BLK[11] = {1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 15}; /* a black key: left of white key n */
|
||||
enum { LS_OFF, LS_SEL, LS_HELD, LS_WAIT, LS_DIM, LS_MUTE };
|
||||
static const char *const GLO_GROUP[4] = {"KICK", "SNARE", "HAT", "PERC"};
|
||||
static const char *const TL_NAME[TL_N] = {"CLEAR", "REVERSE", "SHIFT <", "SHIFT >", "STRETCH", "SQUEEZE", "REPEAT", "CLR AUTO",
|
||||
"CLR", "REV", "FILL", "RND"};
|
||||
#define LMC_TW 140 /* MACRO's routes: their width (x 92 .. 232) */
|
||||
static uint32_t macro_routes(uint32_t m, char *b, uint32_t n)
|
||||
{
|
||||
@@ -1069,35 +1097,6 @@ static uint32_t ly_keyname(uint32_t l, int blk, uint32_t p, char *nm)
|
||||
str_cpy(nm, p == LY_INIT ? (drum_track(TSEL) ? "INIT+KIT" : "INIT") : drum_track(TSEL) ? "RCL+KIT" : "RECALL", 12);
|
||||
return p == LY_RECALL ? (edit_recallable() ? LS_OFF : LS_DIM) : busy; /* (V10.6z8: RECALL in a song too) */
|
||||
}
|
||||
if (l == LAYER_SEQ) {
|
||||
if (blk) {
|
||||
if (p < NLANE && drum_track(TSEL)) {
|
||||
str_cpy(nm, drum_lane_abbr(TSEL, p), 12);
|
||||
return p == ui.lane % NLANE ? LS_SEL : LS_OFF;
|
||||
}
|
||||
if (p == 8u || p == 9u) { /* (V10.8.49) NUDGE */
|
||||
str_cpy(nm, p == 9u ? "NUDGE >" : "NUDGE <", 12);
|
||||
return busy;
|
||||
}
|
||||
return LS_OFF;
|
||||
}
|
||||
if (p == TL_COPY || p == TL_PASTE || p == TL_DUP) {
|
||||
str_cpy(nm,p == TL_COPY ? "COPY SEQ" : p == TL_DUP ? "DUP" : "PASTE SEQ",12);
|
||||
return p != TL_COPY && (!clip.n || chain_busy()) ? LS_DIM : LS_OFF;
|
||||
}
|
||||
if (p == TL_STEP) { /* (0.9.2) G5 */
|
||||
str_cpy(nm, cur_page()->graph == GR_EVENTS ? "DEL REC" : "CLR STEP", 12);
|
||||
return busy;
|
||||
}
|
||||
if (!tl_cell(TSEL, p))
|
||||
return LS_OFF;
|
||||
str_cpy(nm, TL_NAME[p], 12);
|
||||
if (p >= TL_LCLR) { /* the lane's: "CLR BD" */
|
||||
str_cpy(nm + str_len(nm), " ", 2);
|
||||
str_cpy(nm + str_len(nm), drum_lane_abbr(TSEL, ui.lane), 12 - str_len(nm));
|
||||
}
|
||||
return busy;
|
||||
}
|
||||
if (l == LAYER_REC) {
|
||||
if (blk || p > 3u)
|
||||
return LS_OFF;
|
||||
@@ -1454,6 +1453,16 @@ static __attribute__((noinline)) void layer_cards(uint32_t l)
|
||||
rec_columns();
|
||||
} else if (l == LAYER_EDIT) { /* (0.9.9-seq2f) ENG, No. (PRESETS), FAV (ui_draw.c) */
|
||||
engine_columns();
|
||||
} else if (l == LAYER_SEQ) { /* (V10.8.52) SEQ EDIT: START END (MOVE WIDTH), ACTION, AMOUNT */
|
||||
uint32_t lo, n, a = (uint32_t)se_st & 127u, on = (uint32_t)seq_sel(TSEL, &lo, &n, tl_len(TSEL)), mv = (uint32_t)se_st >> 7 & 1u;
|
||||
fmt_int(val, (int32_t)lo + 1);
|
||||
text_column(0, mv ? "MOVE" : "START", on ? val : "ALL", on ? VAL(0u) : T_DIM);
|
||||
fmt_int(val, (int32_t)(mv ? n : lo + n));
|
||||
text_column(1, mv ? "WIDTH" : "END", on ? val : "ALL", on ? VAL(1u) : T_DIM);
|
||||
hot_text_column(2, "ACTION", SE[a].nm);
|
||||
se_amt(a, val);
|
||||
text_column(3, SE[a].f == 'p' ? "MODE" : SE[a].f == '%' ? "AMOUNT" : SE[a].f == 'n' ? "64THS" : SE[a].f ? "BY" : "",
|
||||
val, SE[a].f ? VAL(3u) : T_DIM);
|
||||
} else { /* the page's four (SCL: LY_SCL) */
|
||||
uint8_t h = ui.home, pg = ui.page, nm[sizeof ui.nmem];
|
||||
memcpy(nm, ui.nmem, sizeof nm);
|
||||
@@ -1625,7 +1634,9 @@ static __attribute__((noinline)) void draw_layer(void)
|
||||
live.dirty * 977u + lys.nqc * 4099u + (chain.running ? chain.row * 13u + chain.remaining * 17u : 0u) +
|
||||
(lys.song * 8u + song_cur) * 65537u;
|
||||
else if (l == LAYER_SEQ)
|
||||
sig += (uint32_t)drum_track(TSEL) * 31u + ui.lane * 5u + (uint32_t)chain_busy() * 3u + (uint32_t)TSEL->p[P_E0] * 131u + song.sel * 977u;
|
||||
sig += (uint32_t)drum_track(TSEL) * 31u + ui.lane * 5u + (uint32_t)chain_busy() * 3u + steps_hash(TSEL) * 131u + song.sel * 977u +
|
||||
(uint16_t)cp_sel * 7u + ui.bank * 13u + ui.cursor * 17u + (song.playing ? pr_head_step(TSEL, 0) * 4099u : 0u) +
|
||||
(uint32_t)TSEL->p[P_SLEN] * 65537u;
|
||||
else
|
||||
sig += snd_id() * 31u + (uint32_t)preset_favorite() * 13u + (uint32_t)chain_busy() * 3u + (uint32_t)(project_recall_slot() + 1) * 5u + dx_mute * 7919u +
|
||||
(uint32_t)drum_track(TSEL) * 11u + up_gen * 101u;
|
||||
@@ -1635,7 +1646,16 @@ static __attribute__((noinline)) void draw_layer(void)
|
||||
cv_rrect(4, 0, 232, (int32_t)graph_h(), 6, T_SURF, T_BG);
|
||||
cv_bg = T_SURF;
|
||||
if (l == LAYER_FX && !pk.edit) ly_fx_cells(); /* (V10.7.77, the owner) FX: the effects as cells, as before 0.8.9 */
|
||||
else ly_piano(l); /* MAP: the keyboard (V10.7.66: KNOBS / STATE gone) */
|
||||
else if (l == LAYER_SEQ) { /* (V10.8.52) SEQ EDIT: the roll (the lanes), the steps selected */
|
||||
uint32_t lo, n, i, dr = (uint32_t)drum_track(TSEL), on = (uint32_t)seq_sel(TSEL, &lo, &n, tl_len(TSEL));
|
||||
int32_t x, w;
|
||||
if (dr) graph_grid(TSEL, T_THEME); else graph_roll(TSEL, 0);
|
||||
for (i = 0; on && i < 16u; i++)
|
||||
if (ui.bank * 16u + i >= lo && ui.bank * 16u + i < lo + n) {
|
||||
seq_col(dr, i, &x, &w);
|
||||
cv_rect(x, 0, w + 1, 3, T_ACCENT);
|
||||
}
|
||||
} else ly_piano(l); /* MAP: the keyboard (V10.7.66: KNOBS / STATE gone) */
|
||||
if (l == LAYER_FX && !pk.edit && bn_on(2)) /* (V10.8.9, the owner) the punch-in held, large (V10.8.13: */
|
||||
hold_banner(bn_nm, bn_k, pfx_rec_ok()); /* 0.6 s after the key, never a latch's) */
|
||||
cv_blit(0, graph_y());
|
||||
|
||||
+48
-111
@@ -33,73 +33,40 @@ static void fxg_label(int32_t x, int32_t y, const char *s, uint16_t c, int right
|
||||
else
|
||||
cv_text(x, y + 3, &AF_X, s, c);
|
||||
}
|
||||
/* (V10.8.15, JIANT BYTE's "tunnel" (GPL, as BYTE has it), the owner's pick) DELAY: each echo heard a frame going into the
|
||||
* centre, the first the track's colour, the one sounding yellow; WIDE / PITCH / PING / DRIVE move and tint them */
|
||||
static void fxg_frame(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t c, int32_t t)
|
||||
{
|
||||
cv_rect(x, y, w, t, c); cv_rect(x, y + h - t, w, t, c);
|
||||
cv_rect(x, y, t, h, c); cv_rect(x + w - t, y, t, h, c);
|
||||
}
|
||||
/* (V10.8.53) DELAY, REVERB and CHORUS drawn with the shared engine (ui_gx.c: gx_col, gx_sine; were three pictures of
|
||||
* their own: the tunnel, the cells' tail, three sines and an orbit) */
|
||||
/* DELAY: each echo a column, MIX's height the first and each FDBK lower, TIME apart (the slower the wider), the one
|
||||
* sounding yellow (a pulse running along them while it sounds); "1/8 . 5 ECHOES" */
|
||||
static void fxg_delay(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
char b[24];
|
||||
const char *u;
|
||||
int32_t i, n, a = 1000, fb = song.g[G_DFDBK], tone = song.g[G_DCOLOR], en = fxg_en(), top = w > 120 ? y + 12 : y;
|
||||
int32_t hh = y + h - top, cx = x + w / 2, cy = top + hh / 2, fw = w * 85 / 100, fh = hh * 95 / 100, run;
|
||||
int32_t wide = song.g[G_WIDTH], pit = song.g[G_DPIT], ping = song.g[G_DPING], drv = song.g[G_DDRV];
|
||||
int32_t lv[14];
|
||||
uint16_t tc = FXG_TC;
|
||||
for (n = 0; n < 14 && a > 40; n++) { lv[n] = a; a = a * (fb > 127 ? 127 : fb) / 127; }
|
||||
run = en && n ? (int32_t)(anim_fr / 3u % (uint32_t)n) : -1;
|
||||
if (drv)
|
||||
cv_rect(cx - fw / 2 + 2, cy - fh / 2 + 2, fw - 4, fh - 4, ux_mix(T_BG, tc, drv / 2));
|
||||
for (i = 0; i < 4; i++) {
|
||||
int32_t ex = cx + (i & 1 ? fw / 2 : -fw / 2), ey = cy + (i & 2 ? fh / 2 : -fh / 2), k;
|
||||
for (k = 0; k < 32; k += 2)
|
||||
cv_pset(ex + (cx - ex) * k / 32, ey + (cy - ey) * k / 32, T_LINE);
|
||||
}
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
int32_t d = 1000000 / (1000 + i * 450), side = i & 1 ? -1 : 1;
|
||||
int32_t ox = side * (wide * 30 / 127 + (ping ? w / 6 : 0)) * (1000 - d) / 1000, oy = -pit * 12 / 10 * (1000 - d) / 1000;
|
||||
int32_t ww = fw * d / 1000, wh = fh * d / 1000, fx = cx + ox - ww / 2, fy = cy + oy - wh / 2;
|
||||
uint16_t c = i == run ? HUD_YE : i == 0 ? tc : FXG_H((40 + lv[i] * 200 / 1000) * (1000 - tone * 700 / 127) / 1000 * (1000 - i * 50) / 1000);
|
||||
if (ww < 3 || wh < 3) continue;
|
||||
fxg_frame(fx, fy, ww, wh, c, i == 0 || i == run ? 2 : 1);
|
||||
}
|
||||
if (w > 120) {
|
||||
int32_t tw;
|
||||
int32_t n, a = 1000, fb = clamp(song.g[G_DFDBK], 0, 127), top = w > 120 ? 12 : 0, run, sp;
|
||||
for (n = 0; n < 14 && a > 40; n++) a = a * fb / 127;
|
||||
run = fxg_en() && n ? (int32_t)(anim_fr / 3u % (uint32_t)n) : -1;
|
||||
sp = clamp(w / (n + 1), 6, 8 + song.g[G_DTIME] * 2);
|
||||
for (a = 1000, fb = 0; fb < n && fb * sp < w; fb++, a = a * clamp(song.g[G_DFDBK], 0, 127) / 127)
|
||||
gx_col(x + fb * sp, y + h, sp - 2 > 12 ? 12 : sp - 2, h - top, a, fb == run ? HUD_YE : fb ? 0 : FXG_TC);
|
||||
if (top) {
|
||||
param_format(&GP[G_DTIME], song.g[G_DTIME], b, &u);
|
||||
str_cpy(b + str_len(b), " \xB7 ", 4);
|
||||
fmt_int(b + str_len(b), n);
|
||||
str_cpy(b + str_len(b), n == 1 ? " ECHO" : " ECHOES", 8);
|
||||
tw = text_w(&AF_X, b) + 4;
|
||||
cv_rect(x, y, tw, 11, HUD_BL);
|
||||
cv_text_on(x + 2, y + 1 - AF_X_CAP_Y, &AF_X, b, T_TEXT, HUD_BL);
|
||||
hud_tag(x, y, b, T_TEXT, HUD_BL);
|
||||
}
|
||||
}
|
||||
|
||||
/* REVERB: its tail as columns of cells, SIZE long (SPRING rippled, CLOUD wavy), a line sweeping it while it sounds */
|
||||
static void fxg_reverb(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
int32_t i, sz = song.g[G_RSIZE], ty = song.g[G_RTYPE], e = 1000, k = 1000 - (5000 - sz * 4300 / 127) / (w ? w : 1);
|
||||
int32_t top = y + 12, hh = h - 12, en = fxg_en(), sweep = en && w > 0 ? (int32_t)(anim_fr * 3u % (uint32_t)w) : -1;
|
||||
int32_t i, sz = song.g[G_RSIZE], ty = clamp(song.g[G_RTYPE], 0, 4), e = 1000, en = fxg_en();
|
||||
int32_t k = 1000 - (5000 - sz * 4300 / 127) * 5 / (w ? w : 1), sweep = en && w > 0 ? (int32_t)(anim_fr * 3u % (uint32_t)w) / 5 : -1;
|
||||
char b[16];
|
||||
for (i = 0; i < w; i++) { /* the decay, a column each: its height the envelope */
|
||||
int32_t env = i < w / 25 + 1 ? e * i / (w / 25 + 1) : e, n = 1000, ch;
|
||||
if (ty == 4) n = 500 + (bg_sin((uint32_t)(i * 65536 / (w ? w : 1) * 6)) >> 6) * 500 / 512;
|
||||
else if (ty == 1) n = 700 + (bg_sin((uint32_t)(i * 65536 / (w ? w : 1) * 14)) >> 6) * 300 / 512;
|
||||
ch = hh * 9 / 10 * env / 1000 * n / 1000;
|
||||
if (en) /* (the tail swells with the output) */
|
||||
ch = ch * (168 + clamp(en, 0, 288) * 88 / 288) / 256;
|
||||
if (!(i % 5)) { /* (a matrix of cells, 5 px a column) */
|
||||
int32_t r, nr = ch / 6;
|
||||
for (r = 0; r < nr; r++)
|
||||
cv_rect(x + i, top + hh - (r + 1) * 6, 4, 5, i / 5 == sweep / 5 ? HUD_YE : FXG_H(60 + (218 - i * 180 / (w ? w : 1)) * (nr - r / 2) / (nr ? nr : 1) * 3 / 4));
|
||||
for (; r < hh / 6; r++)
|
||||
cv_rect(x + i, top + hh - (r + 1) * 6, 4, 5, T_SURF);
|
||||
}
|
||||
e = e * k / 1000;
|
||||
for (i = 0; i < w / 5; i++, e = e * k / 1000) {
|
||||
int32_t n = ty == 4 ? 750 + (bg_sin((uint32_t)i * 2048u) >> 7) : ty == 1 ? 850 + (bg_sin((uint32_t)i * 5000u) >> 8) : 1000;
|
||||
gx_col(x + i * 5, y + h, 4, h - 12, (i < 2 ? e / 2 : e) * n / 1000 * (en ? 168 + clamp(en, 0, 288) * 88 / 288 : 256) / 256,
|
||||
i == sweep ? HUD_YE : 0);
|
||||
}
|
||||
fxg_label(x, y, N_RTYPE[clamp(ty, 0, 4)], T_MID, 0);
|
||||
fxg_label(x, y, N_RTYPE[ty], T_MID, 0);
|
||||
if (w > 120) {
|
||||
str_cpy(b, "PRE ", sizeof b);
|
||||
fmt_int(b + 4, song.g[G_RPRE]);
|
||||
@@ -107,35 +74,14 @@ static void fxg_reverb(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
fxg_label(x + w, y, b, T_DIM, 1);
|
||||
}
|
||||
}
|
||||
/* CHORUS: its voices as two sines DEPTH deep, STEREO apart, running at RATE while it sounds */
|
||||
static void fxg_chorus(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
int32_t k, i, dep = song.g[G_CDEPTH], st = song.g[G_CSTER], mid = y + 8 + (h - 8) / 2;
|
||||
uint32_t ph = fxg_en() ? anim_fr * (uint32_t)(song.g[G_CRATE] + 8) * 48u : 0u; /* (running at RATE while it sounds) */
|
||||
int32_t dep = song.g[G_CDEPTH], st = song.g[G_CSTER], mid = y + 8 + (h - 8) / 2, amp = (h - 8) * 35 / 100 * dep / 127;
|
||||
uint32_t ph = fxg_en() ? anim_fr * (uint32_t)(song.g[G_CRATE] + 8) * 48u : 0u;
|
||||
char b[16];
|
||||
for (k = 0; k < 3; k++) {
|
||||
int32_t py = 0;
|
||||
for (i = 0; i <= w; i++) {
|
||||
int32_t amp = (h - 8) * 35 / 100 * dep / 127 * (10 + 2 * k) / 10 * (128 + st) / 128;
|
||||
int32_t yy = mid + (bg_sin((uint32_t)(i * 65536 / (w ? w : 1) * 2) + (uint32_t)k * 21000u + ph) * amp >> 15);
|
||||
yy = clamp(yy, y + 9, y + h - 1);
|
||||
if (i)
|
||||
cv_line(x + i - 1, py, x + i, yy, k == 0 ? FXG_TC : k == 1 ? T_TEXT : HUD_BL);
|
||||
py = yy;
|
||||
}
|
||||
}
|
||||
if (w > 120) { /* the stereo an orbit at the left: L against R */
|
||||
int32_t R = (h - 16) / 2, ox = x + R + 2, oy = y + 10 + R, px = 0, py2 = 0, amp = R * (40 + dep * 60 / 127) / 100;
|
||||
cv_rect(x, y + 9, 2 * R + 6, h - 9, T_BG);
|
||||
for (i = 0; i < 48; i += 2) cv_pset(ox + (R * og_cos((uint32_t)i * 1365u) >> 15), oy + (R * og_sin((uint32_t)i * 1365u) >> 15), T_DIM);
|
||||
for (i = 0; i <= 96; i++) {
|
||||
uint32_t a2 = (uint32_t)i * 683u;
|
||||
int32_t xx = ox + (bg_sin(a2 * 2u + ph) * amp >> 15), yy = oy + (bg_sin(a2 * 3u + ph + (uint32_t)st * 200u) * amp >> 15);
|
||||
if (i) cv_line_t(px, py2, xx, yy, FXG_TC, 2);
|
||||
px = xx; py2 = yy;
|
||||
}
|
||||
cv_text(ox - R - 1, oy - 3, &AF_X, "L", T_DIM);
|
||||
cv_text(ox + R - 4, oy - 3, &AF_X, "R", T_DIM);
|
||||
}
|
||||
gx_sine(x, mid, w, amp * (128 + st) / 128, 2u, ph + 21000u, T_TEXT, y + 9, y + h - 1);
|
||||
gx_sine(x, mid, w, amp, 2u, ph, FXG_TC, y + 9, y + h - 1);
|
||||
str_cpy(b, "STEREO ", sizeof b);
|
||||
b[7] = st > 0 ? '+' : 0;
|
||||
fmt_int(b + 7 + (st > 0), st);
|
||||
@@ -177,6 +123,20 @@ static void fxg_slicer(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* (V10.8.53) a transfer curve in an s x s box at (x, y): DIST's (bip: in -1 .. 1, out across the middle) and CLIP's (0 .. 1,
|
||||
* from the bottom left), its guides dotted, the level now (0..256, < 0 none) a yellow dot on it */
|
||||
static void fxg_curve(uint32_t type, int32_t x, int32_t y, int32_t s, int32_t d, int32_t lvl, int bip)
|
||||
{
|
||||
int32_t i, py = 0, g = d ? 4096 + d * d * 2 : 4096, cy = bip ? y + s / 2 : y + s - 1, hx = bip ? s / 2 : 0;
|
||||
int32_t sc = bip ? (s / 2 - 1) * 9 / 10 : s - 2, lx = lvl < 0 ? -1 : hx + clamp(lvl, 0, 256) * (s - hx) / 256;
|
||||
for (i = 0; i < s; i += 3) { cv_pset(x + i, cy, T_LINE); cv_pset(x + hx, y + i, T_LINE); }
|
||||
for (i = 0; i < s; i++) {
|
||||
int32_t yy = clamp(cy - tk_dist_y(type, (i - hx) * (bip ? 131072 : 32768) / (bip ? s / 2 : s), g, d) * sc / 32767, y + 1, y + s - 2);
|
||||
if (i) cv_line_t(x + i - 1, py, x + i, yy, FXG_TC, 2);
|
||||
if (i == lx) { cv_rect(x + i, y, 1, s, HUD_YE); cv_rect(x + i - 2, yy - 2, 5, 5, HUD_YE); }
|
||||
py = yy;
|
||||
}
|
||||
}
|
||||
static void fxg_master(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
int32_t en = bg_energy(), lvl = song.playing || en > 2 ? 128 + en / 2 : 26, i, py = 0, duck = song.g[G_DUCK];
|
||||
@@ -194,16 +154,8 @@ static void fxg_master(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
fxg_label(x, y + 14, b, T_MID, 0);
|
||||
if (w > 120) { /* (V10.43) the page: CLIP's curve (in -> out, the level now a dot),
|
||||
* PUNCH's bar (its push on the peaks now), then the duck */
|
||||
int32_t s = ch, d = song.g[G_CLIP] * 127 / 100, g = 4096 + d * d * 2, dy = 0;
|
||||
for (i = 0; i < s; i += 3) { cv_pset(x + i, cy + s - 1, T_LINE); cv_pset(x, cy + i, T_LINE); }
|
||||
for (i = 0; i < s; i++) {
|
||||
int32_t yy = cy + s - 1 - tk_dist_y(DT_SOFT, i * 32768 / s, d ? g : 4096, d) * (s - 2) / 32767;
|
||||
if (i) cv_line_t(x + i - 1, py, x + i, yy, FXG_TC, 2);
|
||||
if (i == lvl * s / 320) dy = yy;
|
||||
py = yy;
|
||||
}
|
||||
cv_rect(x + lvl * s / 320, cy, 1, s, HUD_YE);
|
||||
cv_rect(x + lvl * s / 320 - 2, dy - 2, 5, 5, HUD_YE);
|
||||
int32_t s = ch;
|
||||
fxg_curve(DT_SOFT, x, cy, s, song.g[G_CLIP] * 127 / 100, lvl * 256 / 320, 0);
|
||||
cv_rect(x + s + 6, cy, 6, s, T_RAISE);
|
||||
i = song.g[G_PUNCH] * s / 100 * (lvl - 26) / 230;
|
||||
if (i > 0) cv_rect(x + s + 6, cy + s - i, 6, i, FXG_H(230));
|
||||
@@ -241,14 +193,13 @@ static void fxg_sends(const track_t *t, int32_t x, int32_t y, int32_t w, int32_t
|
||||
* cards' order) */
|
||||
static const char *const N[4] = {"CHOR", "DLY", "REV", "DIST"}; /* (V10.7.58, the owner: DIST back on SENDS) */
|
||||
static const uint8_t ID[4] = {P_CHOR, P_DLY, P_REV, P_DIST};
|
||||
int32_t i, r, cw = w / 4 - 8, nr = (h - 16) / 5;
|
||||
int32_t i, cw = w / 4 - 8, nr = (h - 12) / 6;
|
||||
char b[8];
|
||||
for (i = 0; i < 4; i++) {
|
||||
int32_t v = t->p[ID[i]], bx = x + i * (w / 4), on = v * nr / 127, ly = y + h - 2 - v * nr * 5 / 127;
|
||||
int32_t v = t->p[ID[i]], bx = x + i * (w / 4), ly = y + h - 1 - v * nr * 6 / 127;
|
||||
cv_rect(bx, y, text_w(&AF_X, N[i]) + 4, 11, HUD_BL);
|
||||
cv_text_on(bx + 2, y + 1 - AF_X_CAP_Y, &AF_X, N[i], T_TEXT, HUD_BL);
|
||||
for (r = 0; r < nr; r++)
|
||||
cv_rect(bx, y + h - 6 - r * 5, cw, 4, r < on ? FXG_H(51 + r * 205 / (nr ? nr : 1)) : T_LINE);
|
||||
gx_col(bx, y + h, cw, h - 12, v * 1000 / 127, 0);
|
||||
cv_rect(bx - 2, ly, cw + 4, 1, HUD_YE);
|
||||
fmt_int(b, v * 100 / 127);
|
||||
str_cpy(b + str_len(b), "%", 2);
|
||||
@@ -257,27 +208,14 @@ static void fxg_sends(const track_t *t, int32_t x, int32_t y, int32_t w, int32_t
|
||||
}
|
||||
static void fxg_dist(const track_t *t, int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
int32_t d = t->p[P_DIST], g = 4096 + d * d * 2, i, py = 0, s = h, cy = y + s / 2;
|
||||
uint32_t type = (uint32_t)t->p[P_DTYPE] > DT_AMP ? DT_SOFT : (uint32_t)t->p[P_DTYPE];
|
||||
char b[16];
|
||||
(void)w;
|
||||
for (i = 0; i < s; i += 3) { cv_pset(x + i, cy, T_LINE); cv_pset(x + s / 2, y + i, T_LINE); }
|
||||
for (i = 0; i < s; i++) {
|
||||
int32_t xx = (i - s / 2) * 131072 / (s / 2), yy = cy - tk_dist_y(type, xx, d ? g : 4096, d) * (s / 2 - 1) * 9 / 10 / 32767;
|
||||
yy = clamp(yy, y + 1, y + s - 2);
|
||||
if (i)
|
||||
cv_line_t(x + i - 1, py, x + i, yy, FXG_TC, 2);
|
||||
py = yy;
|
||||
}
|
||||
if (fxg_en() && s > 20) { /* the level now, a dot on the curve */
|
||||
int32_t xx = clamp(bg_energy(), 0, 256) * 131072 / 256, px = x + s / 2 + xx * (s / 2) / 131072;
|
||||
int32_t yy = clamp(cy - tk_dist_y(type, xx, d ? g : 4096, d) * (s / 2 - 1) * 9 / 10 / 32767, y + 3, y + s - 4);
|
||||
cv_rect(clamp(px, x + 3, x + s - 4) - 2, yy - 2, 5, 5, HUD_YE);
|
||||
}
|
||||
hud_tag(x + s + 8, y + 1, N_DTYPE[type], song.sel % 6u >= 4u ? 0xFFFFu : 0x0000u, FXG_TC);
|
||||
fxg_curve(type, x, y, h, t->p[P_DIST], fxg_en() && h > 20 ? clamp(bg_energy(), 0, 256) : -1, 1);
|
||||
hud_tag(x + h + 8, y + 1, N_DTYPE[type], song.sel % 6u >= 4u ? 0xFFFFu : 0x0000u, FXG_TC);
|
||||
str_cpy(b, "TONE ", sizeof b);
|
||||
fmt_int(b + 5, t->p[P_DTONE]);
|
||||
fxg_label(x + s + 8, y + 15, b, T_DIM, 0);
|
||||
fxg_label(x + h + 8, y + 15, b, T_DIM, 0);
|
||||
}
|
||||
static void fxg_pan(const track_t *t, int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
@@ -316,8 +254,7 @@ static void fxg_mod(uint32_t m, int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
case 3: if (cur_page()->graph == GR_SLPIT && w > 120) fxg_slpitch(x, y, w, h); else fxg_slicer(x, y, w, h); break;
|
||||
case 4: break; /* (V10.8.33: PUNCH IN's lane picture gone, the owner: its room) */
|
||||
default:
|
||||
if (w > 120 && cur_page()->id[0] == ID_EQ0 && bt_hw_seg()) tech_eq(x, y, w, h); /* (V10.44) EQ: its curve */
|
||||
else fxg_master(x, y, w, h);
|
||||
fxg_master(x, y, w, h);
|
||||
break; /* (snd2: MASTER last) */
|
||||
}
|
||||
}
|
||||
|
||||
+20
-37
@@ -167,7 +167,6 @@ static const char *const SCL_LONG[] = {"CHROMATIC", "MAJOR", "MINOR", "DORIAN",
|
||||
"DIM HALF-WHOLE", "DIM WHOLE-HALF"};
|
||||
static __attribute__((noinline)) void graph_key(const track_t *t, const page_t *pg)
|
||||
{
|
||||
static const uint8_t WH[7] = {0, 2, 4, 5, 7, 9, 11}, BK[5] = {1, 3, 6, 8, 10}, BX[5] = {1, 2, 4, 5, 6};
|
||||
uint32_t mask = scale_mask(t) & 0xFFFu, rt = (uint32_t)clamp(t->p[P_ROOT], 0, 11), i, n = 0, dg[12];
|
||||
const aafont_t *f = &AF_L;
|
||||
const char *u = "";
|
||||
@@ -189,18 +188,16 @@ static __attribute__((noinline)) void graph_key(const track_t *t, const page_t *
|
||||
cv_text_in(x, 34 + (n > 9u ? CAP_IN(X, 24) : CAP_IN(M, 24)), w - 2, n > 9u ? &AF_X : &AF_M, NN12[nt], T_INK, note_col(nt));
|
||||
if (!i) cv_frame(x - 1, 33, w, 26, T_TEXT);
|
||||
}
|
||||
for (i = 0; i < 12u; i++) { /* an octave of keys from C, the scale's lit, each its degree */
|
||||
uint32_t blk = i >= 7u, nt = blk ? BK[i - 7u] : WH[i];
|
||||
int32_t x = blk ? 2 + (int32_t)BX[i - 7u] * 32 - 10 : 8 + (int32_t)i * 32, w = blk ? 19 : 30, kh = blk ? 40 : 68;
|
||||
uint16_t c = dg[nt] ? note_col(nt) : blk ? 0x10A2u : 0xCE59u;
|
||||
char d[3];
|
||||
cv_rect(x, 66, w, kh, c);
|
||||
if (dg[nt]) {
|
||||
fmt_int(d, (int32_t)dg[nt]);
|
||||
cv_text_in(x, 66 + kh - (blk ? 14 : 22), w, blk ? &AF_X : &AF_M, d, T_INK, c);
|
||||
{ /* an octave of keys from C, the scale's lit, each its degree (ui_gx.c gx_keys); ROOT's its degree 1 */
|
||||
uint16_t col[12];
|
||||
const char *lab[12];
|
||||
char dn[12][3];
|
||||
for (i = 0; i < 12u; i++) {
|
||||
col[i] = dg[i] ? note_col(i) : (0x54Au >> i & 1u) ? 0u : 0xCE59u;
|
||||
fmt_int(dn[i], (int32_t)dg[i]);
|
||||
lab[i] = dg[i] ? dn[i] : 0;
|
||||
}
|
||||
if (nt == rt)
|
||||
cv_rect(x + w / 2 - 2, 66 + kh - 4, 4, 3, 0x0000u);
|
||||
gx_keys(8, 66, 1u, 32, 68, col, lab);
|
||||
}
|
||||
}
|
||||
/* (V10.8.19, JIANT BYTE's CHORD redesign (GPL, as BYTE has it), the owner's pick) a chord's name from its notes (pn[0]
|
||||
@@ -229,13 +226,6 @@ static void chord_label(const uint8_t *pn, uint32_t n, char *o, int lng)
|
||||
if (six && !d7) str_cpy(o + str_len(o), "6", 12);
|
||||
if (nine && !b7 && !M7) str_cpy(o, mi ? "MI+9" : dim ? "DIM+9" : "ADD9", 12);
|
||||
}
|
||||
/* note k's interval on its key (no lowercase in the font: a flat "-", as "E-" is minor; a sharp "#") */
|
||||
static void chord_ivl(int32_t x, int32_t y, const uint8_t *pn, uint32_t k)
|
||||
{
|
||||
static const char IV[12][3] = {"R", "-9", "9", "-3", "3", "4", "-5", "5", "#5", "6", "-7", "7"};
|
||||
const char *s = k ? IV[((uint32_t)pn[k] + 120u - pn[0]) % 12u] : "R";
|
||||
cv_text(x + (13 - text_w(&AF_X, s)) / 2, y - AF_X_CAP_Y, &AF_X, s, 0x0000u);
|
||||
}
|
||||
/* CHORD: the last key's chord named large (yellow while it sounds, else the track's colour), TYPE . VOICING under it; two
|
||||
* octaves of keys, the chord's notes lit (its root the track's colour) and each its interval; the seven degrees as tags,
|
||||
* each its chord's short name, the one of the last key yellow */
|
||||
@@ -268,24 +258,17 @@ static __attribute__((noinline)) void graph_chord(const track_t *t)
|
||||
} else if (t->p[P_CHRD]) chord_label(pn, n, nm, 1); else str_cpy(nm, "OFF", sizeof nm);
|
||||
cv_text(10, 4 - AF_L_CAP_Y + 1, text_w(&AF_L, nm) <= 220 ? &AF_L : &AF_M, nm, snd ? HUD_YE : t->p[P_CHRD] ? tc : T_DIM);
|
||||
cv_free_text(10, 26 - AF_X_CAP_Y + 1, &AF_X, b, T_MID, cv_bg, 220);
|
||||
{ /* the keys: two octaves from the C under its lowest note */
|
||||
static const uint8_t WK[7] = {0, 2, 4, 5, 7, 9, 11}, BK[5] = {1, 3, 6, 8, 10}, BX[5] = {0, 1, 3, 4, 5};
|
||||
uint32_t lo = n ? pn[0] : key, base = lo / 12u * 12u, on[25] = {0}, oct, w;
|
||||
for (k = 0; k < n && k < 8u; k++) { uint32_t r = (uint32_t)pn[k] - base; while (r >= 24u) r -= 12u; on[r] = k + 1u; }
|
||||
for (oct = 0; oct < 2u; oct++)
|
||||
for (w = 0; w < 7u; w++) {
|
||||
uint32_t r = oct * 12u + WK[w], h = on[r];
|
||||
int32_t x = 8 + (int32_t)(oct * 7u + w) * 16;
|
||||
cv_rect(x, 40, 15, 52, h ? (h == 1u ? tc : snd ? HUD_YE : T_TEXT) : T_RAISE);
|
||||
if (h) chord_ivl(x + 1, 80, pn, h - 1u);
|
||||
}
|
||||
for (oct = 0; oct < 2u; oct++)
|
||||
for (w = 0; w < 5u; w++) {
|
||||
uint32_t r = oct * 12u + BK[w], h = on[r];
|
||||
int32_t x = 8 + (int32_t)(oct * 7u + BX[w]) * 16 + 10;
|
||||
cv_rect(x, 40, 11, 32, h ? (h == 1u ? tc : snd ? HUD_YE : T_TEXT) : T_BG);
|
||||
if (h) chord_ivl(x - 1, 60, pn, h - 1u);
|
||||
}
|
||||
{ /* the keys: two octaves from the C under its lowest note (ui_gx.c gx_keys), each note its interval */
|
||||
static const char IV[12][3] = {"R", "-9", "9", "-3", "3", "4", "-5", "5", "#5", "6", "-7", "7"};
|
||||
uint32_t lo = n ? pn[0] : key, base = lo / 12u * 12u, r;
|
||||
uint16_t col[24] = {0};
|
||||
const char *lab[24] = {0};
|
||||
for (k = 0; k < n && k < 8u; k++) {
|
||||
for (r = (uint32_t)pn[k] - base; r >= 24u; r -= 12u) ;
|
||||
col[r] = k ? (snd ? HUD_YE : T_TEXT) : tc;
|
||||
lab[r] = k ? IV[((uint32_t)pn[k] + 120u - pn[0]) % 12u] : "R";
|
||||
}
|
||||
gx_keys(8, 40, 2u, 16, 52, col, lab);
|
||||
}
|
||||
for (d = 0; d < c; d++) { /* the degrees: numeral tag, its chord's short name */
|
||||
uint8_t nt[8];
|
||||
|
||||
+14
-46
@@ -50,9 +50,7 @@ static void graph_lib(void)
|
||||
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};
|
||||
cv_rect(sx, sy, 23, 15, c);
|
||||
GFX_HOOK_ALIGN(sx, sy, sx + 23, sy + 15, AL_HV, "library section chip letter centred");
|
||||
cv_text_in(sx, sy + CAP_IN(X, 15), 23, &AF_X, l, used ? T_INK : T_DIM, c);
|
||||
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);
|
||||
}
|
||||
@@ -68,18 +66,11 @@ static __attribute__((noinline)) void graph_lz_tools(void)
|
||||
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];
|
||||
cv_frame(4, 4, 76, 76, col); /* the picture */
|
||||
if (sc == 1u)
|
||||
for (i = 0; i < 16u; i++) /* the track's steps */
|
||||
cv_rect(10 + (int32_t)(i % 8u) * 8, 14 + (int32_t)(i / 8u) * 30, 6, 24, TSEL->step[i].time == ST_NOTE ? col : T_DIM);
|
||||
else if (sc == 2u)
|
||||
for (i = 0; i < 64u; i++) /* a wave */
|
||||
cv_rect(10 + (int32_t)i, 42 + ((24 * og_sin(i * 2048u)) >> 15), 1, 2, col);
|
||||
else if (sc == 3u)
|
||||
for (i = 0; i < 4u; i++) /* the song's rows */
|
||||
cv_rect(10, 12 + (int32_t)i * 16, 64, 12, i < chain_config.count ? col : T_DIM);
|
||||
else
|
||||
cv_text_in(4, 38, 76, &AF_M, "ALL", col, T_SURF);
|
||||
{ /* 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;
|
||||
@@ -365,12 +356,9 @@ static void graph_score(int gen)
|
||||
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);
|
||||
cv_rect(x, 2, w, 14, cf);
|
||||
if (w >= 9) {
|
||||
b[0] = (char)('A' + s); b[1] = 0;
|
||||
if (r->bars != 4u && w >= 18) fmt_int(b + 1, r->bars);
|
||||
cv_text_in(x, 2 + CAP_IN(X, 14), w, &AF_X, b, i == sel ? T_INK : T_TEXT, cf);
|
||||
}
|
||||
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;
|
||||
@@ -383,8 +371,7 @@ static void graph_score(int gen)
|
||||
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;
|
||||
cv_rect(x + w / 2 - 5, y, 11, 12, sec_col(src));
|
||||
cv_text_in(x + w / 2 - 5, y + CAP_IN(X, 12), 11, &AF_X, b, T_INK, sec_col(src));
|
||||
gx_chip(x + w / 2 - 5, y, 11, 12, sec_col(src), b, T_INK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,7 +437,6 @@ static void graph_proj(void)
|
||||
b[0] = (char)('A' + (r->slot & 3u));
|
||||
fmt_int(b + 1, r->bars);
|
||||
cv_rect(x, y, 27, 20, c);
|
||||
GFX_HOOK_ALIGN(x, y, x + 27, y + 20, AL_HV, "arrange chip centred");
|
||||
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);
|
||||
@@ -465,28 +451,11 @@ static void graph_proj(void)
|
||||
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);
|
||||
}
|
||||
/* a being small at (cx, cy) radius r (px): engine e's species, its outline in heat c; 24 vertices (bg_outline's form,
|
||||
* its spikes and lobes, at a slot's size: a quarter of the lines) */
|
||||
/* 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)
|
||||
{
|
||||
const genome_t *g = &GENOME[EGEN[e % NENGINES]];
|
||||
int32_t i, px = 0, py = 0, R = r * 16, k = g->k0 + g->kk / 2;
|
||||
for (i = 0; i <= 24; i++) {
|
||||
uint32_t th = (uint32_t)(i % 24) * 65536u / 24u;
|
||||
int32_t rr = R + ((R * 90 >> 8) * (9175 * bg_sin((uint32_t)g->lob * th) >> 15) >> 15), x, y, c2, p, n;
|
||||
c2 = bg_sin(((uint32_t)k * th >> 1) + (uint32_t)g->tw * 3000u + 0x4000u);
|
||||
p = c2 > 0 ? c2 : 0;
|
||||
for (n = 1; n < g->sh; n++)
|
||||
p = (p * c2) >> 15;
|
||||
if (p < 0) p = 0;
|
||||
rr += ((R * 110 >> 8) * p >> 15) * 26 >> 4;
|
||||
x = cx * 16 + ((rr * bg_sin(th + 0x4000u) >> 15) * g->ax >> 4);
|
||||
y = cy * 16 + (rr * bg_sin(th) >> 15);
|
||||
if (i)
|
||||
og_line(px, py, x, y, c);
|
||||
px = x;
|
||||
py = y;
|
||||
}
|
||||
(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)
|
||||
@@ -524,8 +493,7 @@ static __attribute__((noinline)) void graph_sound(void)
|
||||
cv_clip_text(x + 10, y + CAP_IN(X, 15), &AF_X, b, T_TEXT, bg, 24);
|
||||
} else {
|
||||
up_slot_label(b, k);
|
||||
GFX_HOOK_ALIGN(x, y, x + 35, y + 15, AL_HV, "sound slot label centred");
|
||||
cv_text_in(x, y + CAP_IN(X, 15), 35, &AF_X, b, T_DIM, bg);
|
||||
gx_chip(x, y, 35, 15, bg, b, T_DIM);
|
||||
}
|
||||
if (sel)
|
||||
cv_frame(x, y, 35, 15, T_THEME);
|
||||
|
||||
+1
-26
@@ -80,32 +80,7 @@ static void tech_dest(const track_t *t)
|
||||
/* the page's technical graph, if it has one (1) */
|
||||
/* (V10.44) pictures in the Bluetooth segment (BTAPP_FN: the app slot full), drawn only once bt_hw_seg() said it is this
|
||||
* build's (else the page keeps its old picture) */
|
||||
/* FX > MASTER > EQ: the four bands' curve (LOW and HIGH shelves, the mids bells), each band's dot, the frequencies */
|
||||
static BTAPP_FN void tech_eq(int32_t x, int32_t y, int32_t w, int32_t h)
|
||||
{
|
||||
static const uint16_t F[4] = {120, 380, 650, 900}; /* (x / 1024: ~60 250 2k 8k on a log axis) */
|
||||
int32_t i, k, py = 0, mid = y + 20 + (h - 30) / 2, sc = (h - 34) / 2;
|
||||
cv_rect(x, mid, w, 1, T_LINE);
|
||||
if (ui_scope) /* (V10.58) MENU > DISPLAY > SCOPE ON: the master's scope behind the
|
||||
* curve, live (the users missed the page's picture of the sound) */
|
||||
scope_at(x, w, mid, sc, T_RAISE);
|
||||
for (i = 0; i <= w; i++) {
|
||||
int32_t f = i * 1024 / w, db = 0, yy;
|
||||
for (k = 0; k < 4; k++) {
|
||||
int32_t d = f - F[k], wt = (k == 0 && d < 0) || (k == 3 && d > 0) ? 256 : 256 - d * d / 160;
|
||||
if (wt > 0) db += eq_v[k] * wt;
|
||||
}
|
||||
yy = mid - db * sc / (12 * 256);
|
||||
yy = clamp(yy, y + 18, y + h - 10);
|
||||
if (i) cv_line(x + i - 1, py, x + i, yy, heat_col(128 + db / 24));
|
||||
py = yy;
|
||||
}
|
||||
for (k = 0; k < 4; k++) {
|
||||
int32_t cx = x + F[k] * w / 1024;
|
||||
cv_rect(cx - 2, mid - eq_v[k] * sc / 12 - 2, 5, 5, heat_col(128 + eq_v[k] * 10));
|
||||
cv_text_in(cx - 12, y + h - 7, 24, &AF_X, k == 0 ? "60" : k == 1 ? "250" : k == 2 ? "2K" : "8K", T_DIM, T_SURF);
|
||||
}
|
||||
}
|
||||
/* (V10.8.53) FX > MASTER > EQ's curve (tech_eq) gone: its room; the page draws MASTER's picture */
|
||||
static int graph_tech(const track_t *t, const page_t *pg)
|
||||
{
|
||||
if (pg->scope != SC_GLOBAL)
|
||||
|
||||
+296
-108
@@ -7,6 +7,8 @@
|
||||
* F4 CLR AUTO (JIANT 0.6.8) the track's automation (V10.6: C4 RANDOM D4 COOK
|
||||
* E4 BEAT and C5 the lane's RANDOM gone: SEQ > EUCLID generates)
|
||||
* G4 CLEAR A4 REVERSE B4 FILL the selected lane (DRUM: ui.lane, black keys 1..8 pick it)
|
||||
* (V10.8.52: the SEQ EDIT page, se_do below, does them on the steps selected; the keys F3 CLEAR, F4 CLR AUTO, G4-B4 the
|
||||
* lane's, C5 DUP, E5 COPY, F5 PASTE, G5 CLR STEP stay; G3 ALL, A3 KNOB 1 / 2 MOVE, B3-E4 BAR 1-4, D5 DO IT.)
|
||||
* Each works on the selected track's steps 1..LEN (the steps past LEN stay); the track's automation stays (but
|
||||
* CLR AUTO's: it clears the track's automation and locks, every step, the steps stay). No undo
|
||||
* (TONIC): the song layer's RECALL brings the section back as it was stored.
|
||||
@@ -15,6 +17,9 @@
|
||||
* differs. A sequence of ties reversed keeps its note first: N T T -> N T T at the mirrored place */
|
||||
enum { TL_CLEAR, TL_REV, TL_LEFT, TL_RIGHT, TL_RANDOM, TL_COOK, TL_BEAT, TL_CAUTO, TL_LCLR, TL_LREV, TL_LFILL, TL_LRND,
|
||||
TL_N };
|
||||
#define TL_DUP 11u /* (V10.8.52 SEQ EDIT's white keys: C5 DUP, E5 COPY, F5 PASTE) */
|
||||
#define TL_COPY 13u
|
||||
#define TL_PASTE 14u
|
||||
|
||||
/* the steps as they were just before an action (tl_take): what REVERSE and SHIFT read; (seq2d) in .bss again (it was
|
||||
* the pool, RAM's .bss tight): the pool's headroom paid for step_t's four bytes of components v2 (proj_scratch) */
|
||||
@@ -23,12 +28,6 @@ enum { TL_CLEAR, TL_REV, TL_LEFT, TL_RIGHT, TL_RANDOM, TL_COOK, TL_BEAT, TL_CAUT
|
||||
static uint32_t tl_rnd(uint32_t n) { return n ? rng() % n : 0u; }
|
||||
static int tl_gate(const step_t *s) { return s->time == ST_NOTE && s->n; }
|
||||
static uint32_t tl_lane(const step_t *s, uint32_t l) { return (step_lanes_of(TSEL,s) >> l) & 1u; }
|
||||
/* place p's action is there for this track (the lane row and BEAT: DRUM only) */
|
||||
static int tl_cell(const track_t *t, uint32_t p) /* (V10.6) RANDOM COOK BEAT and the lane's RANDOM gone: EUCLID */
|
||||
{
|
||||
return p <= TL_CAUTO || (drum_track(t) && p >= TL_LCLR && p < TL_LRND);
|
||||
}
|
||||
|
||||
/* the steps of t as they are now, before an action */
|
||||
static void tl_take(const track_t *t) { memcpy(tl_src, t->step, sizeof tl_src); }
|
||||
|
||||
@@ -68,19 +67,20 @@ static void tl_order(track_t *t, uint32_t len, const uint8_t *src)
|
||||
motion_unguard(f);
|
||||
}
|
||||
|
||||
/* REVERSE: the mirror order; a note's ties (after it) would come before it, so the note goes first again */
|
||||
static void tl_reverse(track_t *t, uint32_t len)
|
||||
/* REVERSE: steps lo .. lo+n-1 in the mirror order; a note's ties (after it) would come before it, so the note goes
|
||||
* first again */
|
||||
static void tl_reverse(track_t *t, uint32_t lo, uint32_t n, uint32_t len)
|
||||
{
|
||||
uint8_t src[NSTEP], h;
|
||||
uint32_t j, e, x;
|
||||
for (j = 0; j < len; j++)
|
||||
src[j] = (uint8_t)(len - 1u - j);
|
||||
for (j = 0; j < len; j++) {
|
||||
for (e = j; e < len && tl_src[src[e]].time == ST_TIE; e++)
|
||||
src[j] = (uint8_t)(j < lo || j >= lo + n ? j : 2u * lo + n - 1u - j);
|
||||
for (j = lo; j < lo + n; j++) {
|
||||
for (e = j; e < lo + n && tl_src[src[e]].time == ST_TIE; e++)
|
||||
;
|
||||
if (e == j)
|
||||
continue;
|
||||
if (e < len && tl_src[src[e]].time == ST_NOTE) { /* ties j .. e - 1, their note at e: the note to j */
|
||||
if (e < lo + n && tl_src[src[e]].time == ST_NOTE) { /* ties j .. e - 1, their note at e: the note to j */
|
||||
for (h = src[e], x = e; x > j; x--)
|
||||
src[x] = src[x - 1u];
|
||||
src[j] = h;
|
||||
@@ -90,15 +90,16 @@ static void tl_reverse(track_t *t, uint32_t len)
|
||||
tl_order(t, len, src);
|
||||
}
|
||||
|
||||
/* SHIFT: rotated by one step inside LEN, d = 1 later (>), len - 1 earlier (<) */
|
||||
static void tl_shift(track_t *t, uint32_t len, uint32_t d)
|
||||
/* (V10.8.52) ROTATE: steps a .. b-1 turned by d (d > 0 later), inside them; the rest stay */
|
||||
static void tl_rot(track_t *t, uint32_t a, uint32_t b, int32_t d, uint32_t len)
|
||||
{
|
||||
uint8_t src[NSTEP];
|
||||
uint32_t j;
|
||||
uint32_t j, w = b - a;
|
||||
for (j = 0; j < len; j++)
|
||||
src[j] = (uint8_t)((j + len - d) % len);
|
||||
src[j] = (uint8_t)(j < a || j >= b ? j : a + (j - a + w * 64u - (uint32_t)d) % w);
|
||||
tl_order(t, len, src);
|
||||
}
|
||||
static void tl_shift(track_t *t, uint32_t len, uint32_t d) { tl_take(t); tl_rot(t, 0, len, (int32_t)d, len); }
|
||||
|
||||
/* ------------------------------------------------------------- drums --- */
|
||||
static void tl_lane_clear(track_t *t, uint32_t len, uint32_t l)
|
||||
@@ -123,138 +124,323 @@ static uint32_t tl_fill(track_t *t, uint32_t len, uint32_t l)
|
||||
return e;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------- melodic --- */
|
||||
/* ------------------------------------------------------------ actions --- */
|
||||
/* (V10.8.49) SEQ TOOLS' STRETCH x2 / SQUEEZE /2 / REPEAT x2; (V10.8.51) on the range held on SEQ's roll (SEL 5-8: cp_sel,
|
||||
* taken once) or else the whole track */
|
||||
static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t lo, uint32_t n, uint32_t len);
|
||||
static const char *tl_shape(track_t *t, uint32_t p, uint32_t len, char *b)
|
||||
/* ------------------------------------------------- (V10.8.52) SEQ EDIT --- */
|
||||
/* The owner's SEQ EDIT (SEQ held on a SEQ page): the roll (DRUM: the lanes' grid) over KNOB 1 START, 2 END (A3: MOVE
|
||||
* and WIDTH), 3 the ACTION, 4 its amount; OCT+ (or D5) does it on the steps selected, or on the whole sequence while
|
||||
* none is (OCT- or G3: none). One UNDO point each (GLO + G4). The selection is the track's own (sel_of: its first | its
|
||||
* last << 8, bit 15 on; step keys held on the roll set it too, ui_input.c sel_poll): any SEQ page can read it (seq_sel) */
|
||||
enum { SE_STRETCH, SE_SQUEEZE, SE_REPEAT, SE_NUDGE, SE_ROTATE, SE_SHIFT, SE_REVERSE, SE_DUP, SE_COPY, SE_PASTE, SE_CLEAR,
|
||||
SE_CAUTO, SE_CSTEP, SE_VEL, SE_NOTES, SE_HUMAN, SE_TRANSP, SE_OCT, SE_THIN, SE_INVERT, SE_STUT, SE_ARP, SE_MUTATE,
|
||||
SE_GEN, SE_RAND, SE_N }; /* (V10.8.53, the owner) GENERATE in the selection (KNOB 4 the genre), RANDOM (its grid) */
|
||||
typedef struct { char nm[9]; int8_t lo, hi, def; char f; } se_t;
|
||||
static const se_t SE[SE_N] = {
|
||||
{"STRETCH", 2, 4, 2, 'x'}, {"SQUEEZE", 2, 4, 2, '/'}, {"REPEAT", 2, 9, 2, 'x'}, {"NUDGE", -32, 31, 4, 'n'},
|
||||
{"ROTATE", -15, 15, 1, 's'}, {"SHIFT", -16, 16, 1, 's'}, {"REVERSE", 0, 0, 0, 0}, {"DUP", 0, 0, 0, 0},
|
||||
{"COPY", 0, 0, 0, 0}, {"PASTE", 0, 1, 0, 'p'}, {"CLEAR", 0, 0, 0, 0}, {"CLR AUTO", 0, 0, 0, 0},
|
||||
{"CLR STEP", 0, 0, 0, 0}, {"VEL RND", 5, 100, 25, '%'}, {"NOTE RND", 1, 7, 2, 's'}, {"HUMANIZE", 1, 16, 4, 'n'},
|
||||
{"TRANSP", -12, 12, 1, 's'}, {"OCTAVE", -2, 2, 1, 's'}, {"THIN", 5, 100, 25, '%'},
|
||||
{"INVERT", 0, 0, 0, 0}, {"STUTTER", 2, 4, 2, 'x'}, {"ARP", 0, 3, 0, 'a'}, {"MUTATE", 5, 100, 25, '%'},
|
||||
{"GEN", 0, 0, 0, 'g'}, {"RANDOM", 0, 3, 2, 'r'}};
|
||||
#define sel_of(k) (clay_sp[2u + (k) % NTRK])
|
||||
#define se_st (clay_sp[8]) /* the ACTION | KNOB 1 / 2 MOVE and WIDTH << 7 */
|
||||
#define se_md (clay_sp[9]) /* its amount */
|
||||
|
||||
/* track t's steps selected (lo, n): bit 15, inside LEN; else the whole sequence (0, len). 1 = a selection */
|
||||
static int seq_sel(const track_t *t, uint32_t *lo, uint32_t *n, uint32_t len)
|
||||
{
|
||||
uint32_t s = (uint16_t)cp_sel, sel = s >> 15, lo = sel ? s & 63u : 0u, n = sel ? ((s >> 8) & 63u) - lo + 1u : len, nl;
|
||||
cp_sel = 0;
|
||||
if (lo + n > len) lo = 0, n = len, sel = 0; /* (LEN shortened since: the whole track) */
|
||||
nl = tl_reshape(t, p == TL_BEAT ? 0 : p == TL_RANDOM ? 2 : -2, lo, n, len);
|
||||
if (!nl) { ui_message(p == TL_COOK ? "TOO SHORT" : "64 STEPS ALREADY"); return 0; }
|
||||
if (sel) {
|
||||
cp_say(p == TL_BEAT ? "REPEAT " : p == TL_RANDOM ? "STRETCH " : "SQUEEZE ", lo, n);
|
||||
return ui.msg;
|
||||
}
|
||||
str_cpy(b, "LEN ", 24); fmt_int(b + 4, (int32_t)len); str_cpy(b + str_len(b), " > ", 4);
|
||||
fmt_int(b + str_len(b), (int32_t)nl);
|
||||
return b;
|
||||
uint32_t s = (uint16_t)sel_of(trk_index(t)), a = s & 63u, b = (s >> 8) & 63u;
|
||||
if (!(s >> 15) || b >= len || a > b) { *lo = 0; *n = len; return 0; }
|
||||
*lo = a; *n = b - a + 1u;
|
||||
return 1;
|
||||
}
|
||||
/* (V10.8.49, the owner) SEQ TOOLS' C#5 / D#5: NUDGE, every note step's MICRO d 64ths of a step later (d < 0: earlier)
|
||||
* together, each held at MICRO's range (no step passes another); the first note's MICRO said */
|
||||
static __attribute__((noinline)) const char *tl_nudge(track_t *t, int32_t d)
|
||||
static void sel_set(uint32_t a, uint32_t b) { cp_sel = (int16_t)(0x8000u | b << 8 | a); ui.bank = (uint8_t)(a / 16u); }
|
||||
|
||||
/* the amount's words: "x2", "/3", "+4", "25%", "FILL", "INSERT"; "-" none (V10.8.53: in the Bluetooth segment, as
|
||||
* cp_say: the room) */
|
||||
BTAPP_FN static void se_amt(uint32_t a, char *b)
|
||||
{
|
||||
int32_t m = se_md;
|
||||
char f = SE[a].f;
|
||||
b[0] = f == 'x' || f == '/' ? f : 0; b[1] = 0;
|
||||
if (!f) str_cpy(b, "-", 4);
|
||||
else if (f == 'p') str_cpy(b, m ? "INSERT" : "OVER", 8);
|
||||
else if (f == 'a') str_cpy(b, m == 0 ? "UP" : m == 1 ? "DOWN" : m == 2 ? "UP+DN" : "RANDOM", 8);
|
||||
else if (f == 'g') str_cpy(b, m > 0 ? GENRE[(uint32_t)(m - 1) % NGENRE].name : "ANY", 12);
|
||||
else if (f == 'r') str_cpy(b, m == 0 ? "1/4" : m == 1 ? "1/8" : m == 2 ? "1/16" : "1/32", 8);
|
||||
else if (a == SE_REPEAT && m > 8) str_cpy(b, "FILL", 8);
|
||||
else {
|
||||
if ((f == 'n' || f == 's') && m > 0) b[0] = '+';
|
||||
fmt_int(b + str_len(b), m);
|
||||
if (f == '%') str_cpy(b + str_len(b), "%", 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* (V10.8.49) NUDGE: every note step's MICRO in lo .. lo+n-1 d 64ths of a step later (d < 0: earlier) together, each
|
||||
* held at MICRO's range; the first note's MICRO said. (V10.8.52) HUMANIZE (h): each its own, up to d either way */
|
||||
static __attribute__((noinline)) const char *tl_nudge(track_t *t, int32_t d, uint32_t lo, uint32_t n, int h)
|
||||
{
|
||||
static char b[16];
|
||||
uint32_t len = tl_len(t), i, n = 0, f = 0;
|
||||
uint32_t i, c = 0, f = 0;
|
||||
int32_t m = 0, v;
|
||||
for (i = 0; i < len; i++) {
|
||||
for (i = lo; i < lo + n; i++) {
|
||||
step_t *s = &t->step[i];
|
||||
if (s->time != ST_NOTE)
|
||||
continue;
|
||||
v = clamp(ST_MICRO(s) + d, MICRO_MIN, MICRO_MAX);
|
||||
v = clamp(ST_MICRO(s) + (h ? (int32_t)tl_rnd(2u * (uint32_t)d + 1u) - d : d), MICRO_MIN, MICRO_MAX);
|
||||
if (!f++) m = v;
|
||||
if (v != ST_MICRO(s)) { ST_MICRO_SET(s, v); n++; }
|
||||
if (v != ST_MICRO(s)) { ST_MICRO_SET(s, v); c++; }
|
||||
}
|
||||
if (!n) { ui_message(f ? "NUDGE: AT ITS LIMIT" : "NO NOTES"); return 0; }
|
||||
if (!c) { ui_message(f ? "NUDGE: AT ITS LIMIT" : "NO NOTES"); return 0; }
|
||||
str_cpy(b, m > 0 ? "NUDGE +" : "NUDGE ", sizeof b);
|
||||
fmt_int(b + str_len(b), m);
|
||||
str_cpy(b + str_len(b), "/64", 4);
|
||||
return b;
|
||||
return h ? "HUMANIZED" : b;
|
||||
}
|
||||
/* the action of place p on track t (lane l): its message; 0 = nothing done (said why) */
|
||||
static __attribute__((noinline)) const char *tl_do(track_t *t, uint32_t p, uint32_t l)
|
||||
|
||||
static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t f, uint32_t lo, uint32_t n, uint32_t len);
|
||||
/* action a (SE_*) with amount m on track t's selection (or all of it): 0 nothing done (said why) */
|
||||
static __attribute__((noinline)) void se_do(uint32_t a, int32_t m)
|
||||
{
|
||||
static char b[24];
|
||||
uint32_t len = tl_len(t), i, n = 0;
|
||||
track_t *t = TSEL;
|
||||
char b[24];
|
||||
uint32_t len = tl_len(t), lo, n, i, j, sel = (uint32_t)seq_sel(t, &lo, &n, len), dr = (uint32_t)drum_track(t), nl;
|
||||
uint64_t was = tl_used(t, len);
|
||||
const char *msg = 0;
|
||||
l %= NLANE;
|
||||
if (p == TL_CAUTO) { /* (JIANT 0.6.8) the automation and locks, every step */
|
||||
if (!motion_count(t)) {
|
||||
ui_message("NOTHING TO CLEAR");
|
||||
return 0;
|
||||
}
|
||||
motion_clear(t);
|
||||
return "AUTOMATION CLEARED";
|
||||
if (chain_busy()) { ui_message("SONG PLAYS: STOP IT TO EDIT"); return; }
|
||||
if (a == SE_CSTEP) { seq_clr_step(); return; }
|
||||
if (a >= SE_NOTES && a != SE_HUMAN && a != SE_THIN && a != SE_STUT && a < SE_MUTATE && dr) { ui_message("NOTES ONLY"); return; }
|
||||
clay_sp[10] = (int16_t)((a + 1u) | (uint32_t)(uint8_t)m << 8); /* (the UNDO key's words: the last action) */
|
||||
clay_sp[11] = (int16_t)(lo | n << 6);
|
||||
if (a == SE_COPY || a == SE_DUP) {
|
||||
cp_add = cp_add_acc = 0;
|
||||
cp_copy((~(uint64_t)0 >> (NSTEP - n)) << lo); /* ("COPY 5-8") */
|
||||
if (a == SE_COPY) return;
|
||||
if (lo + n >= NSTEP) { ui_message("NO ROOM"); return; }
|
||||
cp_put(t, lo + n, 2u); /* (DUP: right after them, LEN grown; one UNDO) */
|
||||
if (sel) sel_set(lo + n, lo + 2u * n - 1u < NSTEP ? lo + 2u * n - 1u : NSTEP - 1u);
|
||||
return;
|
||||
}
|
||||
if (a == SE_PASTE) {
|
||||
if (!clip.n) { ui_message("NOTHING COPIED"); return; }
|
||||
if (!sel) { cp_put(t, 0, 1u); return; } /* (the whole sequence: PASTE SEQ, as before) */
|
||||
if (m) { /* INSERT: the steps from lo on moved along, LEN grown */
|
||||
nl = len + clip.n < NSTEP ? len + clip.n : NSTEP;
|
||||
undo_mark();
|
||||
for (i = len; i < nl; i++) { step_clear(&t->step[i]); (void)motion_clear_locks(t, i); }
|
||||
tl_take(t);
|
||||
tl_rot(t, lo, nl, (int32_t)(nl - len), nl);
|
||||
t->p[P_SLEN] = (int16_t)nl;
|
||||
}
|
||||
cp_put(t, lo, 0);
|
||||
return;
|
||||
}
|
||||
if (a == SE_GEN) { /* (V10.8.53) the track's generator inside the selection: the genre
|
||||
* KNOB 4's, a new seed each time ("GEN TECHNO 5-8 #1791") */
|
||||
tg_config_t *c = &tg_config[trk_index(t)];
|
||||
c->genre = (uint8_t)m;
|
||||
c->seed = (uint16_t)tl_rnd(10000u);
|
||||
trackgen_make(lo, n);
|
||||
str_cpy(b, "GEN ", sizeof b);
|
||||
se_amt(a, b + 4);
|
||||
str_cpy(b + str_len(b), " ", 2);
|
||||
cp_say(b, lo, n);
|
||||
str_cpy(b, ui.msg, sizeof b - 6);
|
||||
str_cpy(b + str_len(b), " #", 3);
|
||||
fmt_int(b + str_len(b), c->seed);
|
||||
ui_message(b);
|
||||
return;
|
||||
}
|
||||
undo_mark(); /* (one UNDO point each) */
|
||||
tl_take(t);
|
||||
switch (p) {
|
||||
case TL_CLEAR: { /* (0.6.28: names the track, ends its held / repeated notes) */
|
||||
static char cb[20];
|
||||
for (i = 0; i < len; i++)
|
||||
step_clear(&t->step[i]);
|
||||
latch_drop_req |= (uint8_t)(1u << trk_index(t));
|
||||
str_cpy(cb, "T1 CLEARED", sizeof cb);
|
||||
cb[1] = (char)('1' + trk_index(t));
|
||||
msg = cb;
|
||||
switch (a) {
|
||||
case SE_RAND: { /* (V10.8.53) new notes on the grid KNOB 4 picks (1/4 .. 1/32: a
|
||||
* step in 4, 2, every one, every one doubled), in the scale */
|
||||
uint32_t g = m == 0 ? 4u : m == 1 ? 2u : 1u, root = 48u + (uint32_t)clamp(t->p[P_ROOT], 0, 11);
|
||||
for (i = lo; i < lo + n; i++) {
|
||||
step_t *x = &t->step[i];
|
||||
step_clear(x);
|
||||
if ((i - lo) % g || tl_rnd(100u) >= 60u) continue;
|
||||
x->time = ST_NOTE;
|
||||
x->vel = (uint8_t)(64u + tl_rnd(64u));
|
||||
if (dr) x->hit = (uint8_t)(1u << tl_rnd(4u));
|
||||
else { x->n = 1; x->note[0] = (uint8_t)clamp(scale_steps(t, (int32_t)root, (int32_t)tl_rnd(15u) - 7), 0, 127); }
|
||||
if (m == 3) step_set_ratchet(x, 2u);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TL_REV: tl_reverse(t, len); msg = "REVERSED"; break;
|
||||
case TL_LEFT: tl_shift(t, len, len - 1u); msg = "SHIFTED LEFT"; break;
|
||||
case TL_RIGHT: tl_shift(t, len, 1u); msg = "SHIFTED RIGHT"; break;
|
||||
case TL_RANDOM: case TL_COOK: case TL_BEAT: /* (V10.8.49, the owner) SEQ TOOLS: STRETCH x2, SQUEEZE /2, REPEAT x2 */
|
||||
return tl_shape(t, p, len, b);
|
||||
default: /* the lane's */
|
||||
str_cpy(b, drum_lane_name(t, l), sizeof b);
|
||||
if (p == TL_LCLR) {
|
||||
tl_lane_clear(t, len, l);
|
||||
msg = " CLEARED";
|
||||
} else if (p == TL_LREV) {
|
||||
for (i = 0; i < len; i++) {
|
||||
const step_t *s = &tl_src[len - 1u - i];
|
||||
grid_hit(t, i, l, tl_lane(s, l));
|
||||
if (tl_lane(s, l))
|
||||
grid_acc(t, i, l, (step_accents_of(TSEL,s) >> l) & 1u);
|
||||
}
|
||||
msg = " REVERSED";
|
||||
} else {
|
||||
n = tl_fill(t, len, l);
|
||||
msg = n == 1u ? " EVERY STEP" : n == 2u ? " EVERY 2ND" : n ? " EVERY 4TH" : " CLEARED";
|
||||
case SE_STRETCH: case SE_SQUEEZE: case SE_REPEAT:
|
||||
if (a == SE_REPEAT && m > 8) m = (int32_t)((NSTEP - len + n) / n); /* (FILL: as many as fit in 64) */
|
||||
nl = m < 2 ? 0u : tl_reshape(t, a == SE_STRETCH ? 1 : a == SE_SQUEEZE ? -1 : 0, (uint32_t)m, lo, n, len);
|
||||
if (!nl) { ui_message(a == SE_SQUEEZE ? "TOO SHORT" : "64 STEPS ALREADY"); return; }
|
||||
if (sel) sel_set(lo, lo + n - 1u + nl - len < NSTEP ? lo + n - 1u + nl - len : NSTEP - 1u);
|
||||
len = nl; /* (the emptied: of the new LEN) */
|
||||
break;
|
||||
case SE_NUDGE: case SE_HUMAN:
|
||||
if (!(msg = tl_nudge(t, m, lo, n, a == SE_HUMAN))) return;
|
||||
break;
|
||||
case SE_ROTATE: tl_rot(t, lo, lo + n, m, len); break;
|
||||
case SE_SHIFT: /* the steps slid m along, the ones there round them */
|
||||
i = m < 0 ? (uint32_t)clamp((int32_t)lo + m, 0, (int32_t)lo) : lo;
|
||||
j = m > 0 ? (uint32_t)clamp((int32_t)(lo + n) + m, (int32_t)(lo + n), (int32_t)len) : lo + n;
|
||||
if (j - i <= n) { ui_message("AT THE EDGE"); return; }
|
||||
tl_rot(t, i, j, m < 0 ? (int32_t)(i - lo) : (int32_t)(j - lo - n), len);
|
||||
if (sel) sel_set(m < 0 ? i : j - n, (m < 0 ? i : j - n) + n - 1u);
|
||||
break;
|
||||
case SE_REVERSE: tl_reverse(t, lo, n, len); break;
|
||||
case SE_CAUTO: { /* the automation and locks of the steps (none selected: all) */
|
||||
uint32_t f = motion_guard(), k = trk_index(t), c = 0;
|
||||
for (i = 0; i < motion.count; i++) {
|
||||
motion_event_t e = motion.event[i];
|
||||
if (MOTION_TRK(&e) != k || MOTION_STEP(&e) < lo || MOTION_STEP(&e) >= lo + n) motion.event[c++] = e;
|
||||
}
|
||||
str_cpy(b + str_len(b), msg, sizeof b - str_len(b));
|
||||
msg = b;
|
||||
j = motion.count - c;
|
||||
memset(motion.event + c, 0, (MOTION_MAX - c) * sizeof motion.event[0]);
|
||||
motion.count = (uint8_t)c;
|
||||
motion_unguard(f);
|
||||
if (!sel) motion_clear(t);
|
||||
if (!j && !sel) { ui_message("NOTHING TO CLEAR"); return; }
|
||||
break;
|
||||
}
|
||||
case SE_ARP: { /* a chord's notes one a step, over the TIEs it holds on */
|
||||
uint32_t c = 0, k = 0, v = 100, q;
|
||||
uint8_t nt[4];
|
||||
for (i = lo; i < lo + n; i++) {
|
||||
step_t *x = &t->step[i];
|
||||
if (x->time == ST_NOTE && x->n > 1u) {
|
||||
c = x->n; v = x->vel; k = 0;
|
||||
memcpy(nt, x->note, 4);
|
||||
for (j = 1; j < c; j++) for (q = j; q && nt[q - 1u] > nt[q]; q--) { uint8_t e = nt[q]; nt[q] = nt[q - 1u]; nt[q - 1u] = e; }
|
||||
} else if (!c || x->time != ST_TIE) { c = 0; continue; }
|
||||
x->time = ST_NOTE; x->vel = (uint8_t)v;
|
||||
q = k % (2u * c - 2u);
|
||||
j = m == 3 ? tl_rnd(c) : m == 2 ? (q < c ? q : 2u * c - 2u - q) : m ? c - 1u - k % c : k % c;
|
||||
x->n = 1; x->note[0] = nt[j]; k++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: /* CLEAR, and each step of them on its own */
|
||||
if (a == SE_INVERT) { /* round the middle of the lowest and the highest note */
|
||||
uint32_t lo2 = 127, hi = 0;
|
||||
for (i = lo; i < lo + n; i++)
|
||||
for (j = 0; t->step[i].time == ST_NOTE && j < t->step[i].n; j++) {
|
||||
if (t->step[i].note[j] < lo2) lo2 = t->step[i].note[j];
|
||||
if (t->step[i].note[j] > hi) hi = t->step[i].note[j];
|
||||
}
|
||||
m = (int32_t)(lo2 + hi);
|
||||
}
|
||||
for (i = lo; i < lo + n; i++) {
|
||||
step_t *x = &t->step[i];
|
||||
if (a == SE_CLEAR) { step_clear(x); continue; }
|
||||
if (x->time != ST_NOTE || (!x->n && !x->hit)) continue;
|
||||
if (a == SE_VEL) x->vel = (uint8_t)clamp((int32_t)x->vel + (int32_t)tl_rnd(254u * (uint32_t)m / 100u + 1u) -
|
||||
127 * m / 100, 1, 127);
|
||||
else if (a == SE_THIN) { if (tl_rnd(100u) < (uint32_t)m) step_clear(x); }
|
||||
else if (a == SE_STUT) x->flags = (uint8_t)((x->flags & ~SF_RATCH) | (uint32_t)(m - 1) << SF_RATCH_SH);
|
||||
else if (a == SE_MUTATE) { /* each step, m %: a degree or two, its velocity, its place */
|
||||
if (tl_rnd(100u) >= (uint32_t)m) continue;
|
||||
if (!dr) x->note[0] = (uint8_t)clamp(scale_steps(t, x->note[0], (int32_t)tl_rnd(5u) - 2), 0, 127);
|
||||
x->vel = (uint8_t)clamp((int32_t)x->vel + (int32_t)tl_rnd(41u) - 20, 1, 127);
|
||||
ST_MICRO_SET(x, clamp(ST_MICRO(x) + (int32_t)tl_rnd(9u) - 4, MICRO_MIN, MICRO_MAX));
|
||||
}
|
||||
else
|
||||
for (j = 0; j < x->n; j++)
|
||||
x->note[j] = (uint8_t)clamp(a == SE_INVERT ? m - x->note[j] : a == SE_TRANSP ? x->note[j] + m : a == SE_OCT ? x->note[j] + 12 * m :
|
||||
scale_steps(t, x->note[j], (int32_t)tl_rnd(2u * (uint32_t)m + 1u) - m), 0, 127);
|
||||
}
|
||||
if (a == SE_CLEAR && !sel) latch_drop_req |= (uint8_t)(1u << trk_index(t)); /* (its held notes end) */
|
||||
break;
|
||||
}
|
||||
tl_unlock(t, was, len);
|
||||
return msg;
|
||||
if (!msg) {
|
||||
str_cpy(b, SE[a].nm, sizeof b);
|
||||
if (SE[a].f) { str_cpy(b + str_len(b), " ", 2); se_amt(a, b + str_len(b)); }
|
||||
str_cpy(b + str_len(b), " ", 2);
|
||||
cp_say(b, lo, n); /* "STRETCH x2 5-8" */
|
||||
} else
|
||||
ui_message(msg);
|
||||
ui.force = 1;
|
||||
}
|
||||
|
||||
/* (V10.8.52) SEQ EDIT's UNDO key (F#5): the last action back, again: forward ("UNDO STRETCH x2 5-8", "REDO ..") */
|
||||
static void se_undo(void)
|
||||
{
|
||||
char b[24];
|
||||
uint32_t a = ((uint32_t)clay_sp[10] & 255u) - 1u, r = (uint16_t)clay_sp[11];
|
||||
int16_t md = se_md;
|
||||
if (chain_busy() || undo_do()) { ui_message("NOTHING TO UNDO"); return; }
|
||||
clay_sp[11] = (int16_t)(r ^ 0x8000u);
|
||||
if (a >= SE_N) { ui_message(r >> 15 ? "REDONE" : "UNDONE"); return; }
|
||||
str_cpy(b, r >> 15 ? "REDO " : "UNDO ", sizeof b);
|
||||
str_cpy(b + 5, SE[a].nm, sizeof b - 5);
|
||||
se_md = (int16_t)(int8_t)(clay_sp[10] >> 8);
|
||||
if (SE[a].f) { str_cpy(b + str_len(b), " ", 2); se_amt(a, b + str_len(b)); }
|
||||
se_md = md;
|
||||
str_cpy(b + str_len(b), " ", 2);
|
||||
cp_say(b, r & 63u, (r >> 6) & 127u);
|
||||
ui.force = 1;
|
||||
}
|
||||
|
||||
/* the lane's tools (DRUM: G4 CLR, A4 REV, B4 FILL the lane ui.lane): its message; 0 = nothing done */
|
||||
static __attribute__((noinline)) const char *tl_do(track_t *t, uint32_t p, uint32_t l)
|
||||
{
|
||||
static char b[24];
|
||||
uint32_t len = tl_len(t), i, n;
|
||||
const char *msg;
|
||||
l %= NLANE;
|
||||
undo_mark();
|
||||
tl_take(t);
|
||||
str_cpy(b, drum_lane_name(t, l), sizeof b);
|
||||
if (p == TL_LCLR) {
|
||||
tl_lane_clear(t, len, l);
|
||||
msg = " CLEARED";
|
||||
} else if (p == TL_LREV) {
|
||||
for (i = 0; i < len; i++) {
|
||||
const step_t *s = &tl_src[len - 1u - i];
|
||||
grid_hit(t, i, l, tl_lane(s, l));
|
||||
if (tl_lane(s, l))
|
||||
grid_acc(t, i, l, (step_accents_of(TSEL,s) >> l) & 1u);
|
||||
}
|
||||
msg = " REVERSED";
|
||||
} else {
|
||||
n = tl_fill(t, len, l);
|
||||
msg = n == 1u ? " EVERY STEP" : n == 2u ? " EVERY 2ND" : n ? " EVERY 4TH" : " CLEARED";
|
||||
}
|
||||
str_cpy(b + str_len(b), msg, sizeof b - str_len(b));
|
||||
return b;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------- (0.6.85) SEQ > STRETCH --- */
|
||||
/* (V10.8.51) steps lo .. lo+n-1 of the selected track (tl_src: the steps before), the steps after them moved along, LEN
|
||||
* with them (64 at most: what falls past is cut), their automation and locks with their steps:
|
||||
* k 2, STRETCH x2: step i to step 2i; a note held into the next step (a TIE after it) holds over the new one
|
||||
* k -2, SQUEEZE /2: step j takes the first that plays of 2j, 2j+1 (a TIE if the note before holds on)
|
||||
* k 0, REPEAT x2: the steps again right after them, their automation and locks copied while there is room
|
||||
* with them (64 at most: what falls past is cut), their automation and locks with their steps; (V10.8.52) f times:
|
||||
* k 1, STRETCH xf: step i to step fi; a note held into the next step (a TIE after it) holds over the new ones
|
||||
* k -1, SQUEEZE /f: step j takes the first that plays of fj .. fj+f-1 (a TIE if the note before holds on)
|
||||
* k 0, REPEAT xf: the steps f times, their automation and locks copied while there is room
|
||||
* Returns the new LEN (0: nothing to do) */
|
||||
BTAPP_FN static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t lo, uint32_t n, uint32_t len)
|
||||
BTAPP_FN static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t q, uint32_t lo, uint32_t n, uint32_t len)
|
||||
{
|
||||
uint32_t nn = k < 0 ? (n + 1u) / 2u : n * 2u, nlen = len - n + nn, i, j, c, f, tk = trk_index(t);
|
||||
uint32_t nn = k < 0 ? (n + q - 1u) / q : n * q, nlen = len - n + nn, i, j, c, f, tk = trk_index(t);
|
||||
if (nlen > NSTEP) nlen = NSTEP;
|
||||
if (nlen == len) return 0;
|
||||
undo_mark(); /* (V10.8.51: one UNDO point) */
|
||||
for (j = lo; j < (len > nlen ? len : nlen); j++) step_clear(&t->step[j]); /* (past both LENs: as they were) */
|
||||
for (i = lo + n; i < len; i++) /* the steps after the range */
|
||||
if (i - n + nn < NSTEP) t->step[i - n + nn] = tl_src[i];
|
||||
for (i = 0; i < nn && lo + i < NSTEP; i++) {
|
||||
step_t *d = &t->step[lo + i];
|
||||
if (k > 0) { /* STRETCH: the even ones */
|
||||
const step_t *s = &tl_src[lo + i / 2u];
|
||||
if (!(i & 1u)) *d = *s;
|
||||
else if (s->time == ST_TIE || (s->time == ST_NOTE && s->n && lo + i / 2u + 1u < len &&
|
||||
tl_src[lo + i / 2u + 1u].time == ST_TIE))
|
||||
if (k > 0) { /* STRETCH: every q-th */
|
||||
const step_t *s = &tl_src[lo + i / q];
|
||||
if (!(i % q)) *d = *s;
|
||||
else if (s->time == ST_TIE || (s->time == ST_NOTE && s->n && lo + i / q + 1u < len &&
|
||||
tl_src[lo + i / q + 1u].time == ST_TIE))
|
||||
d->time = ST_TIE, d->vel = s->vel;
|
||||
} else if (!k) /* REPEAT */
|
||||
*d = tl_src[lo + i % n];
|
||||
else { /* SQUEEZE */
|
||||
uint32_t a = lo + 2u * i, tie = 0;
|
||||
for (j = a; j < a + 2u && j < lo + n; j++) {
|
||||
uint32_t a = lo + q * i, tie = 0;
|
||||
for (j = a; j < a + q && j < lo + n; j++) {
|
||||
if (tl_src[j].time == ST_NOTE && (tl_src[j].n || tl_src[j].hit)) break;
|
||||
tie |= tl_src[j].time == ST_TIE;
|
||||
}
|
||||
if (j < a + 2u && j < lo + n) *d = tl_src[j];
|
||||
if (j < a + q && j < lo + n) *d = tl_src[j];
|
||||
else if (tie && lo + i) d->time = ST_TIE, d->vel = tl_src[a].vel;
|
||||
}
|
||||
}
|
||||
@@ -265,7 +451,7 @@ BTAPP_FN static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t lo, uint32_t
|
||||
if (MOTION_TRK(&e) == tk) {
|
||||
if (st >= len) { if (st < nlen) continue; } /* (its step covered now) */
|
||||
else if (st >= lo + n) st = st - n + nn;
|
||||
else if (st >= lo) st = k < 0 ? lo + (st - lo) / 2u : k ? lo + (st - lo) * 2u : st;
|
||||
else if (st >= lo) st = k < 0 ? lo + (st - lo) / q : k ? lo + (st - lo) * q : st;
|
||||
if (st >= nlen) continue; /* (cut with its step) */
|
||||
e.place = (uint8_t)((e.place & 0xC0u) | st);
|
||||
}
|
||||
@@ -273,12 +459,14 @@ BTAPP_FN static uint32_t tl_reshape(track_t *t, int32_t k, uint32_t lo, uint32_t
|
||||
}
|
||||
memset(motion.event + c, 0, (MOTION_MAX - c) * sizeof motion.event[0]);
|
||||
motion.count = (uint8_t)c;
|
||||
for (i = 0; !k && i < c; i++) { /* REPEAT: the range's on the copy */
|
||||
for (i = 0; !k && i < c; i++) { /* REPEAT: the range's on the copies */
|
||||
motion_event_t e = motion.event[i];
|
||||
uint32_t st = MOTION_STEP(&e);
|
||||
if (MOTION_TRK(&e) != tk || st < lo || st >= lo + n || st + n >= nlen || motion.count >= MOTION_MAX) continue;
|
||||
e.place = (uint8_t)((e.place & 0xC0u) | (st + n));
|
||||
motion.event[motion.count++] = e;
|
||||
if (MOTION_TRK(&e) != tk || st < lo || st >= lo + n) continue;
|
||||
for (j = st + n; j < lo + nn && j < nlen && motion.count < MOTION_MAX; j += n) {
|
||||
e.place = (uint8_t)((e.place & 0xC0u) | j);
|
||||
motion.event[motion.count++] = e;
|
||||
}
|
||||
}
|
||||
RING_PUBLISH();
|
||||
motion_unguard(f);
|
||||
|
||||
@@ -45,7 +45,7 @@ static int verify(track_t *t,unsigned genre,unsigned role,unsigned len)
|
||||
char name[20];memcpy(name,gmut_name,20);
|
||||
shift_valid[0][k]=shift_valid[1][k]=1;
|
||||
t->jump_to=5;t->rev=1;
|
||||
trackgen_make();project_capture(&after);
|
||||
trackgen_make(0,0);project_capture(&after);
|
||||
ok &= !shift_valid[0][k]&&!shift_valid[1][k];
|
||||
ok &= !t->jump_to&&!t->rev;
|
||||
ok &= !memcmp(&p,&gp,sizeof p)&&!memcmp(&s,&gs,sizeof s)&&!memcmp(&x,&gx,sizeof x)&&
|
||||
@@ -62,7 +62,7 @@ static int verify(track_t *t,unsigned genre,unsigned role,unsigned len)
|
||||
if(i>=len) ok &= !memcmp(st,&before.t[k].step[i],sizeof *st);
|
||||
if(!drum_track(t)) for(j=0;j<st->n&&i<len;j++) ok &= st->note[j]==scale_snap(t,st->note[j]);
|
||||
}
|
||||
step_t first[NSTEP];memcpy(first,t->step,sizeof first);trackgen_make();
|
||||
step_t first[NSTEP];memcpy(first,t->step,sizeof first);trackgen_make(0,0);
|
||||
ok &= !memcmp(first,t->step,sizeof first);
|
||||
return ok;
|
||||
}
|
||||
@@ -112,14 +112,14 @@ int main(void)
|
||||
ui_power_on();song.sel=1;set_engine_of(&trk[1],ENGI_ANALOG);trk[1].engine=ENGI_ANALOG;
|
||||
song.playing=1;
|
||||
static project_t before,generated,reloaded;static project_store_t stored;
|
||||
project_capture(&before);trackgen_make();project_capture(&generated);
|
||||
project_capture(&before);trackgen_make(0,0);project_capture(&generated);
|
||||
ok=proj_pack(&stored,&generated)&&proj_import(&reloaded,&stored,sizeof stored);
|
||||
ok &= !memcmp(reloaded.t[1].step,generated.t[1].step,sizeof generated.t[1].step);
|
||||
bad+=check("track GEN result round trips through the existing project format",ok);
|
||||
ok=!undo_do();project_capture(&reloaded);
|
||||
for(unsigned k=0;k<NTRK;k++) ok &= !memcmp(before.t[k].step,reloaded.t[k].step,sizeof before.t[k].step);
|
||||
bad+=check("track GEN existing UNDO restores all previous patterns",ok);
|
||||
chain.armed=1;project_capture(&before);trackgen_make();project_capture(&generated);
|
||||
chain.armed=1;project_capture(&before);trackgen_make(0,0);project_capture(&generated);
|
||||
ok=!memcmp(&before,&generated,sizeof before);chain.armed=0;
|
||||
bad+=check("track GEN cannot overwrite an armed arrangement",ok);
|
||||
song.sel=1;set_engine_of(&trk[1],ENGI_ANALOG);trk[1].engine=ENGI_ANALOG;
|
||||
|
||||
+132
-96
@@ -7735,6 +7735,8 @@ static void tl_melody(void)
|
||||
}
|
||||
static int tl_lock_at(uint32_t step) { int16_t v; return motion_lock_get(TSEL, step, P_REV, &v) && v == 50; }
|
||||
static void tl_key(uint32_t w) { key_down(white(w)); frame(); key_up(white(w)); frame(); }
|
||||
/* (V10.8.53) SEQ EDIT (SEQ held): the ACTION a with its amount m, done with D5 */
|
||||
static void se_run(uint32_t a, int32_t m) { se_st = (int16_t)a; se_md = (int16_t)m; tl_key(12); }
|
||||
static uint32_t tl_count(const track_t *t, uint32_t l)
|
||||
{
|
||||
uint32_t i, c = 0;
|
||||
@@ -8015,7 +8017,7 @@ static int test_copy_paste(void)
|
||||
uint32_t i;
|
||||
int16_t v;
|
||||
track_t *t = &trk[0], *u = &trk[1], *d = &trk[2];
|
||||
step_t keep[NSTEP];
|
||||
step_t keep[NSTEP], mid_steps[NSTEP];
|
||||
char tag[8];
|
||||
ui_power_on(); stop_transport();
|
||||
memset(&clip, 0, sizeof clip);
|
||||
@@ -8101,26 +8103,25 @@ static int test_copy_paste(void)
|
||||
ok &= song.rec == 1u;
|
||||
song.rec = 0;
|
||||
bad += check(" REC alone still arms; a step key held with the clipboard empty too", ok);
|
||||
{ /* (V10.8.50) the owner: "copy, paste, duplicate; select": SEQ TOOLS C5 DUP, step keys held + EDIT clear them */
|
||||
{ /* (V10.8.50, V10.8.52 SEQ EDIT) DUP (SEQ + C5): the steps selected (none: the whole sequence) again right after
|
||||
* them, LEN grown, their locks too; step keys held + EDIT clear those steps */
|
||||
char kn[16];
|
||||
t = &trk[0]; track_select(0); frame();
|
||||
for (i = 0; i < NSTEP; i++) step_clear(&t->step[i]);
|
||||
t->p[P_SLEN] = 8;
|
||||
for (i = 4; i < 8u; i++) { t->step[i].time = ST_NOTE; t->step[i].n = 1; t->step[i].note[0] = (uint8_t)(60 + i); t->step[i].vel = 100; }
|
||||
motion_clear(t);
|
||||
ok = motion_set_lock(t, 5, P_PAN, 30) == 0;
|
||||
memset(&clip, 0, sizeof clip);
|
||||
(void)ly_keyname(LAYER_SEQ, 0, TL_DUP, kn);
|
||||
ok &= str_eq(kn, "DUP");
|
||||
ly_white(B_SEQ, TL_DUP);
|
||||
ok &= msg_is("NOTHING COPIED") && t->p[P_SLEN] == 8;
|
||||
cp_keys_down(4, 7); /* steps 5..8 held, SELECT turned */
|
||||
turn(EN_SELECT, 1);
|
||||
cp_keys_up();
|
||||
ok &= clip.n == 4u && clip.lo == 4u && msg_is("COPY 5-8");
|
||||
sel_of(0) = 0;
|
||||
(void)kn; /* (SEQ EDIT draws its own map: no key names) */
|
||||
cp_keys_down(4, 7); frame(); /* steps 5..8 held: selected */
|
||||
ok &= msg_is("SEL 5-8");
|
||||
cp_keys_up(); frame();
|
||||
ly_white(B_SEQ, TL_DUP);
|
||||
ok &= t->p[P_SLEN] == 12 && msg_is("DUP 9-12") && !memcmp(&t->step[8], &t->step[4], 4 * sizeof(step_t)) &&
|
||||
motion_lock_get(t, 9, P_PAN, &v) && v == 30 && motion_lock_get(t, 5, P_PAN, &v);
|
||||
bad += check("V10.8.50 DUP (SEQ + C5, its name on the map): steps 5-8 again at 9-12, LEN 8 -> 12, the lock too", ok);
|
||||
bad += check("V10.8.52 DUP (SEQ + C5): SEL 5-8 again at 9-12, LEN 8 -> 12, the lock too", ok);
|
||||
ok = !undo_do() && t->p[P_SLEN] == 8 && t->step[8].time != ST_NOTE && !motion_lock_get(t, 9, P_PAN, &v);
|
||||
bad += check(" UNDO takes the DUP back (LEN too)", ok);
|
||||
cp_keys_down(5, 6); /* steps 6 and 7 held + EDIT: cleared */
|
||||
@@ -8131,15 +8132,18 @@ static int test_copy_paste(void)
|
||||
bad += check(" step keys 6 + 7 held + EDIT clear those steps (notes, the lock), the others stay", ok);
|
||||
ok = !undo_do() && t->step[5].time == ST_NOTE && motion_lock_get(t, 5, P_PAN, &v);
|
||||
bad += check(" UNDO takes the CLEAR back", ok);
|
||||
clip.lo = 60; clip.n = 4;
|
||||
t->p[P_SLEN] = 64;
|
||||
sel_of(0) = (int16_t)(0x8000u | 63u << 8 | 60u);
|
||||
ly_white(B_SEQ, TL_DUP);
|
||||
ok = msg_is("NO ROOM") && t->p[P_SLEN] == 8;
|
||||
ok = msg_is("NO ROOM") && t->p[P_SLEN] == 64;
|
||||
bad += check(" DUP with no room left in 64 steps refused", ok);
|
||||
t->p[P_SLEN] = 8;
|
||||
sel_of(0) = 0;
|
||||
memset(&clip, 0, sizeof clip);
|
||||
}
|
||||
{ /* (V10.8.51) the owner: "select, stretch and squeeze": step keys held on the roll, SEL 5-8; SEQ TOOLS' C4 D4 E4
|
||||
* (STRETCH SQUEEZE REPEAT) then on that range only, once (no range: the whole track); the steps after it move
|
||||
* along, LEN with it; its locks with their steps; one UNDO */
|
||||
{ /* (V10.8.51, V10.8.52 SEQ EDIT) the owner: "select, stretch and squeeze": step keys held on the roll, SEL 5-8; SEQ
|
||||
* EDIT's STRETCH SQUEEZE REPEAT on that range (none: the whole track); the steps after it move along, LEN with
|
||||
* it; its locks with their steps; one UNDO */
|
||||
track_t *t = &trk[0];
|
||||
int16_t v;
|
||||
track_select(0); frame();
|
||||
@@ -8147,40 +8151,71 @@ static int test_copy_paste(void)
|
||||
t->p[P_SLEN] = 8;
|
||||
for (i = 0; i < 8u; i++) { t->step[i].time = ST_NOTE; t->step[i].n = 1; t->step[i].note[0] = (uint8_t)(60 + i); t->step[i].vel = 100; }
|
||||
motion_clear(t);
|
||||
sel_of(0) = 0;
|
||||
ok = motion_set_lock(t, 5, P_PAN, 30) == 0 && motion_set_lock(t, 7, P_PAN, 40) == 0;
|
||||
cp_keys_down(4, 7); frame();
|
||||
ok &= msg_is("SEL 5-8");
|
||||
cp_keys_up(); frame();
|
||||
ly_white(B_SEQ, TL_RANDOM);
|
||||
ok &= msg_is("STRETCH 5-8") && t->p[P_SLEN] == 12 && t->step[3].note[0] == 63 && t->step[4].note[0] == 64 &&
|
||||
btn_down(B_SEQ); frame();
|
||||
se_run(SE_STRETCH, 2);
|
||||
ok &= msg_is("STRETCH x2 5-8") && t->p[P_SLEN] == 12 && t->step[3].note[0] == 63 && t->step[4].note[0] == 64 &&
|
||||
t->step[6].note[0] == 65 && t->step[8].note[0] == 66 && t->step[10].note[0] == 67 && t->step[5].time != ST_NOTE &&
|
||||
motion_lock_get(t, 6, P_PAN, &v) && v == 30 && motion_lock_get(t, 10, P_PAN, &v) && v == 40 &&
|
||||
!motion_lock_get(t, 5, P_PAN, &v);
|
||||
bad += check("V10.8.51 SEL 5-8 + STRETCH (SEQ + C4): steps 5-8 over 5-12, LEN 8 -> 12, the locks with their steps", ok);
|
||||
bad += check("V10.8.52 SEQ EDIT: SEL 5-8 + STRETCH x2: steps 5-8 over 5-12, LEN 8 -> 12, the locks with their steps", ok);
|
||||
ok = !undo_do() && t->p[P_SLEN] == 8 && t->step[5].note[0] == 65 && motion_lock_get(t, 5, P_PAN, &v);
|
||||
bad += check(" one UNDO takes it back", ok);
|
||||
ly_white(B_SEQ, TL_RANDOM);
|
||||
ok = msg_is("LEN 8 > 16") && t->p[P_SLEN] == 16 && t->step[14].note[0] == 67;
|
||||
bad += check(" the range used once: STRETCH again is the whole track (LEN 8 > 16)", ok);
|
||||
tl_key(1); /* G3: ALL STEPS */
|
||||
se_run(SE_STRETCH, 2);
|
||||
ok = msg_is("STRETCH x2 1-8") && t->p[P_SLEN] == 16 && t->step[14].note[0] == 67;
|
||||
bad += check(" G3 ALL: STRETCH is the whole track (LEN 8 > 16)", ok);
|
||||
(void)undo_do();
|
||||
cp_keys_down(4, 7); frame(); cp_keys_up(); frame();
|
||||
ly_white(B_SEQ, TL_COOK);
|
||||
ok = msg_is("SQUEEZE 5-8") && t->p[P_SLEN] == 6 && t->step[4].note[0] == 64 && t->step[5].note[0] == 66 &&
|
||||
sel_of(0) = (int16_t)(0x8000u | 7u << 8 | 4u);
|
||||
se_run(SE_SQUEEZE, 2);
|
||||
ok = msg_is("SQUEEZE /2 5-8") && t->p[P_SLEN] == 6 && t->step[4].note[0] == 64 && t->step[5].note[0] == 66 &&
|
||||
motion_lock_get(t, 5, P_PAN, &v) && v == 40;
|
||||
bad += check(" SEL 5-8 + SQUEEZE (D4): 5-8 into 5-6, LEN 8 -> 6, step 8's lock on step 6", ok);
|
||||
bad += check(" SEL 5-8 + SQUEEZE /2: 5-8 into 5-6, LEN 8 -> 6, step 8's lock on step 6", ok);
|
||||
(void)undo_do();
|
||||
cp_keys_down(4, 7); frame(); cp_keys_up(); frame();
|
||||
ly_white(B_SEQ, TL_BEAT);
|
||||
ok = msg_is("REPEAT 5-8") && t->p[P_SLEN] == 12 && t->step[8].note[0] == 64 && t->step[11].note[0] == 67 &&
|
||||
sel_of(0) = (int16_t)(0x8000u | 7u << 8 | 4u);
|
||||
se_run(SE_REPEAT, 2);
|
||||
ok = msg_is("REPEAT x2 5-8") && t->p[P_SLEN] == 12 && t->step[8].note[0] == 64 && t->step[11].note[0] == 67 &&
|
||||
motion_lock_get(t, 9, P_PAN, &v) && v == 30 && motion_lock_get(t, 5, P_PAN, &v);
|
||||
bad += check(" SEL 5-8 + REPEAT (E4): 5-8 again at 9-12, LEN 8 -> 12, its locks copied", ok);
|
||||
bad += check(" SEL 5-8 + REPEAT x2: 5-8 again at 9-12, LEN 8 -> 12, its locks copied", ok);
|
||||
(void)undo_do();
|
||||
btn_up(B_SEQ); frame();
|
||||
cp_keys_down(4, 7); frame(); cp_keys_up(); frame();
|
||||
cp_keys_down(1, 1); frame(); cp_keys_up(); frame(); /* (a step outside it alone: the selection gone) */
|
||||
ly_white(B_SEQ, TL_RANDOM);
|
||||
ok = msg_is("LEN 8 > 16");
|
||||
bad += check(" a step outside the range pressed alone drops it (the whole track again)", ok);
|
||||
cp_keys_down(1, 1); frame(); cp_keys_up(); frame(); /* (a step alone: the selection gone) */
|
||||
btn_down(B_SEQ); frame();
|
||||
se_run(SE_STRETCH, 2);
|
||||
ok = msg_is("STRETCH x2 1-8");
|
||||
bad += check(" a step pressed alone drops the selection (the whole track again)", ok);
|
||||
(void)undo_do();
|
||||
/* (V10.8.52) F#5: UNDO, again REDO, named */
|
||||
se_run(SE_TRANSP, 3);
|
||||
ok = msg_is("TRANSP +3 1-8") && t->step[0].note[0] == 63;
|
||||
key_down(black(10)); frame(); key_up(black(10)); frame();
|
||||
ok &= msg_is("UNDO TRANSP +3 1-8") && t->step[0].note[0] == 60;
|
||||
key_down(black(10)); frame(); key_up(black(10)); frame();
|
||||
ok &= msg_is("REDO TRANSP +3 1-8") && t->step[0].note[0] == 63;
|
||||
bad += check(" TRANSP +3; F#5 UNDO, again REDO, each named", ok);
|
||||
(void)undo_do();
|
||||
/* (V10.8.53, the owner) GENERATE in the selection (its genre KNOB 4's, a new seed), the rest kept; RANDOM on a grid */
|
||||
memcpy(mid_steps, t->step, sizeof mid_steps);
|
||||
sel_of(0) = (int16_t)(0x8000u | 7u << 8 | 4u);
|
||||
se_run(SE_GEN, 1);
|
||||
ok = !memcmp(t->step, mid_steps, 4 * sizeof(step_t)) && str_len(ui.msg) > 10 && ui.msg[0] == 'G' && ui.msg[1] == 'E' &&
|
||||
ui.msg[2] == 'N' && t->p[P_SLEN] == 8;
|
||||
for (i = 0; i < str_len(ui.msg) && ui.msg[i] != '#'; i++) ;
|
||||
ok &= i < str_len(ui.msg); /* "GEN <genre> 5-8 #seed" */
|
||||
bad += check(" V10.8.53 GENERATE in SEL 5-8: steps 1-4 kept, \"GEN <genre> 5-8 #seed\"", ok);
|
||||
(void)undo_do();
|
||||
tl_key(1);
|
||||
se_run(SE_RAND, 0);
|
||||
ok = msg_is("RANDOM 1/4 1-8");
|
||||
for (i = 0; i < 8u; i++) ok &= (i % 4u == 0u) || t->step[i].time != ST_NOTE;
|
||||
bad += check(" RANDOM 1/4: notes only on every fourth step", ok);
|
||||
(void)undo_do();
|
||||
btn_up(B_SEQ); frame();
|
||||
motion_clear(t);
|
||||
}
|
||||
return bad;
|
||||
@@ -8311,44 +8346,38 @@ static int test_seq_tools(void)
|
||||
bad += check("TRACK > CHANCE: the track's chance (100 % as before, 0 % silent), K2", ok);
|
||||
}
|
||||
|
||||
/* the whole sequence: REVERSE (a note's ties stay after it), SHIFT, CLEAR, locks, LEN, silent keys, undo */
|
||||
/* the whole sequence (V10.8.52 SEQ EDIT, no selection): REVERSE (a note's ties stay after it), ROTATE, CLEAR, CLR
|
||||
* AUTO, locks, silent keys; OCT- none selected, no octave */
|
||||
ui_power_on();
|
||||
tl_melody();
|
||||
sel_of(song.sel) = 0;
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
go_page(GR_ROLL); frame();
|
||||
usb.config = 1;
|
||||
{
|
||||
uint32_t mo = mo_w;
|
||||
btn_down(B_SEQ); frame();
|
||||
tl_key(1); /* G3: REVERSE */
|
||||
ok = ui.layer == LAYER_SEQ && !gates() && mo_w == mo && msg_is("REVERSED");
|
||||
se_run(SE_REVERSE, 0);
|
||||
ok = ui.layer == LAYER_SEQ && !gates() && mo_w == mo && msg_is("REVERSE 1-8");
|
||||
}
|
||||
usb.config = 0;
|
||||
ok &= TSEL->step[6].time == ST_NOTE && TSEL->step[6].note[0] == 60 && TSEL->step[7].time == ST_TIE &&
|
||||
TSEL->step[4].note[0] == 64 && TSEL->step[2].note[0] == 67 && TSEL->step[0].time == ST_REST &&
|
||||
TSEL->step[20].note[0] == 72 && tl_lock_at(4) && !tl_lock_at(3);
|
||||
bad += check(" G3 REVERSE: steps 1..LEN mirrored, C4 + its tie as C4 then the tie, the lock moves with E4", ok);
|
||||
bad += check(" SEQ EDIT REVERSE: steps 1..LEN mirrored, C4 + its tie as C4 then the tie, the lock moves with E4", ok);
|
||||
btn_up(B_SEQ); frame();
|
||||
motion_reset(TSEL); /* (no undo since TONIC: the melody again) */
|
||||
motion_reset(TSEL);
|
||||
tl_melody();
|
||||
memcpy(ref, TSEL->step, sizeof ref); /* (its rests keep stale note bytes: the new reference) */
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
btn_down(B_SEQ); frame();
|
||||
tl_key(3); /* B3: SHIFT > */
|
||||
se_run(SE_ROTATE, 1);
|
||||
ok = TSEL->step[1].note[0] == 60 && TSEL->step[2].time == ST_TIE && TSEL->step[4].note[0] == 64 && tl_lock_at(4) &&
|
||||
msg_is("SHIFTED RIGHT");
|
||||
tl_key(3);
|
||||
tl_key(2); tl_key(2); /* A3: SHIFT < twice */
|
||||
msg_is("ROTATE +1 1-8");
|
||||
se_run(SE_ROTATE, -1);
|
||||
ok &= !memcmp(TSEL->step, ref, sizeof ref) && tl_lock_at(3);
|
||||
TSEL->p[P_SLEN] = 6;
|
||||
tl_key(2);
|
||||
ok &= TSEL->step[5].note[0] == 60 && TSEL->step[2].note[0] == 64 && TSEL->step[6].time == ST_REST &&
|
||||
TSEL->step[20].note[0] == 72; /* (inside LEN 6: step 7 and 21 stay) */
|
||||
tl_key(3);
|
||||
TSEL->p[P_SLEN] = 8;
|
||||
ok &= !memcmp(TSEL->step, ref, sizeof ref);
|
||||
bad += check(" B3 / A3 SHIFT > <: one step round inside LEN (the lock with it); back again: as it was", ok);
|
||||
bad += check(" ROTATE +1 / -1: one step round inside LEN (the lock with it); back again: as it was", ok);
|
||||
tl_key(0); /* F3: CLEAR */
|
||||
for (ok = msg_is("T1 CLEARED") || msg_is("T2 CLEARED") || msg_is("T3 CLEARED") || msg_is("T4 CLEARED"), i = 0; i < 8u; i++)
|
||||
for (ok = msg_is("CLEAR 1-8"), i = 0; i < 8u; i++)
|
||||
ok &= TSEL->step[i].time == ST_REST && !TSEL->step[i].n;
|
||||
ok &= TSEL->step[20].note[0] == 72 && !motion_lock_count(TSEL);
|
||||
bad += check(" F3 CLEAR: steps 1..LEN empty (no dialog), past LEN kept, the locks of the steps cleared go", ok);
|
||||
@@ -8356,30 +8385,24 @@ static int test_seq_tools(void)
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
(void)motion_set_event(TSEL, 1, P_DIST, 40); (void)motion_set_event(TSEL, 9, P_REV, 20);
|
||||
(void)motion_set_event(&trk[1], 2, P_DIST, 30);
|
||||
a = leds_at(0); b2 = leds_at(250);
|
||||
ok = ((a ^ b2) >> white(7)) & 1u; /* (F4 breathes: automation there) */
|
||||
tl_key(7);
|
||||
ok &= msg_is("AUTOMATION CLEARED") && !motion_count(TSEL) && motion_count(&trk[1]) == 1u &&
|
||||
ok = msg_is("CLR AUTO 1-8") && !motion_count(TSEL) && motion_count(&trk[1]) == 1u &&
|
||||
!memcmp(TSEL->step, ref, sizeof ref) && ui.layer == LAYER_SEQ;
|
||||
tl_key(7);
|
||||
a = leds_at(0); b2 = leds_at(250);
|
||||
ok &= msg_is("NOTHING TO CLEAR") && !(((a | b2) >> white(7)) & 1u);
|
||||
ok &= msg_is("NOTHING TO CLEAR");
|
||||
motion_reset(&trk[1]);
|
||||
bad += check(" F4 CLR AUTO (breathes with automation): the track's automation and locks gone, its steps and the other tracks' stay", ok);
|
||||
tl_key(0);
|
||||
bad += check(" F4 CLR AUTO: the track's automation and locks gone, its steps and the other tracks' stay", ok);
|
||||
sel_of(song.sel) = (int16_t)(0x8000u | 3u << 8 | 1u);
|
||||
oct_back();
|
||||
ok = TSEL->step[0].time == ST_REST && !msg_is("SEQUENCE PUT BACK") && ui.layer == LAYER_SEQ && song.octave == 0;
|
||||
turn(EN_K1, -2);
|
||||
ok &= TSEL->p[P_SLEN] == 6; /* KNOB 1: LEN (the PATTERN page's four) */
|
||||
oct_back();
|
||||
ok &= TSEL->p[P_SLEN] == 6;
|
||||
ok = !(sel_of(song.sel) & 0x8000) && ui.layer == LAYER_SEQ && song.octave == 0 && !memcmp(TSEL->step, ref, sizeof ref);
|
||||
btn_up(B_SEQ); frame();
|
||||
bad += check(" OCT-: nothing put back (TONIC: no undo), no octave; KNOB 1..4 LEN DIV SWING GATE", ok);
|
||||
bad += check(" OCT-: the selection gone (ALL STEPS), no octave, nothing changed", ok);
|
||||
|
||||
/* (V10.8.49, the owner: "nudge") black C#5 / D#5: NUDGE < / >, every note's MICRO 4 64ths earlier / later together,
|
||||
* held at MICRO's range: no step moves to another place */
|
||||
ui_power_on();
|
||||
tl_melody();
|
||||
sel_of(song.sel) = 0;
|
||||
go_page(GR_ROLL); frame();
|
||||
btn_down(B_SEQ); frame();
|
||||
{
|
||||
@@ -8398,41 +8421,35 @@ static int test_seq_tools(void)
|
||||
}
|
||||
btn_up(B_SEQ); frame();
|
||||
bad += check(" V10.8.49 C#5 / D#5 NUDGE < / >: the notes' MICRO together, held at its range, no step moved", ok);
|
||||
/* (V10.8.49, the owner: "nudge, mover, estirar, comprimir y repetir") C4 STRETCH x2, D4 SQUEEZE /2, E4 REPEAT x2 (the
|
||||
* old SEQ > STRETCH's, on SEQ TOOLS); C5 (the lane's RANDOM) still nothing */
|
||||
/* STRETCH x2, SQUEEZE /2, REPEAT x2 on the whole track (melodic and DRUM) */
|
||||
ui_power_on();
|
||||
tl_melody();
|
||||
sel_of(song.sel) = 0;
|
||||
go_page(GR_ROLL); frame();
|
||||
btn_down(B_SEQ); frame();
|
||||
{
|
||||
uint32_t l0 = (uint32_t)TSEL->p[P_SLEN], j;
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
tl_key(4);
|
||||
se_run(SE_STRETCH, 2);
|
||||
ok = (uint32_t)TSEL->p[P_SLEN] == 2u * l0 && TSEL->step[2].time == ref[1].time && TSEL->step[2].n == ref[1].n;
|
||||
tl_key(5);
|
||||
se_run(SE_SQUEEZE, 2);
|
||||
ok &= (uint32_t)TSEL->p[P_SLEN] == l0;
|
||||
tl_key(6);
|
||||
se_run(SE_REPEAT, 2);
|
||||
ok &= (uint32_t)TSEL->p[P_SLEN] == 2u * l0;
|
||||
for (j = 0; j < l0; j++) ok &= !memcmp(&TSEL->step[l0 + j], &TSEL->step[j], sizeof TSEL->step[0]);
|
||||
TSEL->p[P_SLEN] = (int16_t)l0;
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
tl_key(11);
|
||||
ok &= !memcmp(TSEL->step, ref, sizeof ref);
|
||||
}
|
||||
btn_up(B_SEQ); frame();
|
||||
ui_power_on();
|
||||
tl_drum();
|
||||
sel_of(song.sel) = 0;
|
||||
go_page(GR_ROLL); frame();
|
||||
btn_down(B_SEQ); frame();
|
||||
{
|
||||
uint32_t l0 = (uint32_t)TSEL->p[P_SLEN];
|
||||
tl_key(4); ok &= (uint32_t)TSEL->p[P_SLEN] == 2u * l0;
|
||||
tl_key(5); ok &= (uint32_t)TSEL->p[P_SLEN] == l0;
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
tl_key(11);
|
||||
ok &= !memcmp(TSEL->step, ref, sizeof ref);
|
||||
se_run(SE_STRETCH, 2); ok &= (uint32_t)TSEL->p[P_SLEN] == 2u * l0;
|
||||
se_run(SE_SQUEEZE, 2); ok &= (uint32_t)TSEL->p[P_SLEN] == l0;
|
||||
}
|
||||
bad += check(" V10.8.49 C4 STRETCH x2, D4 SQUEEZE /2, E4 REPEAT x2 (melodic and DRUM); C5 nothing", ok);
|
||||
bad += check(" SEQ EDIT STRETCH x2, SQUEEZE /2, REPEAT x2 on the whole track (melodic and DRUM)", ok);
|
||||
for (i = 0; i < 16u; i++) { /* (the basic beat, by hand) */
|
||||
step_clear(&TSEL->step[i]);
|
||||
if (i % 4u == 0u) grid_hit(TSEL, i, DV_KICK, 1);
|
||||
@@ -8461,8 +8478,8 @@ static int test_seq_tools(void)
|
||||
ui.lane = DV_TOM;
|
||||
bad += check(" A4 / G4: the lane reversed (its accents with it), cleared; the others stay", ok);
|
||||
a = leds_at(0); b2 = leds_at(250);
|
||||
ok = ((a ^ b2) >> white(0)) & 1u && !(((a | b2) >> white(11)) & 1u) && !(((a | b2) >> white(7)) & 1u) &&
|
||||
((a & b2) >> black(DV_TOM)) & 1u && ((a ^ b2) >> black(0)) & 1u && ((a ^ b2) >> black(8)) & 1u; /* (V10.8.49: C#5 NUDGE breathes) */
|
||||
ok = ((a ^ b2) >> white(0)) & 1u && ((a ^ b2) >> white(12)) & 1u && ((a & b2) >> black(DV_TOM)) & 1u &&
|
||||
((a ^ b2) >> black(0)) & 1u && ((a ^ b2) >> black(8)) & 1u; /* (CLEAR and DO breathe, the lane lit, NUDGE) */
|
||||
btn_up(B_SEQ); frame();
|
||||
ui_power_on();
|
||||
tl_melody();
|
||||
@@ -8470,13 +8487,12 @@ static int test_seq_tools(void)
|
||||
btn_down(B_SEQ); frames(500); /* (the map: a peek) */
|
||||
memcpy(ref, TSEL->step, sizeof ref);
|
||||
a = leds_at(0); b2 = leds_at(250);
|
||||
ok &= ((a ^ b2) >> white(3)) & 1u && ((a ^ b2) >> white(5)) & 1u && ((a ^ b2) >> white(6)) & 1u &&
|
||||
!(((a | b2) >> black(0)) & 1u); /* (V10.8.49: SHIFT, SQUEEZE and REPEAT breathe) */
|
||||
tl_key(11); tl_key(10);
|
||||
ok &= ((a ^ b2) >> white(11)) & 1u && !(((a | b2) >> black(0)) & 1u) && !(((a | b2) >> white(8)) & 1u); /* (no lane keys) */
|
||||
tl_key(10);
|
||||
key_down(black(2)); frame(); key_up(black(2)); frame();
|
||||
ok &= !memcmp(TSEL->step, ref, sizeof ref) && ui.lane == 0u && !gates();
|
||||
btn_up(B_SEQ); frame();
|
||||
bad += check(" LEDs: the tools breathe, the lane lit (DRUM); a melodic track: no lane keys; V10.8.49: STRETCH SQUEEZE REPEAT lit", ok);
|
||||
bad += check(" LEDs: SEQ EDIT's keys breathe, the lane lit (DRUM); a melodic track: no lane keys", ok);
|
||||
|
||||
/* a song playing */
|
||||
ui_power_on();
|
||||
@@ -9973,6 +9989,26 @@ static int test_usb_level(void)
|
||||
* beat's cell moves), PLAY's green LED on each beat (its own dark), the STEP keys' entry paused, PLAY stops it (the page
|
||||
* back); at its end the sequencer plays and the page is back */
|
||||
static uint16_t px_at(uint32_t x, uint32_t y) { return host_screen[y * 240u + x]; }
|
||||
/* (V10.8.53) the count-in's beats a line of figures: ci_col the colour of box j's figure (its first ink, the page's
|
||||
* background not), ci_lit(j) box j holds the colour beat 1 was lit in at the start (ci_now) */
|
||||
static uint16_t ci_now;
|
||||
static uint16_t ci_col(uint32_t j)
|
||||
{
|
||||
uint32_t x, y;
|
||||
uint16_t bg = px_at(2, 120);
|
||||
for (y = 104; y < 150u; y++)
|
||||
for (x = 36u + j * 44u; x < 72u + j * 44u; x++)
|
||||
if (px_at(x, y) != bg) return px_at(x, y);
|
||||
return bg;
|
||||
}
|
||||
static int ci_lit(uint32_t j)
|
||||
{
|
||||
uint32_t x, y;
|
||||
for (y = 104; y < 150u; y++)
|
||||
for (x = 36u + j * 44u; x < 72u + j * 44u; x++)
|
||||
if (px_at(x, y) == ci_now) return 1;
|
||||
return 0;
|
||||
}
|
||||
static void cin_beat(void) /* the audio until the count-in's next beat (or its end) */
|
||||
{
|
||||
uint32_t left = cin_left, k;
|
||||
@@ -10716,8 +10752,11 @@ static int test_click_menu(void)
|
||||
ok &= seq_counting() && !song.playing && cin_left == 4u && live_rec_sel();
|
||||
frame();
|
||||
{
|
||||
uint16_t now0 = px_at(16, CI_Y + 40), next0 = px_at(16 + 56, CI_Y + 40);
|
||||
ok &= now0 != next0; /* the first beat's cell lit, the next not */
|
||||
/* (V10.8.53) the beats a line of figures "4 3 2 1" (x 36 + 44 j, y 110 ..): the one now THEME */
|
||||
#define CI_LIT(j) ci_lit(j)
|
||||
ci_now = ci_col(0);
|
||||
ok &= ci_now != ci_col(1);
|
||||
ok &= CI_LIT(0) && !CI_LIT(1); /* the first beat lit, the next not */
|
||||
ui_leds();
|
||||
ok &= (fm1_led[8] & 2u) != 0u; /* PLAY's green: on the beat */
|
||||
for (i = 0; i < 400u * 32u / CTL; i++) events_block(CTL); /* (~0.3 s: past the first quarter of the beat) */
|
||||
@@ -10725,7 +10764,7 @@ static int test_click_menu(void)
|
||||
ok &= !(fm1_led[8] & 2u);
|
||||
cin_beat();
|
||||
frame();
|
||||
ok &= cin_left == 3u && px_at(16 + 56, CI_Y + 40) == now0 && px_at(16, CI_Y + 40) == next0; /* the cell moved */
|
||||
ok &= cin_left == 3u && CI_LIT(1) && !CI_LIT(0); /* the beat moved */
|
||||
ui_leds();
|
||||
ok &= (fm1_led[8] & 2u) != 0u;
|
||||
}
|
||||
@@ -10734,14 +10773,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(28, CI_Y + 40) == px_at(28 + 56, CI_Y + 40);
|
||||
ok &= !seq_counting() && !song.playing && (song.rec & 1u) && !CI_LIT(0) && !CI_LIT(1);
|
||||
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(28, CI_Y + 40) == px_at(28 + 56, CI_Y + 40);
|
||||
ok &= !seq_counting() && song.playing && trk[0].seq_idx == 0u && !CI_LIT(0) && !CI_LIT(1);
|
||||
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);
|
||||
@@ -13394,16 +13433,13 @@ static int test_nav_rules(void)
|
||||
ui.ev_row = 0; frame();
|
||||
ok = motion_lock_count(TSEL) == 1u;
|
||||
btn_down(B_SEQ); frames(500);
|
||||
(void)ly_keyname(LAYER_SEQ, 0, 15u, kn);
|
||||
ok &= ui.layer == LAYER_SEQ && str_eq(kn, "DEL REC");
|
||||
ok &= ui.layer == LAYER_SEQ; /* (V10.8.52: SEQ EDIT's own map) */
|
||||
btn_up(B_SEQ); frame(); frame();
|
||||
ly_white(B_SEQ, 15u);
|
||||
ok &= motion_lock_count(TSEL) == 0u && str_eq(cur_page()->title, "AUTO LIST");
|
||||
go_title("STEP"); frame();
|
||||
cursor_set(0);
|
||||
btn_down(B_SEQ); frames(500);
|
||||
(void)ly_keyname(LAYER_SEQ, 0, 15u, kn);
|
||||
ok &= str_eq(kn, "CLR STEP");
|
||||
btn_up(B_SEQ); frame(); frame();
|
||||
ly_white(B_SEQ, 15u);
|
||||
ok &= TSEL->step[0].time == ST_REST && !TSEL->step[0].n && ui.cursor == 1u && msg_is("STEP CLEARED");
|
||||
|
||||
+1767
-1760
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -411,7 +411,7 @@ def late_tables():
|
||||
"""the generator's own constant tables (gen.c, gen_tables.c): out of .rodata like the UI's recorded ones ('n'), so a
|
||||
new one never moves the sound's merged constants after .rodata"""
|
||||
names = set()
|
||||
for f in ("gen.c", "gen_tables.c", "eng_string.c", "eng_add.c", "ui_engvis.c"): # (0.9.9-snd5: the two engines' own
|
||||
for f in ("gen.c", "gen_tables.c", "eng_string.c", "eng_add.c", "ui_engvis.c", "ui_tools.c"): # (V10.8.52: SEQ EDIT's) # (0.9.9-snd5: the two engines' own
|
||||
# tables and descriptors, the creatures' new ones: out of .rodata too, the sound's tables where they were)
|
||||
txt = (FW / "src" / f).read_text()
|
||||
names |= set(re.findall(r"^static const [^=;(]*?\b(\w+)\s*\[", txt, flags=re.M))
|
||||
|
||||
+3
-1
@@ -43,7 +43,9 @@ SIZE_FILES = ["ui.c", "favorites.c", "menu_items.c", "icons.c", "ui_graph.c", "u
|
||||
# As above, anything reached from an ISR remains at -Os.
|
||||
"song_save.c", "eng_input.c", "usb_host.c", "gen_track.c", "gen_loop.c",
|
||||
# (V10.6z6) the velocity diagnostic and the keys' velocity: their main-loop side (the scan's, -Os)
|
||||
"vel_diag.c", "vel.c", "cpu_safe.c", "bt_hw.c", "sing_ext.c", "seq_fit.c"]
|
||||
"vel_diag.c", "vel.c", "cpu_safe.c", "bt_hw.c", "sing_ext.c", "seq_fit.c",
|
||||
# (V10.8.53) the pictures' shared engine, the screen mirror, the stopped notes' preview (main loop)
|
||||
"ui_gx.c", "editor_screen.c", "seq_preview.c"]
|
||||
ISR_ROOTS = ("fm1_alnk0_irq", "fm1_timer5_irq") # hal/fm1_isr.S: the audio ISR, the key / LED scan (+ USB poll)
|
||||
DEF = re.compile(r"^(?:static|void|int|uint\w*|int\w*|const)\b[^;=(]*?\b([A-Za-z_]\w*)\s*\(", re.M)
|
||||
IR_DEF = re.compile(r"^(define [^\n]*?@\"?([\w.]+)\"?\([^\n]*\)(?: unnamed_addr| local_unnamed_addr)?)( #\d+[^\n]*\{)$",
|
||||
|
||||
Reference in new issue
Block a user