V10.8.52: SAVE asks before overwriting a part, its UNDO; a saved GEN draft is that project; RESTORE LAST follows it

- SAVE + C4..F4 / SAVE + OCT+ over a part with music: OVERWRITE A? (OCT+ yes,
  OCT- no; "UNDO: GLO + G4" under it), once a part until another project
  opens. The part's previous content kept in the UNDO buffer (undo_st[0],
  undo_ok 2): GLO + G4 puts it back, again redoes the save. GEN's own
  section stores keep their UNDO mark.
- PROJECTS > SAVE of a GEN draft ("SAVED SONG n") ends the draft: project n is
  the open one (index cur written), so SAVE + C4, the flush and the autosave
  go there. Was: still a draft, nothing written, and RESTORE LAST gave back the
  autosave from before GEN (the autosave is off during a draft and was only
  rewritten when n was the project open before GEN).
- ARRANGE OCT+ on a row: "ROW DUPLICATED" (it copies the row picked).
- song_save_as's index row building in the Bluetooth segment (room).
- Tests: song_draft_test (draft ends on save, SAVE + C4 and its UNDO/REDO,
  RESTORE LAST after a draft saved elsewhere, OVERWRITE A? once, an empty part
  saved at once); ui_test (SAVE + OCT+ through the dialog).
- docs/SEQ-EDIT-V10.8.52.patch: the SEQ EDIT page, built and measured but
  parked: 3308 B over the app slot.
- Layout re-recorded (REPIN=keep: row_var moved 2 B); no sound code changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
This commit is contained in:
Claude committed 2026-11-26 14:18:55 +00:00
1 parent 8e9c4d7e65
commit a1d7651c45
13 files changed
+2995 -2162

No files matched your search

+739
View File
@@ -0,0 +1,739 @@
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))
+1 -1
View File
@@ -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.51" /* (2026-11-26) 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 next piece when one ends) and MOOD (CALM .. DANCE), its picture. V10.8.38 (the owner): SEQ > BAR, PHRASES and GLO > SYSTEM 2 gone (their rows kept: the index); GLO > MIXER, OCT+: KNOB 4 BPM <-> DJ FILTER; SEQ > NOTE back in the chain (after STEP), TRANS on SCL > CHORD's KNOB 4; GAIN on every engine (EDIT's first page, OCT+ held + KNOB 4); KEY TRK NOTE: the LP / HP resonance's peakLine truncated
#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
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
+11
View File
@@ -1803,6 +1803,17 @@ static int undo_do(void) /* 0: done */
{
char name[PROJ_NAME_LEN + 1u];
uint8_t cur = proj_cur, play = song.playing;
if (undo_ok == 2u) { /* a SAVE: the part back (again: the save again) */
uint32_t s = undo_sv & 3u;
if (undo_sv >> 2 != (song_draft << 5 | song_cur))
return 1;
undo_st[1] = proj_slot[s];
proj_slot[s] = undo_st[0];
undo_st[0] = undo_st[1];
live.dirty |= (uint8_t)(1u << s);
proj_wire_gen++;
return 0;
}
if (!undo_ok)
return 1;
gst_old = 0; /* (ENTRY BUILD called off) */
+23
View File
@@ -471,6 +471,28 @@ static int jam_switch(uint32_t k, uint32_t s)
}
/* the music now into section s: RAM at once (playing too), flash once stopped (song_poll) */
/* (V10.8.52) SAVE + C4..F4 / OCT+: a part with music asks first (OVERWRITE A?), once per part until another project
* opens (sv_ok) */
static void section_keep(uint32_t s);
static void section_ask(uint32_t s)
{
s &= 3u;
if (project_used(s) && !((sv_ok >> s) & 1u)) { /* (as ui_input.c confirm_open: the OCT- / OCT+ dialog) */
ui.confirm = CF_STORE_SECT; ui.confirm_trk = (uint8_t)s; ui.act = 0; ui.force = 1;
} else section_keep(s);
}
/* the SAVE keys' store: what the part had first, for GLO + G4 UNDO (again: the save again; GEN's own stores keep
* their UNDO mark) */
static void section_keep(uint32_t s)
{
s &= 3u;
if (project_used(s)) {
undo_st[0] = proj_slot[s];
undo_ok = 2;
undo_sv = (uint8_t)(song_draft << 7 | song_cur << 2 | s);
}
section_store(s);
}
static void section_store(uint32_t s)
{
char b[8] = "A";
@@ -853,6 +875,7 @@ static int song_switch(uint32_t n, int load_a)
}
/* The original index is restored before opening another saved project. */
song_cur = (uint8_t)n;
sv_ok = 0; /* (V10.8.52: its parts ask again) */
chain_config = song_idx.rows[n];
jam_load(); /* (V10.8) its JAM take */
if (song_index_save()) { /* (failed: written again by song_poll) */
+32 -16
View File
@@ -49,6 +49,26 @@ static void song_index_target(const song_index_t *index, uint32_t target)
memcpy(song_idx.tvar[target], index->tvar[target], sizeof index->tvar[target]);
}
/* (V10.8.52: out of the image, its room) the saved index with the destination's row (song_save_as writes it) */
#if FELUCCA_FLASH
BTAPP_FN static void song_save_tail(song_index_t *index, uint32_t target)
{
if (song_save_loop) {
chain_defaults(&index->rows[target]);
memset(index->scene[target], 0, sizeof index->scene[target]);
memset(index->tsrc[target], 0, sizeof index->tsrc[target]);
memset(index->tvar[target], 0, sizeof index->tvar[target]);
} else {
index->rows[target] = chain_config;
memcpy(index->scene[target], song_idx.scene[song_cur], sizeof index->scene[target]);
memcpy(index->tsrc[target], song_idx.tsrc[song_cur], sizeof index->tsrc[target]);
memcpy(index->tvar[target], song_idx.tvar[song_cur], sizeof index->tvar[target]);
}
index->rows[target].rsv[1] = 0;
index->rows[target].rsv[2] = SONG_MODE_TAG | (!song_save_loop && live.mode ? 1u : 0u);
}
#endif
static __attribute__((noinline)) int song_save_as(uint32_t target, const char *name)
{
#if FELUCCA_FLASH
@@ -91,29 +111,25 @@ static __attribute__((noinline)) int song_save_as(uint32_t target, const char *n
}
}
if (song_saved_index(index)) { ui_message("SAVE INDEX ERROR"); return 2; }
if (song_save_loop) {
chain_defaults(&index->rows[target]);
memset(index->scene[target], 0, sizeof index->scene[target]);
memset(index->tsrc[target], 0, sizeof index->tsrc[target]);
memset(index->tvar[target], 0, sizeof index->tvar[target]);
} else {
index->rows[target] = chain_config;
memcpy(index->scene[target], song_idx.scene[song_cur], sizeof index->scene[target]);
memcpy(index->tsrc[target], song_idx.tsrc[song_cur], sizeof index->tsrc[target]);
memcpy(index->tvar[target], song_idx.tvar[song_cur], sizeof index->tvar[target]);
}
index->rows[target].rsv[1] = 0;
index->rows[target].rsv[2] = SONG_MODE_TAG | (!song_save_loop && live.mode ? 1u : 0u);
song_save_tail(index, target);
if (song_draft) index->cur = (uint8_t)target; /* (V10.8.52) a saved draft is that project, open, from now on */
if (st_save(OBJ_SONGIDX, index, sizeof *index)) { ui_message("SAVE ERROR: RETRY"); return 2; }
/* RESTORE LAST must not mask an explicit overwrite of the open project
* with a stale pre-generation session at the next boot. song_keep is the
* valid, already-packed live music; writing it does not clobber index. */
if (target == song_cur && st_save(OBJ_AUTOSAVE, &song_keep, sizeof song_keep)) {
if ((target == song_cur || song_draft) && st_save(OBJ_AUTOSAVE, &song_keep, sizeof song_keep)) {
ui_message("SAVE ERROR: RETRY"); return 2;
}
/* Keep the live draft metadata while updating the destination's library entry. */
if (!song_draft || target != song_cur) song_index_target(index, target);
if (!song_draft && target == song_cur) {
if (song_draft) { /* (V10.8.52) the draft ends: later edits, SAVE + C4 and the autosave
* go to project n (was: still a draft, nothing written, RESTORE LAST
* then gave the music before GEN back) */
memcpy(&song_idx, index, sizeof song_idx);
song_cur = (uint8_t)target;
song_draft = 0;
if (proj_cur > 3u) proj_cur = (uint8_t)current;
} else song_index_target(index, target);
if (target == song_cur) {
for (section = 0; section < 4u; section++) {
int rc = song_copy_section(section, current, name);
if (rc > 0) memcpy(&proj_slot[section], &proj_wire, sizeof proj_wire);
+6 -2
View File
@@ -39,7 +39,11 @@ static void trackgen_make(void);
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) */
static uint8_t undo_ok;
static uint8_t undo_ok; /* (V10.8.52) 2: undo_st[0] is part undo_sv & 3's stored music before
* SAVE + C4 (bit 7 a draft, 2..6 the project) */
static void section_store(uint32_t s);
static void section_keep(uint32_t s); /* (song_main.c) */
static uint8_t undo_sv __attribute__((section(".pool"))), sv_ok __attribute__((section(".pool"))); /* sv_ok: the parts said YES to (OVERWRITE A?) in this project */
static int project_used(uint32_t slot);
static int project_erase(uint32_t slot); /* (V10.17) SAVE > PART SLOTS > ERASE */
static uint32_t lib_scan(uint32_t n, char *b); /* (0.8.5) project.c: SAVE > LIBRARY's tiles */
@@ -403,7 +407,7 @@ static uint16_t val_col(uint32_t c) { return c == ui.hot_col && ui.hot_t ? T_ACC
enum { CF_NONE, CF_CLEAR_SEQ, CF_CLEAR_TRK, CF_OVR_PROJ, CF_OVR_USER, CF_LOAD_PAT,
CF_DEL_ROW, CF_CLEAR_SONG, CF_INIT_SOUND, CF_CLEAR_MOTION, CF_ERASE_USER, CF_CLEAR_PFX,
CF_RECALL_SOUND, CF_CLEAR_ALL, CF_DICE_ALL, CF_INIT_SYS, CF_DICE_SOUND, CF_DICE_SEQ, CF_DICE_LFO,
CF_DICE_FX, CF_CPU_TEST, CF_MUT_BACK, CF_LIVE_COMMIT, CF_ERASE_SECT, CF_OVR_SONG, CF_ERASE_SONG, CF_CLEAR_COMP }; /* ui.confirm: TOOLS' clears; (0.6.21) HOME + SELECT:
CF_DICE_FX, CF_CPU_TEST, CF_MUT_BACK, CF_LIVE_COMMIT, CF_ERASE_SECT, CF_OVR_SONG, CF_ERASE_SONG, CF_CLEAR_COMP, CF_STORE_SECT }; /* ui.confirm: TOOLS' clears; (0.6.21) HOME + SELECT:
* everything diced; (0.6.65) EDIT + SELECT: keep the diced sound?; (0.6.67) SEQ / LFO / FX + SELECT:
* keep the diced sequence / LFO / effects?;
* SAVE over a used slot; a pattern over the user's steps;
+5
View File
@@ -2011,6 +2011,11 @@ static void confirm_text(char *a, char *b)
str_cpy(a, "ERASE PROJECT ", 24); fmt_int(a + str_len(a), (int32_t)k + 1); str_cpy(a + str_len(a), "?", 2);
str_cpy(b, "ALL A-D + ARRANGEMENT", 24);
break;
case CF_STORE_SECT: /* (V10.8.52) SAVE + C4..F4 / OCT+ over music */
str_cpy(a, "OVERWRITE A?", 24);
a[10] = (char)('A' + (k & 3u));
str_cpy(b, "UNDO: GLO + G4", 24);
break;
case CF_ERASE_SECT: /* (V10.17) SAVE > PART SLOTS > ERASE */
str_cpy(a, "ERASE PART A?", 24);
a[11] = (char)('A' + (k & 3u));
+5 -2
View File
@@ -1796,7 +1796,7 @@ static __attribute__((noinline)) void act_do(void)
ui.song_row = (uint8_t)(c + 1u);
chain_config.count++;
song_idx_touch();
ui_message("ROW ADDED");
ui_message(n ? "ROW DUPLICATED" : "ROW ADDED"); /* (V10.8.52: a copy of the one picked) */
return;
}
if (0 /* PHRASES gone */) {
@@ -2790,7 +2790,7 @@ static void ui_input_frame(void)
uint32_t kind = ui.confirm;
ui.confirm = 0;
ui.force = 1;
if (kind != CF_OVR_PROJ && kind != CF_OVR_USER && kind != CF_ERASE_USER && kind != CF_ERASE_SECT && kind != CF_OVR_SONG && kind != CF_ERASE_SONG && kind != CF_DICE_ALL &&
if (kind != CF_OVR_PROJ && kind != CF_OVR_USER && kind != CF_ERASE_USER && kind != CF_ERASE_SECT && kind != CF_STORE_SECT && kind != CF_OVR_SONG && kind != CF_ERASE_SONG && kind != CF_DICE_ALL &&
!dice_kind(kind) && kind != CF_DEL_ROW && kind != CF_CLEAR_SONG && !chain_busy())
undo_mark(); /* (0.6.21) the music before a clear, INIT, RECALL, pattern */
if (kind == CF_OVR_PROJ) { /* overwrite: the NAME screen writes it */
@@ -2803,6 +2803,9 @@ static void ui_input_frame(void)
up_ui(1u, ui.confirm_trk);
} else if (kind == CF_ERASE_SONG) {
song_erase_parts(ui.confirm_trk, 0);
} else if (kind == CF_STORE_SECT) { /* (V10.8.52) SAVE + C4: YES, and no more asking for it */
sv_ok |= (uint8_t)(1u << (ui.confirm_trk & 3u));
section_keep(ui.confirm_trk);
} else if (kind == CF_ERASE_SECT) {
if ((ui.confirm_trk >> 2u) == song_cur) project_erase(ui.confirm_trk & 3u);
else ui_message("PROJECT CHANGED");
+3 -2
View File
@@ -41,6 +41,7 @@
/* the song layer's actions (project.c: song_main.c) */
static int section_jump(uint32_t s);
static void section_store(uint32_t s);
static void section_ask(uint32_t s);
static void section_recall(void);
static void quick_chain(const uint8_t *s, uint32_t n);
static void song_rec_toggle(void);
@@ -615,7 +616,7 @@ static void song_key(uint32_t p)
ui_message(b);
}
} else if (p < SK_STORE + 4u) {
section_store(p - SK_STORE);
section_ask(p - SK_STORE);
} else if (p == SK_MODE) {
live.mode ^= 1u;
ui_message(live.mode ? "PLAY: THE SONG" : "PLAY: THE PART");
@@ -877,7 +878,7 @@ static uint32_t layer_oct(uint32_t pressed, uint32_t oct)
if (live.cur < 0)
ui_message("PLAY A PART FIRST");
else
section_store((uint32_t)live.cur);
section_ask((uint32_t)live.cur);
}
if (lys.l == LAYER_SAVE && (mine & 1u)) /* SAVE + OCT-: RECALL it as it was stored */
section_recall();
+36 -6
View File
@@ -45,15 +45,25 @@ int main(void)
assert(st_load(OBJ_SONGIDX,&proj_wire,sizeof saved_index)==sizeof saved_index);
assert(!memcmp(&((song_index_t*)&proj_wire)->rows[0],&saved_index.rows[0],sizeof(chain_config_t)));
assert(!memcmp(old_flash,nor+0x97000,sizeof old_flash));
assert(song_draft&&chain_config.count==4);
puts("draft: saving a full song elsewhere preserves the original project and current draft");
/* (V10.8.52) a saved draft is that project, open: later SAVE + C4 and the autosave go there */
assert(!song_draft&&song_cur==1&&chain_config.count==4&&song_idx.cur==1);
assert(st_load(OBJ_SONGIDX,&proj_wire,sizeof saved_index)==sizeof saved_index&&((song_index_t*)&proj_wire)->cur==1);
for(unsigned n=0;n<4;n++)assert(project_used(n));
trk[0].step[0].note[0]=80;section_keep(1);song_poll();assert(saved_note(1,1)==80);
assert(proj_import(&proj_scratch,&undo_st[0],sizeof undo_st[0])&&proj_scratch.t[0].step[0].note[0]==73);
assert(!undo_do());song_poll();assert(saved_note(1,1)==73);
assert(!undo_do());song_poll();assert(saved_note(1,1)==80);
puts("draft: saving a full song elsewhere preserves the original project and opens the saved one; SAVE + C4 there, its UNDO");
assert(!song_draft_begin());draft_music(72);
song_save_loop=1;assert(!section_load(2));assert(!song_save_as(2,"JUST LOOP"));
assert(saved_note(2,0)==74);for(unsigned n=1;n<4;n++)assert(saved_note(2,n)==-1);
assert(song_idx.rows[2].count==0&&chain_config.count==4&&song_draft);
assert(song_idx.rows[2].count==0&&!song_draft&&song_cur==2&&!chain_config.count);
puts("draft: LOOP writes current music to A, empties B-D and saves no arrangement");
assert(!song_draft_begin());draft_music(72);section_load(2);
song_save_loop=0;assert(!song_save_as(0,"OVERWRITE"));
for(unsigned n=0;n<4;n++)assert(saved_note(0,n)==(n==2?74:72+(int)n));
assert(song_draft&&chain_config.count==4);
assert(!song_draft&&song_cur==0&&chain_config.count==4);
assert(!song_draft_begin());draft_music(72);
memcpy(draft_before,proj_slot,sizeof draft_before);
erase_error=1;assert(song_save_as(3,"FAIL")&&song_draft&&!memcmp(draft_before,proj_slot,sizeof draft_before));erase_error=0;
assert(!song_save_as(3,"RETRY"));
@@ -61,11 +71,13 @@ int main(void)
for(unsigned n=0;n<4;n++)assert(saved_note(3,n)>=0);assert(song_idx.rows[3].count==4);
song_save_loop=1;assert(!song_save_as(3,"LOOP OVER"));
assert(saved_note(3,0)==trk[0].step[0].note[0]);for(unsigned n=1;n<4;n++)assert(saved_note(3,n)==-1);
assert(song_idx.rows[3].count==0&&song_draft&&chain_config.count==4);
assert(song_idx.rows[3].count==0&&!song_draft&&!chain_config.count);
assert(!song_draft_begin());draft_music(72);
song_save_loop=0;assert(!song_save_as(3,"RETRY"));assert(song_idx.rows[3].count==4);
puts("draft: a LOOP saved over a whole song clears its B-D and its arrangement; the draft stays");
puts("draft: a LOOP saved over a whole song clears its B-D and its arrangement; the draft ends there");
}
puts("draft: same-project overwrite is explicit; failed saves retain the draft for retry");
assert(!song_select(0)&&song_cur==0);assert(!song_draft_begin());draft_music(72);memcpy(draft_before,proj_slot,sizeof draft_before);
assert(!song_erase_parts(1,0));for(unsigned n=0;n<4;n++)assert(saved_note(1,n)==-1);
assert(song_draft&&!memcmp(draft_before,proj_slot,sizeof draft_before));
/* (V10.7.22) the open project erased whole: its music goes too, the draft's as well (was: the draft kept) */
@@ -107,5 +119,23 @@ int main(void)
assert(!project_erase(1));assert(!project_used(1));
for(unsigned r=0;r<chain_config.count;r++)for(unsigned t=0;t<NTRK;t++)assert(row_src(r,t,chain_config.row[r].slot)!=1);
puts("erase: failed writes keep RAM; deleting a source part removes dependent rows");
{/* (V10.8.52) RESTORE LAST after a GEN draft saved as another project: that music, and the autosave runs again */
song_fixture();assert(!song_draft_begin());draft_music(67);assert(!song_save_as(2,"ELSEWHERE"));
assert(!song_draft&&song_cur==2);
trk[0].step[0].note[0]=69;ui_prefs|=PREF_RESTORE_ON;
for(unsigned k=0;k<6;k++){fm1_ms+=70000;autosave_poll();}
assert(as.writes);trk[0].step[0].note[0]=12;
song_index_load();song_index_boot();
assert(song_cur==2&&autosave_boot(1)&&trk[0].step[0].note[0]==69);
puts("restore: after a draft saved elsewhere, RESTORE LAST gives the newest music (was: the one before GEN)");
/* SAVE + C4 over a part with music asks first (OVERWRITE A?), the part kept until YES */
memcpy(draft_before,proj_slot,sizeof draft_before);
assert(project_used(0));ui.confirm=0;trk[0].step[0].note[0]=91;section_ask(0);
assert(ui.confirm==CF_STORE_SECT&&!memcmp(draft_before,proj_slot,sizeof draft_before));
ui.confirm=0;sv_ok|=1u;section_ask(0);assert(ui.confirm==0&&memcmp(draft_before,proj_slot,sizeof proj_slot[0]));
assert(!undo_do()&&!memcmp(draft_before,proj_slot,sizeof draft_before));
assert(!song_erase_parts(song_cur,8u)&&!project_used(3));section_ask(3);assert(ui.confirm==0&&project_used(3));
puts("save: SAVE + C4 over music asks OVERWRITE A? once; GLO + G4 gives the part back");
}
return 0;
}
+3 -1
View File
@@ -8663,7 +8663,9 @@ static int test_song_layer(void)
bad += check(" playing: G3 asks for B, it goes in on the next bar, every track from step 0", ok);
trk[0].step[0].note[0] = 99; /* an edit of what plays */
btn_down(B_SAVE); frame(); press(B_OCTUP); btn_up(B_SAVE); frame();
ok = (live.dirty & 2u) && live.cur == 1 && msg_is("SAVED B");
ok = ui.confirm == CF_STORE_SECT && !(live.dirty & 2u); /* (V10.8.52) B has music: OVERWRITE B? first */
press(B_OCTUP); frame();
ok &= !ui.confirm && (live.dirty & 2u) && live.cur == 1 && msg_is("SAVED B");
project_load(1); /* (stopped by it: the slot holds the stored edit) */
ok &= trk[0].step[0].note[0] == 99 && !song.playing;
song_poll();
+2130 -2131
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -401,7 +401,7 @@ def late_fns():
"proj_steps", "splash_sig", "up_name_ok", "song_idx_touch", "song_end_row",
"scr_rows", "vx_swarm", "gen_make", "bt_hw_status",
"gen_radio", "gen_tick", "gen_draw_sig", "bt_get", "hold_banner",
"tl_do", "tl_stretch", "tl_repeat", "tl_motion_map", "seq_overlay", "tl_nudge", "nudge_key", "home_life", "up_value", "sel_poll", "tl_shape"} # (V10.8.49) SEQ TOOLS STRETCH SQUEEZE REPEAT # (V10.8.39) GEN's radio: UI, past the tables # (V10.8.26) the screen mirror's row check: past the tables
"tl_do", "tl_stretch", "tl_repeat", "tl_motion_map", "seq_overlay", "tl_nudge", "nudge_key", "home_life", "up_value", "sel_poll", "tl_shape", "song_save_as", "undo_ui", "section_store"} # (V10.8.52) the save confirm and its undo # (V10.8.49) SEQ TOOLS STRETCH SQUEEZE REPEAT # (V10.8.39) GEN's radio: UI, past the tables # (V10.8.26) the screen mirror's row check: past the tables
for f in LATE_SRC:
names |= set(re.findall(r"^static [^;=()]*?\b(\w+)\((?![^)]*\)\s*;)", (FW / "src" / f).read_text(), flags=re.M))
return names