mirror of
https://github.com/isod89/clipper-fm1.git
synced 2026-12-06 12:54:20 +01:00
Sound - SPREAD (VOICE 3): each voice its own place in the stereo field. The part renders its voices' sum (the mid, bit for bit as before at 0) and a side signal (each voice times its place x SPREAD, gliding through the block), on either core (vs_tmp per core, C1_IX). The side follows DIST / INSERT's level, goes through the track FILTER (its own state) and the duck; mix_part1 adds it left, takes it right. The pads and the unison sounds load with 48 (preset_extras), unless a preset sets SPREAD. - The matrix: 12 slots (7..12 at P_M7SRC), new sources LFO 3 (its own page: RATE, WAVE, FREE / KEY) and MAC1..MAC4. - ENV 2 LOOP: past its decay the attack again while the note is held. - MACROS on every engine (EDIT > MACROS, CC 16..19 but on HYBRID): BRITE (cutoff), TIMBR (shape), MOTN (a vibrato, LFO 3 on the cutoff), SPACE (reverb, delay, SPREAD). - Reverb TYPE HALL (the plate's tank: longer decay up to 0.9, a pre-delay, darker) and SHIMMER (an octave-up line fed back, kept under a loop gain of 1: decay and damping capped). A change between the room and the tank fades over 6 blocks; the pre-delay glides. - The delay's MODE (G_DMODE, DLY 2): MONO, PING (left at TIME, right at 2 x TIME, the feedback from the right), TAPE (wow and flutter swing the tap, the feedback saturates); a change of MODE cross-fades (DL_XF). Fixed - The JUNO chorus wrapped round on a loud chord (x * g past 2^31): 64-bit products, the line at an eighth (no clipping). A test in synth10. Storage - User presets: the 1.0 values and the fifth bit of slots 1..6's sources in a tail after the bank payload (storage.c st_tail: programmed with the payload, outside its length and CRC; SLOOP / older Clipper never see it). The record SLOOP reads is unchanged. - Projects: the 1.0 values of both sounds and G_DMODE in track 3's nudges while track 3 has no steps (a mark and a check byte); otherwise their defaults. - RAM: the undo history and the shimmer line in the pool (the RAM region was full). Editor: EXPECT_10 (126 / 118, gcount 34), the new pages, the matrix's 12 slots, synDesc for slots 7..12. Still protocol 14 (no new command); EDITOR_PROTOCOL.md. Docs: README, DEMARRAGE-RAPIDE-FR, the installer page. Version CLIPPER 1.0. Tests: synth10 (SPREAD, slots, LFO 3, ENV 2 LOOP, macros, CC, reverbs incl. the worst case, PING / TAPE / MODE change, projects, user presets, pages, the JUNO fix) plain and under ASan + UBSan; split_test with SPREAD and the macros (both cores, bit for bit); clean_test 55 cases (SPREAD, the macros, the reverb TYPE, the delay MODE); storage_test (the tail); the soak waits out HALL's tail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RDUenQzjQ4Kk2jQVG85bwq
119 lines
5.2 KiB
C
119 lines
5.2 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* Copyright (C) 2026 3dSam (Clipper) */
|
|
/* Clipper 0.7, the voices on both cores (voice.c track_render, vs_finish): every preset of every engine, a chord of
|
|
* six notes at six velocities, held then released, rendered with the split (cpu1_units -1) and without (0): the same
|
|
* output, bit for bit. Half the cases with a matrix slot moving an EDIT value (the late voices: after the wait; such a
|
|
* part stays on this core), the others handed over (ACID: one voice, never). (1.0) Half with SPREAD (the voices'
|
|
* side, rendered on either core), the matrix cases with the macros and LFO 3 in slot 7.
|
|
* Run under every mode of the host double of core 1 (tests/cpu1_host.c): CORES=1 (inline at the wait), CORES=2 (a
|
|
* thread; with -fsanitize=thread: no race), CHAOS=N (an erratic thread), CPU1_TIMEOUT_AT=K (a lost job: held, its
|
|
* voices rendered here, once). Each case in a child process: the same state from power-on for both renders.
|
|
* split_test [MAXPRESETS] */
|
|
#define main hostsim_main
|
|
#include "hostsim.c"
|
|
#undef main
|
|
|
|
static int fails;
|
|
static uint32_t cases, split_cases;
|
|
|
|
static uint64_t render_case(uint32_t e, uint32_t pi, int matrix, int32_t units, uint32_t *jobs)
|
|
{
|
|
static int32_t o[CTL * 2];
|
|
static const uint8_t notes[6] = {48, 55, 60, 64, 67, 72};
|
|
uint64_t h = 1469598103934665603ull;
|
|
uint32_t b, i;
|
|
host_tracks_init();
|
|
for (i = 0; i < NPART; i++)
|
|
host_preset(&trk[i], i ? 1u : e, i ? 0u : pi);
|
|
clipper_proj_neutral();
|
|
trk[1].p[P_LYMODE] = LY_OFF;
|
|
trk[0].p[P_VOICE] = V_POLY;
|
|
if (matrix) { /* LFO 1 -> the engine's second EDIT value, and VEL -> its fifth */
|
|
trk[0].p[P_M1SRC] = MS_LFO1, trk[0].p[P_M1DST] = MT_E1 + 1, trk[0].p[P_M1AMT] = 40;
|
|
trk[0].p[P_M2SRC] = MS_VEL, trk[0].p[P_M2DST] = MT_E1 + 4, trk[0].p[P_M2AMT] = -30;
|
|
trk[0].p[P_LRATE] = 90;
|
|
trk[0].p[P_MAC1] = 30, trk[0].p[P_MAC3] = 90; /* (1.0: the macros, LFO 3, slot 7) */
|
|
trk[0].p[P_M7SRC] = MS_LFO3, trk[0].p[P_M7DST] = MT_E1 + 2, trk[0].p[P_M7AMT] = 25;
|
|
trk[0].p[P_L3RATE] = 70;
|
|
}
|
|
if (pi & 2u) /* (1.0) SPREAD: each voice's side, on either core */
|
|
trk[0].p[P_SPREAD] = 110;
|
|
cpu1_units = units;
|
|
for (b = 0; b < 4u; b++)
|
|
mix_block(o, CTL);
|
|
for (i = 0; i < 6u; i++)
|
|
trk_note_on(&trk[0], notes[i], 40u + 15u * i);
|
|
for (b = 0; b < 260u; b++) {
|
|
if (b == 180u)
|
|
for (i = 0; i < 6u; i++)
|
|
trk_note_off(&trk[0], notes[i]);
|
|
mix_block(o, CTL);
|
|
for (i = 0; i < 2u * CTL; i++)
|
|
h = (h ^ (uint32_t)o[i]) * 1099511628211ull;
|
|
}
|
|
*jobs = vs_jobs;
|
|
return h;
|
|
}
|
|
|
|
/* one render in a child: its hash and the blocks it handed over, through a pipe */
|
|
static int child_render(uint32_t e, uint32_t pi, int matrix, int32_t units, uint64_t *h, uint32_t *jobs)
|
|
{
|
|
int fd[2];
|
|
pid_t pid;
|
|
struct { uint64_t h; uint32_t jobs; } r = {0, 0};
|
|
if (pipe(fd))
|
|
return -1;
|
|
pid = fork();
|
|
if (pid == 0) {
|
|
close(fd[0]);
|
|
r.h = render_case(e, pi, matrix, units, &r.jobs);
|
|
if (write(fd[1], &r, sizeof r) != (ssize_t)sizeof r)
|
|
_exit(2);
|
|
_exit(0);
|
|
}
|
|
close(fd[1]);
|
|
if (read(fd[0], &r, sizeof r) != (ssize_t)sizeof r)
|
|
r.h = 0, r.jobs = 0xFFFFFFFFu;
|
|
close(fd[0]);
|
|
waitpid(pid, 0, 0);
|
|
*h = r.h;
|
|
*jobs = r.jobs;
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
uint32_t e, pi, maxp = argc > 1 ? (uint32_t)atoi(argv[1]) : 64u;
|
|
for (e = 0; e < NENGINES; e++) {
|
|
const engine_t *en = ENGINES[e];
|
|
uint32_t np = en->npresets < maxp ? en->npresets : maxp, bad = 0, handed = 0;
|
|
if (!vs_ok(en))
|
|
continue; /* (the others never split: nothing to compare) */
|
|
for (pi = 0; pi < np; pi++) {
|
|
int matrix = (int)(pi & 1u);
|
|
uint64_t a, b;
|
|
uint32_t ja, jb;
|
|
child_render(e, pi, matrix, 0, &a, &ja);
|
|
child_render(e, pi, matrix, -1, &b, &jb);
|
|
cases++;
|
|
if (a != b || !a) {
|
|
bad++;
|
|
printf("split: %s preset %u (%s)%s%s: %016llx vs %016llx\n", en->name, pi, en->presets[pi].name,
|
|
matrix ? " +matrix" : "", (pi & 2u) ? " +spread" : "", (unsigned long long)a, (unsigned long long)b);
|
|
}
|
|
if (jb && jb != 0xFFFFFFFFu)
|
|
handed++, split_cases++;
|
|
if (ja)
|
|
bad++, printf("split: %s preset %u: handed over with the split off (%u)\n", en->name, pi, ja);
|
|
}
|
|
if (!getenv("CPU1_TIMEOUT_AT") && en != &ENG_ACID && handed < np / 2u)
|
|
bad++; /* (every case without the matrix: its voices on both cores) */
|
|
printf("split: %-8s %2u presets, the same output with and without the split, %2u handed over %s\n", en->name, np,
|
|
handed, bad ? "FAIL" : "ok");
|
|
fails += bad != 0;
|
|
}
|
|
printf("split: %u cases, %u with voices on core 1 (CORES=%d)\n", cases, split_cases, cpu1_host_mode());
|
|
printf(fails ? "split: %d FAILED\n" : "split: all passed\n", fails);
|
|
return fails;
|
|
}
|