mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 04:44:33 +01:00
VEL in MUTATE's old slot: projects and user presets saved before V10.7.6 load VEL 100 %
V10.7.3 put VEL (P_TVEL) in P_MCFG's slot, which beta projects, sections and user presets of 2026-10-23 .. 11-08 hold as 127 - MUTATE cfg (GENE's evolving parts 92 -> VEL 72 %). A value cannot tell them apart, so the stores now carry a mark: - FUNC byte 65 (0 in every FUNC before; older firmware ignores it) = 'V': each track's VEL as stored. Without it every track (DIGITAL excepted: its OP4 LEVEL) loads VEL 127. Projects, sections, the retained cache, autosave and backups all go through proj_pack / proj_unpack_c. - user presets: packed[UP_FM_AT - 1] = 'V' (past P_COUNT, 0 before); up_migrate sets VEL 127 on an unmarked record and marks it, as it does the 0.4 mark. UP_PUT and SAVE write the mark. Accepted cost: projects / presets saved with V10.7.3 .. V10.7.5 reset VEL to 100 % once. Tests: upreset_test (unmarked -> 127, marked kept, DIGITAL kept, UP_PUT marked), vel_seq_test (saved with the mark; one without loads 100 % on every track; saved again keeps VEL). +104 B (380 B free). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
This commit is contained in:
4 files changed
+53
-4
No files matched your search
@@ -452,6 +452,10 @@ static uint32_t proj_name_get(char *d, const uint8_t *s) /* its length */
|
||||
#define PROJC_PFX_OFF (PROJC_DX_OFF - 48u)
|
||||
#define PROJC_GX_OFF (PROJC_PFX_OFF + 37u)
|
||||
#define PROJC_PMAP ((P_COUNT + 7u) / 8u)
|
||||
/* (V10.7.6) b[65], 0 in every FUNC before: each track's P_TVEL (VEL, core.h) as stored. Without it the slot held
|
||||
* MUTATE's P_MCFG (0.9.9-seq2c .. V10.6; GENE's evolving parts 92) or VEL as V10.7.3 .. V10.7.5 saved it: it loads
|
||||
* 127, VEL 100 % (those three betas' VEL once lost; older firmware ignores the byte) */
|
||||
#define PROJ_VEL_MARK 'V'
|
||||
static uint8_t proj_full; /* the last proj_pack failed for room (not for a value) */
|
||||
static int proj_step_empty(const step_t *s)
|
||||
{
|
||||
@@ -618,7 +622,7 @@ static int proj_pack(project_store_t *out, const project_t *q)
|
||||
if (proj_packed_size(q) > PROJC_PFX_OFF) { proj_full = 1; return 0; }
|
||||
memset(out, 0, sizeof *out); memcpy(b, &magic, 4); memcpy(b + 4, &size, 4);
|
||||
memcpy(b + 8, q->g, G_NSTORE * 2u); b[62] = q->sel; b[63] = q->parts; b[64] = q->phys; b[66] = P_COUNT;
|
||||
b[67] = NTRK;
|
||||
b[67] = NTRK; b[65] = PROJ_VEL_MARK;
|
||||
for (t = 0; t < NTRK; t++) {
|
||||
uint32_t e = q->t[t].engine, map, fm = (uint32_t)proj_fm_kept(q, t);
|
||||
b[pos++] = (uint8_t)e; b[pos++] = q->t[t].preset; b[pos++] = (uint8_t)fm;
|
||||
@@ -879,6 +883,8 @@ static int proj_unpack_c(project_t *q, const uint8_t *b)
|
||||
values[i] = (int16_t)b[pos++] - 64;
|
||||
}
|
||||
params_by_count(q->t[t].p, values, np, def);
|
||||
if (b[65] != PROJ_VEL_MARK && e != ENGI_DIGITAL) /* (V10.7.6) a FUNC of before VEL: its slot was MUTATE's */
|
||||
q->t[t].p[P_TVEL] = 127; /* config (127 - cfg), VEL 100 % (PROJ_VEL_MARK) */
|
||||
if (pos + 8u > room) return 0;
|
||||
map = pos;
|
||||
pos += 8u;
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#define UP_FM_AT (UP_PMAX * 2u - 1u) /* (JIANT 0.3) packed[]'s last byte (past P_COUNT): UP_FM_MARK = DRUM's */
|
||||
#define UP_FM_MARK 0x46u /* E5 is FM; a DRUM record without it held ACC there: FM off */
|
||||
#define UP_V04_MARK 0x47u /* (JIANT 0.4) .. and LOFI's / ANALOG's E values today's (core.h sound_v04) */
|
||||
#define UP_VEL_AT (UP_FM_AT - 1u) /* (V10.7.6) packed[]'s byte before (past P_COUNT, 0 in every record before): */
|
||||
#define UP_VEL_MARK 'V' /* P_TVEL (VEL) as stored; without it MUTATE's config or a V10.7.3..7.5 VEL: 127 */
|
||||
typedef struct {
|
||||
uint8_t used, ver, engine, np; /* UP_USED, UP_VER, engine, P_COUNT when stored */
|
||||
char name[12]; /* ASCII 32..126, 0-padded (no 0 when 12 long) */
|
||||
@@ -58,7 +60,7 @@ typedef struct {
|
||||
} up_bank_t;
|
||||
_Static_assert(sizeof(up_rec_t) == 192, "user preset record layout");
|
||||
_Static_assert(P_COUNT <= UP_PMAX * 2u && P_COUNT < 128, "user preset record: P_COUNT");
|
||||
_Static_assert(P_COUNT <= UP_FM_AT, "user preset record: the FM mark past the parameters");
|
||||
_Static_assert(P_COUNT <= UP_VEL_AT, "user preset record: the FM and VEL marks past the parameters");
|
||||
static up_bank_t up_bank[UP_SLOTS / UP_PER_BANK] __attribute__((section(".lowbuf"))); /* (0.9.0: the pool, was .bss: main
|
||||
* loop only, 6 KiB of the RAM region back; 0.9.9-beta4: LOWBUF, the
|
||||
* pool's top given to the RAM code) */
|
||||
@@ -106,6 +108,10 @@ static void up_migrate(up_rec_t *r)
|
||||
r->packed[UP_FM_AT] = UP_V04_MARK;
|
||||
}
|
||||
}
|
||||
if (r->ver >= 4u && r->np <= UP_VEL_AT && r->packed[UP_VEL_AT] != UP_VEL_MARK) { /* (V10.7.6) VEL 100 % */
|
||||
if (P_TVEL + 8u < r->np && r->engine != ENGI_DIGITAL) up_set_value(r, P_TVEL, 127); /* (DIGITAL: its OP4) */
|
||||
r->packed[UP_VEL_AT] = UP_VEL_MARK;
|
||||
}
|
||||
for (k = 0; k < 8u; k++) e[k] = up_value(r, r->np - 8u + k);
|
||||
if (r->engine == ENGI_LOFI) { /* (V10.6d) LOFI's chips: ANALOG's nearest (MATH's CHIP */
|
||||
if (analog_from_chip(r->engine, e)) { /* STEP: 4BIT) */
|
||||
@@ -223,7 +229,7 @@ static __attribute__((noinline)) int up_parse(const uint8_t *a, uint32_t na, up_
|
||||
r->ver = UP_VER;
|
||||
r->engine = a[1];
|
||||
r->np = P_COUNT;
|
||||
r->packed[UP_FM_AT] = UP_V04_MARK;
|
||||
r->packed[UP_FM_AT] = UP_V04_MARK; r->packed[UP_VEL_AT] = UP_VEL_MARK;
|
||||
for (i = 0; i < n; i++)
|
||||
r->name[i] = (char)a[2 + i];
|
||||
for (i = 0; i < P_COUNT; i++, k += 2u)
|
||||
@@ -383,7 +389,7 @@ static int up_store(uint32_t k, const char *name)
|
||||
r.ver = UP_VER;
|
||||
r.engine = TSEL->eng_req;
|
||||
r.np = P_COUNT;
|
||||
r.packed[UP_FM_AT] = UP_V04_MARK;
|
||||
r.packed[UP_FM_AT] = UP_V04_MARK; r.packed[UP_VEL_AT] = UP_VEL_MARK;
|
||||
up_set_name(&r, k, name);
|
||||
for (i = 0; i < P_COUNT; i++)
|
||||
up_set_value(&r, i, motion_base_value(TSEL, i));
|
||||
|
||||
@@ -268,6 +268,30 @@ int main(void)
|
||||
up_value(up_rec(19), P_E4) == (ch.np == P_COUNT ? clamp(up_value(&ch, P_FCUT), 0, 127) : 110) && up_rec(16)->engine == 3u && up_value(up_rec(16), P_E1) == 5);
|
||||
}
|
||||
|
||||
/* (V10.7.6) VEL (P_TVEL, once MUTATE's P_MCFG): a record without UP_VEL_MARK (every one before V10.7.6) loads
|
||||
* VEL 100 % (127) and is marked; a marked one (UP_PUT, SAVE) keeps its VEL; DIGITAL's slot is its OP4 LEVEL */
|
||||
{
|
||||
up_rec_t o = r, m = r, dg = r;
|
||||
o.engine = m.engine = 2; dg.engine = ENGI_DIGITAL;
|
||||
up_set_value(&o, P_TVEL, 92); up_set_value(&m, P_TVEL, 40); up_set_value(&dg, P_TVEL, 40);
|
||||
o.packed[UP_VEL_AT] = 0; dg.packed[UP_VEL_AT] = 0; m.packed[UP_VEL_AT] = UP_VEL_MARK;
|
||||
n = put_frame(a, 5, 2, "Bass One", -40);
|
||||
bad += check("UP_PUT: marked, its VEL as sent (40)", up_parse(a, n, &got, &slot) == 0 &&
|
||||
got.packed[UP_VEL_AT] == UP_VEL_MARK && up_value(&got, P_TVEL) == 40);
|
||||
*up_rec(16) = o;
|
||||
*up_rec(17) = m;
|
||||
*up_rec(18) = dg;
|
||||
st_save(OBJ_UPRESET0 + 1, &up_bank[1], sizeof up_bank[1]);
|
||||
memset(up_bank, 0, sizeof up_bank);
|
||||
up_bank_check(1, st_load(OBJ_UPRESET0 + 1, &up_bank[1], sizeof up_bank[1]));
|
||||
bad += check("record before VEL's mark (MUTATE cfg 92): VEL 127, marked", up_value(up_rec(16), P_TVEL) == 127 &&
|
||||
up_rec(16)->packed[UP_VEL_AT] == UP_VEL_MARK && up_value(up_rec(16), P_E0) == up_value(&o, P_E0));
|
||||
bad += check("record with the mark: its VEL (40)", up_value(up_rec(17), P_TVEL) == 40);
|
||||
bad += check("DIGITAL record without the mark: its OP4 LEVEL kept", up_value(up_rec(18), P_TVEL) == 40);
|
||||
up_migrate(up_rec(16));
|
||||
bad += check(" a second read keeps it", up_value(up_rec(16), P_TVEL) == 127);
|
||||
}
|
||||
|
||||
/* SAMPLE SET 4 (PERC, the GM kit, retired after 1.0.2) -> the DRUM engine with its default kit: from flash (an
|
||||
* older layout too), by UP_PUT; the rest of the sound and the pattern as stored; another SET stays SAMPLE */
|
||||
{
|
||||
|
||||
@@ -396,6 +396,19 @@ int main(void)
|
||||
trk[1].p[P_TVEL] = 99; trk[2].p[P_TVEL] = 0;
|
||||
project_load(1);
|
||||
ck(" a project keeps each track's VEL (40, 127)", trk[1].p[P_TVEL] == 40 && trk[2].p[P_TVEL] == 127);
|
||||
ck(" saved with the VEL mark (FUNC byte 65, V10.7.6)", proj_slot[1].raw[65] == 'V');
|
||||
{ /* (V10.7.6) a FUNC of before the mark (MUTATE's P_MCFG in the slot: 127 - cfg; or V10.7.3..7.5's VEL): 100 % */
|
||||
uint32_t h;
|
||||
proj_slot[1].raw[65] = 0;
|
||||
h = proj_hash(proj_slot[1].raw, PROJ_STORE_SIZE - 4u); memcpy(proj_slot[1].raw + PROJ_STORE_SIZE - 4u, &h, 4);
|
||||
trk[1].p[P_TVEL] = 99;
|
||||
project_load(1);
|
||||
ck(" one saved before the mark (VEL 40 there): VEL 100 % on every track", trk[1].p[P_TVEL] == 127 &&
|
||||
trk[2].p[P_TVEL] == 127 && trk[0].p[P_TVEL] == 127);
|
||||
trk[1].p[P_TVEL] = 40;
|
||||
project_save(1); trk[1].p[P_TVEL] = 99; project_load(1);
|
||||
ck(" saved again: its VEL kept from now on", trk[1].p[P_TVEL] == 40);
|
||||
}
|
||||
{
|
||||
int16_t in[69], out[P_COUNT], def[P_COUNT];
|
||||
for (i = 0; i < P_COUNT; i++) def[i] = TP[i].def;
|
||||
|
||||
Reference in new issue
Block a user