Files
JIANT/tests/gen_test.c
T
Claude 31b6ce5bd3 0.6.97: GEN: drums less alike, the kit's space, effects by genre, finer sounds, melodies from cells, POST PUNK after Joy Division / New Order, PLAY on the screen
- Drums: a throw takes its closed hats, open hats, rim, cowbell and toms from pools of
  patterns now and then (HAT_POOL, OH_POOL, RS_POOL, CB_POOL, TM_POOL), swaps the snare and
  the clap now and then, adds a kick on a weak step more often; FORM PARTS / SONG: each
  section its own fill (roll, toms, hat roll, drop, linear, kick sixteenths).
- The kit's space: the snare and the clap into the reverb (dx_snd, by the genre's wetness),
  the rim into the delay and the open hat a touch of reverb where the genre is wet; MORPH
  automated over the loop on the drum track now and then.
- Effects by genre: the wet genres' long delay tails with the tape's wobble (FEEDBK 58..80,
  MOD 20..50); the SONG form's punch-in lane: a stutter into the drop (1/8 then 1/16 on the
  build's last beat), the synths an octave up on the break's last bar (pfx_lane_put).
- Sounds: leads not at full sustain (SUS 30..90, DEC 50..85), a late vibrato on half of them,
  a slow tremolo or pan on pads, arps panning on the beat; step components from COMPLEX 30
  up, one to three a track (echoes, octaves, bends, pulses, ratchets), some every other loop.
- Lead melodies: the motif's rhythm from a library of twelve cells that hold together,
  thinned by COMPLEX, instead of onsets drawn one by one.
- POST PUNK after Joy Division and New Order: BA_HOOK2 (Transmission's eighths over root,
  fifth, octave, seventh), BA_BLUEMON (sequenced sixteenth octaves), BA_CEREMONY; DM_JOYDIV
  (the kick syncopated against flat sixteenth hats) and DM_NEWORDER (four on the floor, a
  clap, open hats, toms into the one); pulsed chords, an octave arp, strings, a choir,
  118..148 BPM.
- PLAY on the GEN screen runs and stops the transport (the piece heard without leaving).
- app.ld: RAMTEXT up 4 KiB (the image grew past a call's reach from the RAM code; the user
  stack 19.75 KiB), POOL 4 KiB longer; build.py's bounds with it.
- gen_test: hat rows over eight seeds, the kit's sends, Hook's register and tempo, the
  leads' sustain, PLAY on the screen. Manual EN / ES, README changelog, cheat sheets.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-10-15 13:30:24 +00:00

335 lines
20 KiB
C

/* SPDX-License-Identifier: GPL-3.0-only
* JIANT (0.6.91) the song generator (firmware/src/gen.c) measured: every genre at several seeds and settings, on the
* host build of the UI tests. What a piece must always have: the same piece from the same settings (deterministic);
* one scale on every melodic track, every note in it (the bass's chromatic approaches excepted) and in its register;
* drums on one track with the kick anchored (four-on-the-floor genres: step 1), its density growing with DRUMS;
* the bass's first note at a chord change the root (most of the time: FiloBass' 68 %); the lead's strong steps on chord
* tones more often than not; chords of three or four, voiced in C3..G5, led closely; a storable project; a form in
* ARRANGE when asked; the parts' knobs only touching their own part.
* cc -O1 -w -Ibuild/gen -Ifirmware/src -Itests -o build/host/gen_test tests/gen_test.c -lm */
#define UI_TEST_NO_MAIN 1
#include "ui_test.c"
static int gcheck(const char *what, int ok)
{
printf("gen: %-74s %s\n", what, ok ? "ok" : "FAIL");
return ok ? 0 : 1;
}
static void gen_reset(void)
{
ui_power_on();
ui_rec_prefs |= PREF_SIX >> 8; rp_apply(); /* TRACKS 6 */
settings.palette = UI_JIANT_INDEX; palette_set(UI_JIANT_INDEX);
}
static void gen_with(uint32_t genre, uint32_t seed, uint32_t energy, uint32_t form)
{
uint32_t k;
gp.genre = (uint8_t)genre; gp.seed = (uint16_t)seed; gp.energy = (uint8_t)energy; gp.form = (uint8_t)form;
for (k = 0; k < GP_N; k++) gp.amt[k] = GA_AUTO;
gp.complex = 50; gp.swing = GA_AUTO; gp.human = 30;
gen_go();
}
static uint32_t all_sig(void)
{
uint32_t k, h = 2166136261u ^ (uint32_t)song.g[G_BPM];
for (k = 0; k < NTRK; k++) h = (h ^ steps_sig(&trk[k]) ^ trk[k].eng_req ^ (uint32_t)trk[k].p[P_E4] * 7u) * 16777619u;
return h;
}
static int in_scale(const track_t *t, int32_t n)
{
uint32_t mask = scale_mask(t);
return (mask >> (uint32_t)((n - t->p[P_ROOT] + 120) % 12)) & 1u;
}
static uint32_t hits_of(const track_t *t, uint32_t lane)
{
uint32_t i, c = 0;
for (i = 0; i < (uint32_t)t->p[P_SLEN]; i++) c += t->step[i].time == ST_NOTE && ((t->step[i].hit >> lane) & 1u);
return c;
}
static uint32_t hits_all(const track_t *t)
{
uint32_t i, c = 0, l;
for (i = 0; i < (uint32_t)t->p[P_SLEN]; i++)
if (t->step[i].time == ST_NOTE) for (l = 0; l < 8u; l++) c += (t->step[i].hit >> l) & 1u;
return c;
}
int main(void)
{
int bad = 0;
uint32_t g, s, k, i;
uint32_t notes_out = 0, notes_all = 0, chords_bad = 0, lead_strong = 0, lead_ct = 0, bass_changes = 0, bass_root = 0;
uint32_t drums_many = 0, pieces = 0, kick_anchor_bad = 0, store_bad = 0, range_bad = 0, motion_bad = 0;
gen_reset();
/* ---- deterministic: the same settings twice, the same piece; another seed, another piece */
{
uint32_t h1, h2, h3;
gen_with(1, 421, 50, 0); h1 = all_sig();
gen_with(5, 7, 80, 0);
gen_with(1, 421, 50, 0); h2 = all_sig();
gen_with(1, 422, 50, 0); h3 = all_sig();
bad += gcheck("deterministic: HOUSE 0421 twice the same piece, 0422 another", h1 == h2 && h1 != h3);
}
/* ---- every genre, three seeds, three energies: the guard rails */
for (g = 0; g < NGENRE; g++) {
for (s = 0; s < 3u; s++) {
uint32_t dr = NTRK, bs = NTRK, ld = NTRK, pd = NTRK, drums = 0;
gen_with(g + 1u, 100u * g + 17u * s + 3u, s == 0u ? 20u : s == 1u ? 50u : 85u, 0);
pieces++;
for (k = 0; k < NTRK; k++) {
if (drum_track(&trk[k])) { drums++; dr = k; }
else if (gs.role[k] == RL_BASS && bs == NTRK) bs = k;
else if (gs.role[k] == RL_LEAD && ld == NTRK) ld = k;
else if (gs.role[k] == RL_PAD && pd == NTRK) pd = k;
}
if (drums != 1u) drums_many++;
for (k = 0; k < NTRK; k++) {
const track_t *t = &trk[k];
uint32_t len = (uint32_t)t->p[P_SLEN];
if (k == dr || len > NSTEP) continue;
if (t->p[P_ROOT] != trk[0].p[P_ROOT] || t->p[P_SCALE] != trk[0].p[P_SCALE]) range_bad++;
for (i = 0; i < len; i++) {
const step_t *st = &t->step[i];
uint32_t j;
if (st->time != ST_NOTE) continue;
if (st->n < 1u || st->n > 4u) chords_bad++;
for (j = 0; j < st->n; j++) {
notes_all++;
if (!in_scale(t, st->note[j])) notes_out++;
if (st->note[j] > 84u || st->note[j] < 20u) range_bad++;
}
if (k == pd && st->n >= 3u && (st->note[0] < 46u || st->note[st->n - 1u] > 81u)) { chords_bad++; printf(" chord range: %s seed %u step %u %u..%u\n", gs.g->name, s, i, st->note[0], st->note[st->n - 1u]); }
}
}
if (dr < NTRK && gs.act[RL_DRUM]) { /* the kick anchored on the one where the genre has it */
const char *bd = DRUM_MAP[gs.g->drum][0]; /* (0.6.95: the map as this throw plays it) */
if (bd[0] == 'X' && !(trk[dr].step[0].time == ST_NOTE && (trk[dr].step[0].hit & 1u))) { kick_anchor_bad++; printf(" kick anchor: %s seed %u map %u\n", gs.g->name, s, gs.g->drum); }
}
if (bs < NTRK && gs.act[RL_BASS] && gs.ba != BA_ACID) { /* the root at the chord changes */
const track_t *b = &trk[bs];
uint32_t len = (uint32_t)b->p[P_SLEN], c;
for (c = 0; c * gs.csteps < len; c++) {
uint32_t at = c * gs.csteps, j;
int32_t root = gdeg(b, 24, gchord_deg(at)) % 12;
for (j = at; j < at + 4u && j < len; j++)
if (b->step[j].time == ST_NOTE) {
bass_changes++;
if (b->step[j].note[0] % 12u == (uint32_t)root) bass_root++;
break;
}
}
}
if (ld < NTRK && gs.act[RL_LEAD]) { /* the lead's strong steps on chord tones */
const track_t *l = &trk[ld];
uint32_t len = (uint32_t)l->p[P_SLEN];
for (i = 0; i < len; i += 4u) {
const step_t *st = &l->step[i];
int32_t n[4], c, j;
if (st->time != ST_NOTE) continue;
lead_strong++;
c = (int32_t)gchord_notes(l, 36, gchord_deg(i), gchord_q(i), n);
for (j = 0; j < c; j++) if ((n[j] - st->note[0]) % 12 == 0) { lead_ct++; break; }
}
}
project_capture(&proj_scratch);
if (!proj_pack(&proj_wire, &proj_scratch)) store_bad++;
if (motion.count > MOTION_MAX) motion_bad++;
for (i = 0; i < 16u; i++) events_block(CTL); /* (it plays: no crash) */
}
}
printf("gen: %u pieces, %u notes, %u off the scale (%u %%), bass root at %u of %u changes, lead chord tones %u of %u strong\n",
pieces, notes_all, notes_out, notes_all ? notes_out * 100u / notes_all : 0u, bass_root, bass_changes, lead_ct, lead_strong);
bad += gcheck("every genre x 3: one DRUM track, one scale, every note in it but the approaches (< 4 %), in its register",
!drums_many && !range_bad && notes_out * 100u < notes_all * 4u);
bad += gcheck(" chords of 1..4 notes, the pads' in C3..G5; the kick on the one where the map anchors it", !chords_bad && !kick_anchor_bad);
bad += gcheck(" the bass's first note at a chord change the root, 70 % at least (FiloBass: 68 %)", bass_root * 10u >= bass_changes * 7u);
bad += gcheck(" the lead's strong steps on chord tones, 55 % at least", lead_ct * 100u >= lead_strong * 55u);
bad += gcheck(" every piece storable, the automation inside its 64", !store_bad && !motion_bad);
/* ---- the DRUMS knob: the density grows with it, the kick stays */
{
uint32_t h0, h1, h2, k0, k2;
gen_reset();
gp.genre = 1; gp.seed = 77; gp.energy = 50; gp.form = 0; gp.complex = 50; gp.swing = GA_AUTO; gp.human = 30;
for (k = 0; k < GP_N; k++) gp.amt[k] = GA_AUTO;
gp.amt[GP_DRUMS] = 20; gen_go(); h0 = hits_all(&trk[gs.trk_of[RL_DRUM]]); k0 = hits_of(&trk[gs.trk_of[RL_DRUM]], 0);
gp.amt[GP_DRUMS] = 60; gen_go(); h1 = hits_all(&trk[gs.trk_of[RL_DRUM]]);
gp.amt[GP_DRUMS] = 100; gen_go(); h2 = hits_all(&trk[gs.trk_of[RL_DRUM]]); k2 = hits_of(&trk[gs.trk_of[RL_DRUM]], 0);
printf("gen: HOUSE drums at 20 / 60 / 100 %%: %u %u %u hits, the kick %u -> %u\n", h0, h1, h2, k0, k2);
bad += gcheck("DRUMS 20 < 60 < 100 %: more hits each time, the kick's anchors from the start", h0 < h1 && h1 < h2 && k0 >= 4u && k2 >= k0);
}
/* ---- a part's knob touches its part only: BASS turned, the drums and the lead the same */
{
uint32_t d0, l0, b0, d1, l1, b1;
gen_reset();
gen_with(7, 500, 50, 0);
d0 = steps_sig(&trk[gs.trk_of[RL_DRUM]]); l0 = steps_sig(&trk[gs.trk_of[RL_LEAD]]); b0 = steps_sig(&trk[gs.trk_of[RL_BASS]]);
gp.amt[GP_BASS] = 30; gen_go();
d1 = steps_sig(&trk[gs.trk_of[RL_DRUM]]); l1 = steps_sig(&trk[gs.trk_of[RL_LEAD]]); b1 = steps_sig(&trk[gs.trk_of[RL_BASS]]);
bad += gcheck("BASS turned: the bass changes, the drums and the lead stay (a stream a part)", d0 == d1 && l0 == l1 && b0 != b1);
}
/* ---- a part OFF: its track silent; FORM: PARTS writes sections and ARRANGE */
{
gen_reset();
gp.genre = 2; gp.seed = 9; gp.energy = 50; gp.form = 0;
for (k = 0; k < GP_N; k++) gp.amt[k] = GA_AUTO;
gp.amt[GP_LEAD] = 0; gp.amt[GP_ARP] = 0; gp.complex = 50; gp.swing = GA_AUTO; gp.human = 30;
gen_go();
{
uint32_t on = 0;
for (k = 0; k < NTRK; k++)
if (gs.role[k] == RL_LEAD || gs.role[k] == RL_ARP)
for (i = 0; i < (uint32_t)trk[k].p[P_SLEN]; i++) on += trk[k].step[i].time == ST_NOTE;
bad += gcheck("LEAD and ARP OFF: their tracks silent (the sound kept)", on == 0u);
}
gen_reset();
gen_with(1, 31, 60, 1);
bad += gcheck("FORM PARTS: sections written, ARRANGE filled, PLAY the song",
live.mode == 1 && chain_config.count >= 2u && (dice_secs & 3u) == 3u && SONG_END(&chain_config) == SONG_FOREVER);
for (k = 0; k < chain_config.count; k++) if (chain_config.row[k].slot > 3u || !chain_config.row[k].bars) bad += gcheck(" a row's section and bars", 0);
gen_reset();
gen_with(1, 31, 60, 2);
bad += gcheck("FORM SONG (HOUSE): four sections (intro, build, drop, break), six rows, the drop longest",
live.mode == 1 && chain_config.count == 6u && (dice_secs & 15u) == 15u &&
chain_config.row[2].slot == 0u && chain_config.row[2].bars > chain_config.row[0].bars);
{ /* the BUILD section holds automation on the chords (the filter opening), the BREAK no drums */
project_t p;
int ok = proj_import(&p, &proj_slot[2], sizeof(project_store_t)) && p.motion.count >= 4u;
ok &= proj_import(&p, &proj_slot[3], sizeof(project_store_t)) && p.t[gs.trk_of[RL_DRUM]].p[P_MUTE] == 1;
bad += gcheck(" the BUILD carries the filter's automation, the BREAK mutes the drums", ok);
}
{ /* the live music after: section A, nothing muted */
uint32_t m = 0;
for (k = 0; k < NTRK; k++) m += trk[k].p[P_MUTE] != 0;
bad += gcheck(" after: the whole piece live (A), nothing muted", m == 0u && live.cur == 0);
}
}
/* ---- (0.6.97) the kit's space, the top end's variety, Hook's register, the lead's envelope */
{
uint32_t seeds, rows = 0, bs, lo = 127, hi = 0, i2, sus_lt = 0, leads = 0;
uint32_t seen[64]; uint32_t nseen = 0;
gen_reset();
for (seeds = 1; seeds <= 8u; seeds++) { /* HOUSE: the closed hats' row over eight seeds */
uint32_t h = 2166136261u, d;
gen_with(1, seeds, 50, 0);
d = gs.trk_of[RL_DRUM];
for (i2 = 0; i2 < 16u; i2++) h = (h ^ (uint32_t)(trk[d].step[i2].time == ST_NOTE ? (trk[d].step[i2].hit >> 3) & 3u : 0u)) * 16777619u;
for (i2 = 0; i2 < nseen && seen[i2] != h; i2++) {}
if (i2 == nseen) seen[nseen++] = h;
}
rows = nseen;
bad += gcheck("HOUSE x 8 seeds: three hat rows at least (the pools)", rows >= 3u);
gen_with(1, 3, 50, 0);
bad += gcheck("the kit's snare and clap into the reverb (SEND bus 3, 6..63)", DXS_BUS(dx_snd[DV_SNARE]) == 3u && DXS_AMT(dx_snd[DV_SNARE]) >= 6 &&
DXS_BUS(dx_snd[DV_CLAP]) == 3u);
for (seeds = 1; seeds <= 4u; seeds++) { /* POST PUNK: the bass high on the neck, never below E2 nor above A3 */
gen_with(17, seeds, 50, 0);
bs = gs.trk_of[RL_BASS];
for (i2 = 0; i2 < dlen(&trk[bs]); i2++)
if (trk[bs].step[i2].time == ST_NOTE) { if (trk[bs].step[i2].note[0] < lo) lo = trk[bs].step[i2].note[0]; if (trk[bs].step[i2].note[0] > hi) hi = trk[bs].step[i2].note[0]; }
if (gs.act[RL_LEAD]) { leads++; sus_lt += trk[gs.trk_of[RL_LEAD]].p[P_SUS] < 95; }
}
if (lo < 40u || hi > 70u) printf(" post punk bass %u..%u\n", lo, hi);
bad += gcheck("POST PUNK x 4: the bass between E2 and A#4 (Hook's neck), its tempo 118..148", lo >= 40u && hi <= 70u && song.g[G_BPM] >= 118 && song.g[G_BPM] <= 148);
bad += gcheck(" the leads not all at full sustain", !leads || sus_lt > 0u);
}
/* ---- (0.6.96) a new piece: MUTATE off on every track (a reroll kept the lanes), the anchor the piece */
{
uint32_t on = 0;
gen_reset();
gen_with(1, 5, 50, 0);
trk[3].p[P_MSND] = 3; trk[0].p[P_MPAT] = 2;
gen_go();
for (k = 0; k < NTRK; k++) on += trk[k].p[P_MSND] || trk[k].p[P_MPAT];
bad += gcheck("a new piece: MUTATE SOUND / PATTERN OFF on every track, the anchor kept", !on && mut.ok);
}
/* ---- (0.6.95) a throw its own: HOUSE over twelve seeds takes more than one drum map and more than one chord
* play; RANDOM over forty seeds throws mutants ("A+B") a third of the time or so, each playable and storable */
{
uint32_t seeds, maps = 0, plays = 0, mut = 0, bad_mut = 0;
uint8_t seen_m[64] = {0}, seen_p[16] = {0};
gen_reset();
for (seeds = 1; seeds <= 12u; seeds++) {
gen_with(1, seeds, 50, 0);
if (!seen_m[gs.g->drum]) { seen_m[gs.g->drum] = 1; maps++; }
if (!seen_p[gs.g->pads]) { seen_p[gs.g->pads] = 1; plays++; }
}
bad += gcheck("HOUSE x 12 seeds: two drum maps at least, two chord plays at least", maps >= 2u && plays >= 2u);
for (seeds = 1; seeds <= 40u; seeds++) {
gen_with(0, seeds, 50, 0);
if (gs.mutant) {
mut++;
if (!strchr(gs.g->name, '+') || gs.g->bpm_hi < gs.g->bpm_lo || strncmp(ui.msg, "GEN: ", 5)) bad_mut++;
project_capture(&proj_scratch);
if (!proj_pack(&proj_wire, &proj_scratch)) bad_mut++;
for (i = 0; i < 16u; i++) events_block(CTL);
}
}
if (mut < 8u || mut > 28u || bad_mut) printf(" mutants: %u of 40, %u bad\n", mut, bad_mut);
bad += gcheck("RANDOM x 40 seeds: 8..28 mutants, named A+B, a tempo range, storable, playing", mut >= 8u && mut <= 28u && !bad_mut);
}
/* ---- (0.6.94) the snare a snare: mostly noise, shorter than the factory kit's, its own FEEDBK */
{
gen_reset();
gen_with(1, 5, 50, 0); /* HOUSE (a drum track) */
if (dx_kit[DV_SNARE].a[DXP_NOISE] < 100u) printf(" snare: noise %u / %u, decay %u, lay %02x\n", dx_kit[DV_SNARE].a[DXP_NOISE], dx_kit[DV_SNARE].b[DXP_NOISE], dx_kit[DV_SNARE].a[DXP_DECAY], dx_lay[DV_SNARE]);
bad += gcheck("the generated snare: NOISE >= 100 both ends, DECAY under the factory kit's, FEEDBK 3..6, LAYER kept",
dx_kit[DV_SNARE].a[DXP_NOISE] >= 100u && dx_kit[DV_SNARE].b[DXP_NOISE] >= 100u &&
dx_kit[DV_SNARE].a[DXP_DECAY] < DX_KIT_DEF[DV_SNARE].a[DXP_DECAY] && DX_LAY_FB(dx_lay[DV_SNARE]) >= 3u &&
DX_LAY_FB(dx_lay[DV_SNARE]) <= 6u && DX_LAY_L(dx_lay[DV_SNARE]) == DX_LAY_L(DX_LAY_DEF[DV_SNARE]));
bad += gcheck("the generated hats: a band-pass (not the factory HP), COLOR >= 120, NOISE >= 112, the kick and clap as the kit's",
((dx_kit[DV_HATC].mode >> 2) & 3u) == DXF_BP && ((dx_kit[DV_HATO].mode >> 2) & 3u) == DXF_BP &&
dx_kit[DV_HATC].a[DXP_COLOR] >= 120u && dx_kit[DV_HATO].b[DXP_COLOR] >= 120u &&
dx_kit[DV_HATC].a[DXP_NOISE] >= 112u && dx_kit[DV_HATO].a[DXP_NOISE] >= 112u &&
dx_kit[DV_KICK].mode == DX_KIT_DEF[DV_KICK].mode && dx_kit[DV_CLAP].mode == DX_KIT_DEF[DV_CLAP].mode);
}
/* ---- (0.6.93) the ARP amount is its density: a fifth of the steps at 20 %, most of them at 100 % */
{
uint32_t n20 = 0, n100 = 0, i, ar;
gen_reset();
gen_with(1, 5, 50, 0); /* HOUSE */
ar = gs.trk_of[RL_ARP];
gp.amt[GP_ARP] = 20; gen_go();
for (i = 0; i < dlen(&trk[ar]); i++) n20 += trk[ar].step[i].time == ST_NOTE;
gp.amt[GP_ARP] = 100; gen_go();
for (i = 0; i < dlen(&trk[ar]); i++) n100 += trk[ar].step[i].time == ST_NOTE;
if (n20 * 2u > dlen(&trk[ar]) || n100 < n20 * 2u) printf(" arp: %u notes at 20 %%, %u at 100 %% (LEN %u)\n", n20, n100, dlen(&trk[ar]));
bad += gcheck("ARP 20 %: eighths, under half the steps; 100 %: at least twice as many notes", ar < NTRK && n20 * 2u <= dlen(&trk[ar]) && n100 >= n20 * 2u);
}
/* ---- the screen: HOME + SELECT opens GEN, the knobs set, SELECT pages, OCT+ makes, OCT- is done */
{
gen_reset();
gp.genre = 7; gp.energy = 50; gp.page = 0; gp.form = 0; /* (0.6.93) a genre left from before: the screen opens on RANDOM */
for (k = 0; k < GP_N; k++) gp.amt[k] = GA_AUTO;
go_home(); frames(16);
fm1_ms += 1200u;
held_turn(B_HOME, 1);
bad += gcheck("HOME + SELECT: the GEN screen (ui.confirm CF_DICE_ALL), page 1, GENRE RANDOM (0.6.93)", ui.confirm == CF_DICE_ALL && gp.page == 0u && gp.genre == 0u);
frames(800);
press(B_PLAY); frames(4);
bad += gcheck(" (0.6.97) PLAY on the GEN screen: the transport runs, the screen stays", (song.playing || transport_req == 1) && ui.confirm == CF_DICE_ALL);
press(B_PLAY); frames(4);
bad += gcheck(" PLAY again: stopped, the screen stays", (!song.playing || transport_req == 2) && ui.confirm == CF_DICE_ALL);
frames(8);
frames(800); /* (the knobs quiet a moment after a button: ui_layer.c) */
turn(EN_K1, 1); turn(EN_K3, 2);
bad += gcheck(" KNOB 1 the genre (RANDOM -> HOUSE), KNOB 3 the energy (+10)", gp.genre == 1u && gp.energy == 60u);
turn(EN_SELECT, 1);
turn(EN_K1, -1); turn(EN_K2, 1);
bad += gcheck(" SELECT: page 2 (PARTS); DRUMS AUTO -> 100 %, BASS AUTO stays AUTO above 100", gp.page == 1u && gp.amt[GP_DRUMS] == 100u && gp.amt[GP_BASS] == GA_AUTO);
{
uint32_t sig0 = steps_sig(&trk[0]), sig1;
uint16_t seed0;
press(B_OCTUP); frames(4);
seed0 = gp.seed;
sig1 = steps_sig(&trk[0]);
bad += gcheck(" OCT+: a piece (GEN: HOUSE nnnn), the screen stays", ui.confirm == CF_DICE_ALL && !strncmp(ui.msg, "GEN: HOUSE ", 11) && sig1 != sig0);
press(B_OCTUP); frames(4);
bad += gcheck(" OCT+ again with the same settings: a new seed, another piece", gp.seed != seed0 && steps_sig(&trk[0]) != sig1);
press(B_OCTDN);
bad += gcheck(" OCT-: done, the piece stays", !ui.confirm && steps_sig(&trk[0]) != sig0);
}
}
printf(bad ? "gen: %d FAILED\n" : "gen: all passed\n", bad);
return bad ? 1 : 0;
}