mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 21:04:32 +01:00
- voice.c voice_cap: VOICES_2CORE 12 while the second core takes parts (fx.c mc_two: CORES 2, not REC at
power-on, not given up); one core 8, LOAD ECO 6; a track still NVOICE 8 (no RAM). After Skiff by illuminus5.
cpu_vg: mix/v12 (both cores 3924 instr/sample), mix/v12.c0 (core 0 1949), mix/v12.one (one core, 8 voices 3241);
regress.c chk_budget_2core; the dual-core equivalence test at one budget (mc_host_v12).
- Sound types (PT_BASS..PT_FX) on all factory presets in preset_t.mono bits 1..4 (no format change); PRESETS LIST
ALL / FAV / BASS LEAD PAD KEYS PLUCK BELL VOX DRUM FX across engines, saved in favorites.factory[15][18];
gen.c keeps PT_BASS sounds off the other roles (was a name match). After Skiff by illuminus5.
- MIDI LEARN ported from Felucca 1.5 (midi_learn.c): 10 CCs, 3 bytes each in DIGITAL's favourites row, reserved
CCs and the standard map refused, any channel, USB and TRS; MENU > MIDI tab (MIDI OUT, LEARN, LEARN CLEAR);
state in the pool.
- fm6_vbank.c: 0xE7000 holding foreign data (Skiff's pattern bank) reads as no bank and is never erased at
power-on; only a bank the user sends replaces it. fm6bank_test foreign_test.
- Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) in JIANT's files ("Portions" in mostly-Felucca ones),
README / LICENSING.md / MENU > ABOUT credits (Felucca, Skiff).
- Docs: MANUAL.md / MANUAL.es.md, README v0.9.12 draft, EDITOR_PROTOCOL.md (tabs), cheat sheets, nav map.
Flash 576192 -> 577712 B (+1520), .data+.bss unchanged, pool +8 B (spare 10528 B).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
247 lines
9.2 KiB
C
247 lines
9.2 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments */
|
|
/* The firmware's parameter and engine tables as JSON, from the same sources (through hostsim.c):
|
|
* TP, GP, every engine's page titles, EDIT descriptors and presets, their display order, the factory patterns, the
|
|
* power-on sounds and the protocol constants. web/test_web.mjs compares the editor's mock device
|
|
* (web/editor.html makeMockDevice) with it, so the mock cannot drift from the firmware.
|
|
* build/host/descdump > build/host/desc.json (run_tests.sh) */
|
|
#define main hostsim_main
|
|
#include "hostsim.c"
|
|
#undef main
|
|
|
|
static void js_str(const char *s)
|
|
{
|
|
putchar('"');
|
|
for (; s && *s; s++) {
|
|
if (*s == '"' || *s == '\\')
|
|
putchar('\\');
|
|
putchar(*s);
|
|
}
|
|
putchar('"');
|
|
}
|
|
|
|
static void js_ints(const int32_t *v, uint32_t n)
|
|
{
|
|
uint32_t i;
|
|
putchar('[');
|
|
for (i = 0; i < n; i++)
|
|
printf("%s%d", i ? "," : "", v[i]);
|
|
putchar(']');
|
|
}
|
|
|
|
/* as the protocol's DESC reply has it: the value names only for F_ENUM */
|
|
static void js_desc(const param_desc_t *d)
|
|
{
|
|
int32_t i;
|
|
printf("{\"label\":");
|
|
js_str(d->label);
|
|
printf(",\"fmt\":%d,\"min\":%d,\"max\":%d,\"def\":%d,\"names\":", d->fmt, d->min, d->max, d->def);
|
|
if (d->fmt == F_ENUM && d->names) {
|
|
putchar('[');
|
|
for (i = 0; i <= d->max - d->min; i++) {
|
|
if (i)
|
|
putchar(',');
|
|
js_str(d->names[i]);
|
|
}
|
|
putchar(']');
|
|
} else {
|
|
printf("null");
|
|
}
|
|
printf(",\"unit\":");
|
|
js_str(d->unit ? d->unit : "");
|
|
putchar('}');
|
|
}
|
|
|
|
static void js_descs(const param_desc_t *d, uint32_t n)
|
|
{
|
|
uint32_t i;
|
|
putchar('[');
|
|
for (i = 0; i < n; i++) {
|
|
if (i)
|
|
printf(",\n ");
|
|
js_desc(&d[i]);
|
|
}
|
|
putchar(']');
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
uint32_t e, i, k;
|
|
int32_t v[16];
|
|
printf("{\"P_COUNT\":%d,\"G_COUNT\":%d,\"NSTEP\":%d,\"P_E0\":%d,\"G_ENGSEL\":%d,\"P_SLCR\":%d,\"NTRK\":%d,\n",
|
|
P_COUNT, G_COUNT, NSTEP, P_E0, G_ENGSEL, P_SLCR, NTRK);
|
|
printf("\"TP\":");
|
|
js_descs(TP, P_E0); /* P_E0.. are the engine's */
|
|
printf(",\n\"GP\":");
|
|
js_descs(GP, G_COUNT);
|
|
printf(",\n\"ENG\":[");
|
|
for (e = 0; e < NENGINES; e++) {
|
|
const engine_t *en = ENGINES[e];
|
|
printf("%s\n {\"name\":", e ? "," : "");
|
|
js_str(en->name);
|
|
printf(",\"titles\":[");
|
|
js_str(en->page_title[0]);
|
|
putchar(',');
|
|
js_str(en->page_title[1]);
|
|
printf("],\"edit\":");
|
|
js_descs(en->edit, 8);
|
|
printf(",\"presets\":[");
|
|
for (k = 0; k < en->npresets; k++) {
|
|
const preset_t *p = &en->presets[k];
|
|
printf("%s\n {\"name\":", k ? "," : "");
|
|
js_str(p->name);
|
|
for (i = 0; i < 8u; i++)
|
|
v[i] = p->e[i];
|
|
printf(",\"e\":");
|
|
js_ints(v, 8);
|
|
for (i = 0; i < 4u; i++)
|
|
v[i] = p->env[i];
|
|
printf(",\"env\":");
|
|
js_ints(v, 4);
|
|
printf(",\"xp\":%u", (unsigned)p->xp); /* (0.8.5) VOICE: LANG | LYRIC << 2 */
|
|
printf(",\"mono\":%d,\"tag\":%u,\"pat\":%d}", (int)PR_MONO(p), (unsigned)PR_TAG(p), p->pat); /* (0.9.12: the type, PT_*) */
|
|
}
|
|
printf("]}");
|
|
}
|
|
printf("],\n\"ORDER\":["); /* the engines as shown (engines.c ENGINE_ORDER), by name */
|
|
for (k = 0; k < NENG_SHOWN; k++) {
|
|
if (k)
|
|
putchar(',');
|
|
js_str(ENGINES[eng_vis(k)]->name);
|
|
}
|
|
printf("],\n\"PATTERNS\":[");
|
|
for (k = 0; k < NPATTERNS; k++) {
|
|
printf("%s\n [", k ? "," : "");
|
|
for (i = 0; i < 16u; i++)
|
|
v[i] = PATTERNS[k].note[i];
|
|
js_ints(v, 16);
|
|
putchar(',');
|
|
for (i = 0; i < 16u; i++)
|
|
v[i] = PATTERNS[k].flags[i];
|
|
js_ints(v, 16);
|
|
putchar(']');
|
|
}
|
|
printf("],\n\"TRK_DEF\":[");
|
|
for (k = 0; k < NPART; k++)
|
|
printf("%s[%d,%d,%d]", k ? "," : "", TRK_DEF[k][0], TRK_DEF[k][1], TRK_DEF[k][2]);
|
|
printf("],\n\"FM6\":{\"bank\":0,\"own\":%u,\"init\":", (unsigned)FM6_OWN); /* FM6: the packed patches (no bank since 1.0.3) */
|
|
for (i = 0; i < FM6_PACKED; i++)
|
|
printf("%s%d", i ? "," : "[", FM6_INIT[i]);
|
|
printf("],\"factory\":[");
|
|
for (k = 0; k < FM6_NFACTORY; k++)
|
|
for (i = 0; i < FM6_PACKED; i++)
|
|
printf("%s%d%s", i ? "," : k ? ",[" : "[", FM6_FACTORY[k][i], i == FM6_PACKED - 1u ? "]" : "");
|
|
printf("]}");
|
|
printf(",\n\"LANE_NOTE\":["); /* the DRUM grid: each lane's GM note, the lane of GM 35..81 */
|
|
for (k = 0; k < NLANE; k++)
|
|
printf("%s%d", k ? "," : "", DRUM_LANE_NOTE[k]);
|
|
printf("],\n\"FM4\":{\"presets\":["); /* DIGITAL (retired): its presets and conversions (fm4_convert.c) */
|
|
for (k = 0; k < FM4_NPRESETS; k++) {
|
|
const preset_t *p = &DIGITAL_PRESETS[k];
|
|
printf("%s\n {\"name\":", k ? "," : "");
|
|
js_str(p->name);
|
|
for (i = 0; i < 8u; i++)
|
|
v[i] = p->e[i];
|
|
printf(",\"e\":");
|
|
js_ints(v, 8);
|
|
for (i = 0; i < 4u; i++)
|
|
v[i] = p->env[i];
|
|
printf(",\"env\":");
|
|
js_ints(v, 4);
|
|
for (i = 0; i < 4u; i++)
|
|
v[i] = p->fx[i];
|
|
printf(",\"fenv\":%d,\"mono\":%d,\"fx\":", p->fenv, (int)PR_MONO(p));
|
|
js_ints(v, 4);
|
|
printf(",\"pat\":%d}", p->pat);
|
|
}
|
|
printf("],\"to_fm6\":");
|
|
for (k = 0; k < FM4_NPRESETS; k++)
|
|
v[k] = FM4_TO_FM6[k];
|
|
js_ints(v, FM4_NPRESETS);
|
|
printf(",\"cases\":[");
|
|
{ /* the presets, every algorithm with and without feedback, then pseudo-random values (OP ENV ones too) */
|
|
uint32_t c, seed = 12345u;
|
|
for (c = 0; c < 48u; c++) {
|
|
int16_t p[P_COUNT];
|
|
int32_t w[FP_SIZE + P_COUNT];
|
|
uint8_t fv[FP_SIZE + 1u];
|
|
uint32_t pr;
|
|
for (i = 0; i < P_COUNT; i++)
|
|
p[i] = param_desc_of(ENGI_DIGITAL, i)->def;
|
|
if (c < FM4_NPRESETS) {
|
|
fm4_preset_values(p, c);
|
|
} else if (c < 24u) {
|
|
p[P_E0] = (int16_t)((c - 8u) & 7u);
|
|
p[P_E1] = 1; p[P_E2] = 3; p[P_E3] = (int16_t)(c & 1 ? 5 : 1);
|
|
p[P_E4] = 64; p[P_E5] = 70; p[P_E6] = (int16_t)(c < 16u ? 12 : 30);
|
|
} else {
|
|
for (i = 0; i < P_COUNT; i++) {
|
|
const param_desc_t *d = param_desc_of(ENGI_DIGITAL, i);
|
|
if (i == P_ATK || i == P_DEC || i == P_SUS || i == P_REL || i == P_ED_FLT ||
|
|
(i >= P_FM1_ATK && i <= P_FM4_LEVEL && (c & 1u)) || (i >= P_E0 && i < P_E7)) {
|
|
seed = seed * 1103515245u + 12345u;
|
|
p[i] = (int16_t)(d->min + (int32_t)((seed >> 8) % (uint32_t)(d->max - d->min + 1)));
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i < P_COUNT; i++)
|
|
w[i] = p[i];
|
|
printf("%s\n {\"p\":", c ? "," : "");
|
|
js_ints(w, P_COUNT);
|
|
pr = fm4_convert(p, fv);
|
|
for (i = 0; i < P_COUNT; i++)
|
|
w[i] = p[i];
|
|
printf(",\"preset\":%u,\"out\":", pr);
|
|
js_ints(w, P_COUNT);
|
|
for (i = 0; i < FP_SIZE; i++)
|
|
w[i] = fv[i];
|
|
printf(",\"voice\":");
|
|
js_ints(w, FP_SIZE);
|
|
putchar('}');
|
|
}
|
|
}
|
|
printf("]}");
|
|
printf(",\n\"LANE_OF\":\"");
|
|
for (k = 35; k <= 81; k++)
|
|
printf("%u", (unsigned)drum_lane(k));
|
|
printf("\",\n\"PCT\":["); /* F_PCT as the firmware shows it (#31: SWG 0..100) */
|
|
for (k = 0, e = 0; k < (uint32_t)P_E0 + G_COUNT; k++) {
|
|
const param_desc_t *d = k < (uint32_t)P_E0 ? &TP[k] : &GP[k - P_E0];
|
|
int32_t x[3] = {d->min, (d->min + d->max) / 2, d->max};
|
|
if (d->fmt != F_PCT)
|
|
continue;
|
|
for (i = 0; i < 3u; i++) {
|
|
char val[12];
|
|
const char *unit;
|
|
param_format(d, x[i], val, &unit);
|
|
printf("%s[%d,%d,%d,%d,", e++ ? "," : "", k < (uint32_t)P_E0 ? 0 : 1, k < (uint32_t)P_E0 ? (int)k : (int)(k - P_E0),
|
|
x[i], d->max);
|
|
js_str(val);
|
|
putchar(']');
|
|
}
|
|
}
|
|
printf("],\n\"SHOWN\":["); /* #48: the values as a knob steps them (params.c param_turn), */
|
|
{ /* every F_ENUM: [scope, index, the names from the left end] */
|
|
for (k = 0, e = 0; k < (uint32_t)P_E0 + G_COUNT; k++) {
|
|
const param_desc_t *d = k < (uint32_t)P_E0 ? &TP[k] : &GP[k - P_E0];
|
|
int32_t v = d->def, n;
|
|
if (d->fmt != F_ENUM || !d->names || d->max <= d->min)
|
|
continue;
|
|
for (n = 0; n < 64; n++)
|
|
v = param_turn(d, v, -1);
|
|
printf("%s[%d,%d,[", e++ ? "," : "", k < (uint32_t)P_E0 ? 0 : 1, k < (uint32_t)P_E0 ? (int)k : (int)(k - P_E0));
|
|
for (n = 0; n < 64; n++) {
|
|
int32_t w = param_turn(d, v, 1);
|
|
js_str(d->names[v - d->min]);
|
|
if (w == v)
|
|
break;
|
|
putchar(',');
|
|
v = w;
|
|
}
|
|
printf("]]");
|
|
}
|
|
}
|
|
printf("]}\n");
|
|
return 0;
|
|
}
|