Files
JIANT/tests/chorus_sleep_test.c
Claude a91b8dc8bd Copyright headers: name Juan Jiant on JIANT's own files that had only the SPDX line
Comment-only (the built image is byte-identical). 112 files written new for JIANT FM (GEN gen.c / gen_tables.c /
gen_track.c / song_dice.c, fugue.c, sing_ext.c, ui_euclid.c, ui_scene.c, the STEMS and probe Android apps, the video
tools, JIANT's tests and tools, web/emu/stems.js) carried "SPDX-License-Identifier: GPL-3.0-only" and no copyright
line: they now say "Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)". Checked against Felucca's fork base
like the previous commit; tests/fm6_env_compare.c (msfa envelope as ported in fm6_core.c) and web/emu/gen_bench.mjs
(lines of the emulator's test) are left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-11 18:08:16 +00:00

46 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
* Compare the zero-ring shortcut against forcing the original three taps.
* Covers tails, restart after silence, parameter movement, and LOAD changes.
*/
#define main hostsim_main
#include "hostsim.c"
#undef main
static uint64_t hash_bytes(uint64_t h,const void *p,size_t n)
{
const uint8_t *s=p;
while(n--) h=(h^*s++)*1099511628211ull;
return h;
}
int main(int argc,char **argv)
{
uint64_t h=1469598103934665603ull;
uint32_t reference=argc>1&&!strcmp(argv[1],"reference"), b,i,rng=12345,skips=0;
host_tracks_init();
for(b=0;b<12000;b++) {
uint32_t send=b%1000u>=80u&&b%1000u<200u;
song.g[G_CDEPTH]=(b/19)%128; song.g[G_CRATE]=(b/37)%128;
song.g[G_CSTER]=(int32_t)((b/7)%128)-64;
song.g[G_WIDTH]=(b/23)%128; sys_load=(b/500)%3;
for(i=0;i<CTL;i++) {
rng=rng*1664525u+1013904223u;
fxq_c[i]=send?(int32_t)(rng>>16)-32768:0;
fxq_d[i]=fxq_r[i]=0;
}
if(reference) cho_zeros=0; /* execute the old taps even on a zero ring */
else if(cho_zeros>=CHO_LEN&&!send) {
skips++;
for(i=0;i<CHO_LEN;i++) if(cho_buf[i]) return 2;
}
fx_run(CTL);
h=hash_bytes(h,fx_wet,sizeof fx_wet);
h=hash_bytes(h,fx_sl,sizeof fx_sl); h=hash_bytes(h,fx_sr,sizeof fx_sr);
h=hash_bytes(h,&fx,sizeof fx);
h=hash_bytes(h,&rng_state,sizeof rng_state);
}
h=hash_bytes(h,cho_buf,sizeof cho_buf);
if(!reference&&skips<1000) return 3;
printf("chorus-sleep: hash=%016llx mode=%s quiet_blocks=%u\n",(unsigned long long)h,reference?"reference":"sleep",skips);
return 0;
}