/* SPDX-License-Identifier: GPL-3.0-only * Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) */ /* Allocation study inspired by Mello-D/yehnah a26c786, voice.c: * quietest released tail first; retain JIANT's one-shot and bass protection. * Synthetic levels make the ordering deterministic; the final scene uses real * note admission. Host headroom is injected, not an FM-1 CPU measurement. */ #define main hostsim_main #include "hostsim.c" #undef main static unsigned failures; static void ck(const char *name, int ok) { printf("tail-priority: %s %s\n", name, ok ? "PASS" : "FAIL"); failures += !ok; } static void reset_scene(void) { host_tracks_init(); for (unsigned p=0;pactive=1;v->stage=3;v->age=age; v->env_out=level;v->note=(uint8_t)(48+i); } static int chosen(unsigned p, unsigned i, int soft) { track_t *owner=0; unsigned slot=voice_victim(&trk[5],soft,&owner); return slot==i && owner==&trk[p]; } static unsigned held(unsigned p) { unsigned n=0; for (unsigned i=0;i