V10.60: DIGITAL's conversion and JIANT 0.1-0.5's project read in the Bluetooth segment (4.3 KB free)

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-03 19:30:43 +00:00
1 parent 56e6e32831
commit 43b8ea8111
6 files changed
+1693 -1671

No files matched your search

+1 -6
View File
@@ -33,22 +33,17 @@ static void bt_hw_enable(int on);
static uint32_t bt_hw_status(void);
static uint32_t bt_hw_rssi(uint16_t *w, uint32_t *rd); /* bt_hw.c: the RSSI words since *rd (V10.14) */
static uint32_t bt_hw_rxdiag(void); /* bt_hw.c: (V10.19) RSSI hook / good packets, 16 bits each */
static int bt_hw_seg(void); /* bt_hw.c: 1 the segment installed is this build's (checked once) */
/* (V10.13) code and constants of the app's own that live in the segment (app.ld .bt: flash 0xEA000, outside the full
* app slot), cold and never needed by the sound: read or called only once bt_hw_seg() said the segment is this build's
* (its CRC-32 covers them), or from the segment itself; without it they are missing (MENU > ABOUT's credits), never
* read */
#define BTAPP_RO __attribute__((section(".btapp.rodata"), used))
#define BTAPP_FN __attribute__((section(".btapp.text"), used, noinline))
/* (BTAPP_RO / BTAPP_FN and bt_hw_seg's prototype: core.h, V10.60) */
#else
static int bt_hw_start(uint8_t addr[6]) { (void)addr; return 2; } /* (the host, the emulator: no radio) */
static void bt_hw_enable(int on) { (void)on; }
static uint32_t bt_hw_status(void) { return 0; }
static uint32_t bt_hw_rssi(uint16_t *w, uint32_t *rd) { (void)w, (void)rd; return 0; }
static uint32_t bt_hw_rxdiag(void) { return 0; }
static int bt_hw_seg(void) { return 1; } /* (the host: everything in the one image) */
#define BTAPP_RO
#define BTAPP_FN
#endif
#if FELUCCA_BT
/* (V10.13) a BLE-MIDI message received (bt_seg.c ble_app_midi_in: channel messages, the clock, START CONTINUE STOP) into
+11
View File
@@ -859,3 +859,14 @@ static volatile uint32_t fm1_ms; /* milliseconds since boot (TIMER4-based, TIME
#define BOOTGUARD_MAGIC 0x42475244u
struct { uint32_t magic, failed, pending; } bootguard __attribute__((section(".noinit")));
/* (V10.60) the Bluetooth segment's section macros and its check, here, ahead of the sound: cold code of
* its files (fm4_convert.c) goes there too (bt.c has the story) */
#if FELUCCA_BT
#define BTAPP_RO __attribute__((section(".btapp.rodata"), used))
#define BTAPP_FN __attribute__((section(".btapp.text"), used, noinline))
static int bt_hw_seg(void); /* bt_hw.c */
#else
#define BTAPP_RO
#define BTAPP_FN
static int bt_hw_seg(void) { return 1; } /* (the host: everything in the one image) */
#endif
+1 -1
View File
@@ -44,7 +44,7 @@
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
#endif
#ifndef FELUCCA_VERSION
#define FELUCCA_VERSION "V10.59" /* (2026-11-03) V10.59: FX > RPT 1/8 at slow tempos (the user: dimmed at 61 BPM): a REPEAT longer than the loop at 22 kHz (371 ms) records at 11 kHz, lo-fi (the effect's), up to 742 ms: 1/8 from 41 BPM (was 81), 1/16 from 21 (was 41); the faster ones as before, bit for bit. (2026-11-03) V10.58: users' reports: the master EQ (and TAPE) went back to flat on its own (going to GLO's pages, since V10.44): every read of a stored project or section (a slot checked, a section listed) set the EQ and TAPE playing; they now live in the project read and are applied only when it is loaded; MENU in BOTTOM and HUD showed its four cards under the panel (a blank band over it): the panel right under the tabs there, the cards at the foot as on every page of theirs; AIR's HOME: the beings swim under its cards (they crossed the tabs and the values); FX > EQ with SCOPE ON: the master's scope behind the curve. (2026-11-03) V10.57: USB > HOST takes an audio interface at 48 kHz too (the user's OP-Z, and the many interfaces with no 44,100): set to 48,000 when it has no 44,100, read at the I2S clock from a step of 48 / 44.1 (the reader's interpolation, its drift steering as before); packets of up to 50 frames taken. (2026-11-03) V10.56: USB IN+OUT no longer mixes the computer's or the phone's audio into the last track by itself (the user: recording from KOALA with IN+OUT on looped into a digital feedback, the app sending the FM-1's own output back): the input sounds where an INPUT track takes it; STEMS+IN keeps its own stem as before. (2026-11-03) V10.55: GEN's sounds right again: V10.42 replaced FM6 presets 8..12 and 14 and WHEEL 5, 6, and GEN still picked them by number for its roles (a SUB BASS played the bells, leads the electric pianos and plucks, a pedal bass the organs): its BELL EP PLUCK STRINGS SINE KEYS ORGAN DUB CHORD and KEYS take today's nearest (BELL MARIMBA TINE EP PLUCK PAD WAVE ORGAN GOSPEL JAZZ PERC); INPUT's meters keep FOLLOW's frame with the input silent; the host tests brought up to date with the UI (the DJ FILTER on LIVE > MANO, the roll's 13 px columns, INPUT in the engine lists). (2026-11-03) V10.54: the INPUT engine (the user's ask: the audio input routed, the track in an audio mode, an envelope follower): engine 15 plays the USB audio input (an interface on HOST, or the computer's USB IN+OUT) on its track: SOURCE IN 1 / IN 2 / 1+2 / STEREO (two tracks can take IN 1 and IN 2; STEREO keeps the image through the part's chain as IMAGE does), GAIN, GATE, PLAY THRU / KEYS (only while a note plays, at its envelope: a trance gate from the steps), WIDTH, RING (KEYS: a sine at the note), BITS, RATE; the track's FILTER DIST LEVEL PAN sends as any part's; EDIT INPUT shows both inputs' meters, GATE's level and FOLLOW; while a track is INPUT the last track's IN+OUT mix steps aside; MOD SRC FOLLOW, the input's envelope, on any track and any destination. (2026-11-03) V10.53: USB > HOST takes an audio interface too, an experiment (the user's ask: a USB audio input into the synth): a class compliant USB audio 1.0 capture (16-bit, mono or stereo, 44,1 kHz among its rates: Behringer UM2 / UCA and the like), alone or behind a powered hub, set to 44,1 kHz (SET_CUR) and read each frame (isochronous IN) into IN+OUT's ring: it plays through the last track (its LEVEL PAN and sends, as USB IN+OUT's host audio); usb_host_desc.h uh_parse_uac, tested; not yet on hardware. (2026-11-03) V10.52: a synth's STEREO page shows IMAGE at work (the user: no visual feedback): the field L .. R, each voice sounding a blob at its place, its size its level now, its note over it (IMAGE 0: the notes in a row), the silent ones a tick where they would sit, the span IMAGE opens as a bar. (2026-11-03) V10.51: the roll follows the playhead for real (the user: V10.47's did not): the bar playing was chosen in the roll's drawing, and a playhead out of the bar shown changed nothing the panel's redraw looks at (graph_signature): never drawn, never followed; now chosen there. (2026-11-03) V10.50: the user's fixes to V10.49: a synth's STEREO IMAGE its own parameter (P_SIMG, the lane-1 level's slot, stored inverted: every part's 127 = 0 %; on VOICE V10.49's showed and moved LYRIC, the slot VOICE uses), its own STEREO page; EDIT's order: the sound's pages first, VOICE and VOICE 2 last in a group of their own (SOUND TONE FOCUS VOICE; FM6: SOUND TONE OPS VOICE). (2026-11-03) V10.49: users' asks: FX > DLY 3 KNOB 4 R TIME, the right echo its own time as a ratio of TIME (=L as before, x1/2 x2/3 x3/4 x4/3 x3/2 x2; not with PING-PONG or the grains; saved, project block DR); EDIT > STEREO IMAGE on synth parts in POLY: each voice its own place across the stereo field (DRUM-X's way: what each side gives up, through the part's filter, narrowed by DIST), the page shows the eight voices' places. (2026-11-03) V10.48: room: LOFI's, ANIMAL's and STRING's creatures (ui_engvis.c, ~6 KB) moved into the Bluetooth segment (without it: the being, as otherLine truncated
#define FELUCCA_VERSION "V10.60" /* (2026-11-03) V10.60: room (the user's ask): the conversion of DIGITAL's sounds to FM6 (fm4_convert.c) and the read of JIANT 0.1-0.5's projects (FUNB..FUN7, project.c proj_unpack) moved into the Bluetooth segment (without it: a DIGITAL sound loads as the FM6 factory preset that covers it, those old projects are not read); the app slot 4.3 KB free (was 0.8), the segment 2.7 KB; BTAPP_FN / BTAPP_RO in core.h. (2026-11-03) V10.59: FX > RPT 1/8 at slow tempos (the user: dimmed at 61 BPM): a REPEAT longer than the loop at 22 kHz (371 ms) records at 11 kHz, lo-fi (the effect's), up to 742 ms: 1/8 from 41 BPM (was 81), 1/16 from 21 (was 41); the faster ones as before, bit for bit. (2026-11-03) V10.58: users' reports: the master EQ (and TAPE) went back to flat on its own (going to GLO's pages, since V10.44): every read of a stored project or section (a slot checked, a section listed) set the EQ and TAPE playing; they now live in the project read and are applied only when it is loaded; MENU in BOTTOM and HUD showed its four cards under the panel (a blank band over it): the panel right under the tabs there, the cards at the foot as on every page of theirs; AIR's HOME: the beings swim under its cards (they crossed the tabs and the values); FX > EQ with SCOPE ON: the master's scope behind the curve. (2026-11-03) V10.57: USB > HOST takes an audio interface at 48 kHz too (the user's OP-Z, and the many interfaces with no 44,100): set to 48,000 when it has no 44,100, read at the I2S clock from a step of 48 / 44.1 (the reader's interpolation, its drift steering as before); packets of up to 50 frames taken. (2026-11-03) V10.56: USB IN+OUT no longer mixes the computer's or the phone's audio into the last track by itself (the user: recording from KOALA with IN+OUT on looped into a digital feedback, the app sending the FM-1's own output back): the input sounds where an INPUT track takes it; STEMS+IN keeps its own stem as before. (2026-11-03) V10.55: GEN's sounds right again: V10.42 replaced FM6 presets 8..12 and 14 and WHEEL 5, 6, and GEN still picked them by number for its roles (a SUB BASS played the bells, leads the electric pianos and plucks, a pedal bass the organs): its BELL EP PLUCK STRINGS SINE KEYS ORGAN DUB CHORD and KEYS take today's nearest (BELL MARIMBA TINE EP PLUCK PAD WAVE ORGAN GOSPEL JAZZ PERC); INPUT's meters keep FOLLOW's frame with the input silent; the host tests brought up to date with the UI (the DJ FILTER on LIVE > MANO, the roll's 13 px columns, INPUT in the engine lists). (2026-11-03) V10.54: the INPUT engine (the user's ask: the audio input routed, the track in an audio mode, an envelope follower): engine 15 plays the USB audio input (an interface on HOST, or the computer's USB IN+OUT) on its track: SOURCE IN 1 / IN 2 / 1+2 / STEREO (two tracks can take IN 1 and IN 2; STEREO keeps the image through the part's chain as IMAGE does), GAIN, GATE, PLAY THRU / KEYS (only while a note plays, at its envelope: a trance gate from the steps), WIDTH, RING (KEYS: a sine at the note), BITS, RATE; the track's FILTER DIST LEVEL PAN sends as any part's; EDIT INPUT shows both inputs' meters, GATE's level and FOLLOW; while a track is INPUT the last track's IN+OUT mix steps aside; MOD SRC FOLLOW, the input's envelope, on any track and any destination. (2026-11-03) V10.53: USB > HOST takes an audio interface too, an experiment (the user's ask: a USB audio input into the synth): a class compliant USB audio 1.0 capture (16-bit, mono or stereo, 44,1 kHz among its rates: Behringer UM2 / UCA and the like), alone or behind a powered hub, set to 44,1 kHz (SET_CUR) and read each frame (isochronous IN) into IN+OUT's ring: it plays through the last track (its LEVEL PAN and sends, as USB IN+OUT's host audio); usb_host_desc.h uh_parse_uac, tested; not yet on hardware. (2026-11-03) V10.52: a synth's STEREO page shows IMAGE at work (the user: no visual feedback): the field L .. R, each voice sounding a blob at its place, its size its level now, its note over it (IMAGE 0: the notes in a row), the silent ones a tick where they would sit, the span IMAGE opens as a bar. (2026-11-03) V10.51: the roll follows the playhead for real (the user: V10.47's did not): the bar playing was chosen in the roll's drawing, and a playhead out of the bar shown changed nothing the panel's redraw looks at (graph_signature): never drawn, never followed; now chosen there. (2026-11-03) V10.50: the user's fixes to V10.49: a synth's STEREO IMAGE its own parameter (P_SIMG, the lane-1 level's slot, stored inverted: every part's 127 = 0 %; on VOICE V10.49's showed and moved LYRIC, the slot VOICE uses), its own STEREO page; EDIT's order: the sound's pages first, VOICE and VOICE 2 last in a group of their own (SOUND TONE FOCUS VOICE; FM6: SOUND TONE OPS VOICE). (2026-11-03) V10.49: users' asks: FX > DLY 3 KNOB 4 R TIME, the right echo its own time as a ratio of TIME (=L as before, x1/2 x2/3 x3/4 x4/3 x3/2 x2; not with PING-PONG or tLine truncated
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
+38 -20
View File
@@ -112,7 +112,7 @@ static const engine_t ENG_FM4_GONE = {
#endif
/* per DIGITAL algorithm: the FM6 algorithm (0-based), the FM6 operator (1..6) of DIGITAL's op 1..4, and its share:
* 1 alone, 2..4 summed with others into one input or the output (DIGITAL averages them) */
static const struct { uint8_t alg, op[4], share[4]; } FM4_ALG[8] = {
static const struct { uint8_t alg, op[4], share[4]; } FM4_ALG[8] BTAPP_RO = {
{0, {3, 4, 5, 6}, {1, 1, 1, 1}},
{13, {3, 4, 5, 6}, {1, 1, 2, 2}},
{7, {3, 5, 6, 4}, {1, 2, 1, 2}},
@@ -123,10 +123,10 @@ static const struct { uint8_t alg, op[4], share[4]; } FM4_ALG[8] = {
{31, {1, 2, 3, 6}, {4, 4, 4, 4}},
};
static int32_t fm4_abs(int32_t x) { return x < 0 ? -x : x; }
BTAPP_FN static int32_t fm4_abs(int32_t x) { return x < 0 ? -x : x; }
/* 256 x log2(x), x > 0 (the mantissa: f + 0.346 f (1 - f), within 0.01 octave) */
static int32_t fm4_lg(uint32_t x)
BTAPP_FN static int32_t fm4_lg(uint32_t x)
{
int32_t n = 0;
uint32_t f;
@@ -138,14 +138,14 @@ static int32_t fm4_lg(uint32_t x)
return n * 256 + (int32_t)(f + ((f * (256u - f) * 89u) >> 16));
}
/* microsteps (256 = 6 dB) of an amplitude in Q15 (32768 = 1) */
static int32_t fm4_ms(uint32_t q15) { return q15 ? fm4_lg(q15) - 15 * 256 : FM4_MUTE; }
BTAPP_FN static int32_t fm4_ms(uint32_t q15) { return q15 ? fm4_lg(q15) - 15 * 256 : FM4_MUTE; }
/* DIGITAL time value v (0..127) in samples */
static int32_t fm4_samples(int32_t v) { return (int32_t)(TIME_MS_X10[v & 127] * 441u / 100u); }
BTAPP_FN static int32_t fm4_samples(int32_t v) { return (int32_t)(TIME_MS_X10[v & 127] * 441u / 100u); }
/* the FM6 rate (0..99) of a stage that takes `per` samples per 6 dB (msfa: (4 + q % 4) << (7 + q / 4) a block,
* q = rate x 41 / 64): the nearest in log */
static uint32_t fm4_rate(int32_t per)
BTAPP_FN static uint32_t fm4_rate(int32_t per)
{
uint32_t r, best = 0;
int32_t bd = 0x7FFFFFFF, lt = fm4_lg((uint32_t)(per < 1 ? 1 : per));
@@ -158,14 +158,14 @@ static uint32_t fm4_rate(int32_t per)
return best;
}
/* a decay over t samples that drops `drop` microsteps (FM4_MUTE: to silence, -40 dB at t) */
static uint32_t fm4_fall(int32_t t, int32_t drop)
BTAPP_FN static uint32_t fm4_fall(int32_t t, int32_t drop)
{
if (drop <= 0)
return drop == FM4_MUTE ? fm4_rate(t * 100 / 664) : 99u;
return fm4_rate(t * 111 / drop); /* (exponential: most of the way at t / 2.3) */
}
/* the EG level (0..99) `ms` microsteps below level 99 (msfa: (scaleout(L) >> 1) << 6) */
static uint32_t fm4_level(int32_t ms)
BTAPP_FN static uint32_t fm4_level(int32_t ms)
{
uint32_t l, best = 0;
int32_t bd = 0x7FFFFFFF;
@@ -179,7 +179,7 @@ static uint32_t fm4_level(int32_t ms)
return best;
}
/* the output level (0..99) `ms` microsteps below level 99 (msfa: scaleout(OL) << 5) */
static uint32_t fm4_outlevel(int32_t ms)
BTAPP_FN static uint32_t fm4_outlevel(int32_t ms)
{
uint32_t l, best = 0;
int32_t bd = 0x7FFFFFFF;
@@ -201,16 +201,32 @@ static uint32_t fm4_nearest(const int16_t *e)
for (k = 0; k < FM4_NPRESETS; k++) {
int32_t d = ((e[0] & 7) != DIGITAL_PRESETS[k].e[0]) * 1000;
for (i = 1; i < 7u; i++)
d += fm4_abs(e[i] - DIGITAL_PRESETS[k].e[i]) * (i < 4u ? 8 : 1);
d += (e[i] > DIGITAL_PRESETS[k].e[i] ? e[i] - DIGITAL_PRESETS[k].e[i] : DIGITAL_PRESETS[k].e[i] - e[i]) * (i < 4u ? 8 : 1);
if (d < bd)
bd = d, best = k;
}
return best;
}
/* p's values as FM6 has them once converted (the EDIT values its macros at 0, PTCH the FM6 preset, the OP ENV values
* their defaults, the ADSR neutral) -> that preset */
static uint32_t fm4_tail(int16_t *p, uint32_t near)
{
uint32_t k;
for (k = 0; k < 7u; k++) /* FM6's macros: the patch as it is */
p[P_E0 + k] = 0;
p[P_E7] = FM4_TO_FM6[near];
for (k = P_FM1_ATK; k <= P_FM4_LEVEL; k++)
p[k] = (k - P_FM1_ATK) % 5u == 2u || (k - P_FM1_ATK) % 5u == 4u ? 127 : 0;
p[P_ATK] = p[P_DEC] = p[P_REL] = 0; /* (0.6.81) the ADSR is in the operators' envelopes now: the */
p[P_SUS] = 127; /* track's on FM6 neutral (it moves the carriers' since) */
return FM4_TO_FM6[near];
}
/* p: a track's values as DIGITAL has them (P_COUNT) -> v: its FM6 patch (FP_SIZE + 1 bytes); p's EDIT values become
* FM6's (see the top) and the OP ENV values their defaults. -> the FM6 factory preset of PTCH */
static uint32_t fm4_convert(int16_t *p, uint8_t *v)
* FM6's (see the top) and the OP ENV values their defaults. -> the FM6 factory preset of PTCH. (V10.60) In the
* Bluetooth segment (cold: an old project's or preset's DIGITAL sound, once); without it fm4_convert below */
BTAPP_FN static uint32_t fm4_convert_bt(int16_t *p, uint8_t *v)
{
uint32_t alg = (uint32_t)p[P_E0] & 7u, car, k, near = fm4_nearest(&p[P_E0]);
int32_t idx = clamp(p[P_E4], 0, 127), fenv = clamp(p[P_ED_FLT], -64, 63), sus = clamp(p[P_SUS], 0, 127);
@@ -349,14 +365,16 @@ static uint32_t fm4_convert(int16_t *p, uint8_t *v)
v[FP_NAME + 8] = (uint8_t)('1' + alg);
}
fm6_sanitize(v);
for (k = 0; k < 7u; k++) /* FM6's macros: the patch as it is */
p[P_E0 + k] = 0;
p[P_E7] = FM4_TO_FM6[near];
for (k = P_FM1_ATK; k <= P_FM4_LEVEL; k++)
p[k] = (k - P_FM1_ATK) % 5u == 2u || (k - P_FM1_ATK) % 5u == 4u ? 127 : 0;
p[P_ATK] = p[P_DEC] = p[P_REL] = 0; /* (0.6.81) the ADSR is in the operators' envelopes now: the */
p[P_SUS] = 127; /* track's on FM6 neutral (it moves the carriers' since) */
return FM4_TO_FM6[near];
return fm4_tail(p, near);
}
/* (V10.60) without the segment (not this build's): the FM6 factory preset that covers the nearest DIGITAL preset */
static uint32_t fm4_convert(int16_t *p, uint8_t *v)
{
if (bt_hw_seg())
return fm4_convert_bt(p, v);
fm6_unpack(FM6_FACTORY[FM4_TO_FM6[fm4_nearest(&p[P_E0])] % FM6_NFACTORY], v);
return fm4_tail(p, fm4_nearest(&p[P_E0]));
}
/* DIGITAL preset k's values into p as a preset load sets them (ui.c apply_preset_to: the EDIT values, ENV, ENV ->
+4 -1
View File
@@ -1425,7 +1425,10 @@ static int proj_motion_ids(motion_store_t *m, uint32_t np)
}
/* a stored FUNA (st = PROJ_STORE_SIZE), FUN9 (PROJ_STORE_V9: no kit, the factory one), FUN8 (PROJ_STORE_V8: as FUN9,
* its tail 64 bytes shorter) or FUN7 (PROJ_STORE_V7: no patches, the init one) */
static int proj_unpack(project_t *q, const uint8_t *b, uint32_t st)
/* (V10.60) in the Bluetooth segment (these formats are JIANT 0.1-0.5's, cold): without it they are not read */
BTAPP_FN static int proj_unpack_bt(project_t *q, const uint8_t *b, uint32_t st);
static int proj_unpack(project_t *q, const uint8_t *b, uint32_t st) { return bt_hw_seg() ? proj_unpack_bt(q, b, st) : 0; }
BTAPP_FN static int proj_unpack_bt(project_t *q, const uint8_t *b, uint32_t st)
{
uint32_t pos = 68u, t, i, magic, size, sum, np = b[66], v7 = st == PROJ_STORE_V7;
uint32_t vb = st == PROJ_STORE_SIZE, va = vb || st == PROJ_STORE_VA; /* (va: FUNA or FUNB, the kit's layout) */
+1638 -1643
View File
File diff suppressed because it is too large. Load diff