WIP 0.9.17: THEME between its detents, a blend with the next theme (the top half of a name)

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-10-19 19:44:37 +00:00
1 parent 811108f846
commit 03a31f873b
2 files changed
+26 -3

No files matched your search

+8 -2
View File
@@ -767,7 +767,8 @@ static __attribute__((noinline)) uint32_t sy_take_entry(const uint8_t *e, uint8_
* LYB_NONE */
static uint32_t sy_gen_word(const track_t *t, sing_t *s, uint32_t lang, uint32_t lyr)
{
uint32_t theme = (uint32_t)clamp(t->p[P_E1], 0, 127) >> 4, tries, pcat = 0;
uint32_t theme = (uint32_t)clamp(t->p[P_E1], 0, 127) >> 4, f = (uint32_t)clamp(t->p[P_E1], 0, 127) & 15u, tries,
pcat = 0;
int32_t j = -1;
const ly_bank_t *b = &LY_BANK[(lang - 1u) % 3u];
uint32_t src = LYB_NONE;
@@ -814,7 +815,12 @@ static uint32_t sy_gen_word(const track_t *t, sing_t *s, uint32_t lang, uint32_t
case 'P': cat = 4; break;
default: cat = 5; break;
}
th = cat >= 3u ? TH_FN : theme == TH_ANY ? (sy_rnd(&s->rng) % 7u + 5u) % 8u : theme; /* (ANY: 5 6 7 0 1 2 3) */
th = theme; /* (0.9.17) THEME between its detents (automation, a mod):
* the top half of a name's 16 a blend, its words from the
* next theme 1/8 .. 7/8 (the rest, the detents, as before) */
if (cat < 3u && f > 8u && sy_rnd(&s->rng) % 8u < f - 8u)
th = (theme + 1u) & 7u;
th = cat >= 3u ? TH_FN : th == TH_ANY ? (sy_rnd(&s->rng) % 7u + 5u) % 8u : th; /* (ANY: 5 6 7 0 1 2 3) */
if (s->prem <= 2u && cat < 3u) /* the phrase's end: a word that fits it */
j = ly_pick(lang, th, cat, s->prem, 1, &s->rng);
if (j < 0)
+18 -1
View File
@@ -475,7 +475,7 @@ static uint32_t gen_text(uint32_t lang, uint32_t lyr, uint32_t theme, uint32_t n
memset(trk, 0, sizeof trk);
host_tracks_init();
host_preset(&trk[0], eng_voice(), 7);
trk[0].p[P_E1] = (int16_t)(theme * 16u + 8u);
trk[0].p[P_E1] = (int16_t)(theme & 0x100u ? theme & 127u : theme * 16u + 8u); /* (0x100: THEME's value) */
trk[0].p[P_SLEN] = 16;
for (k = 0; k < 16u; k++) { /* pl NOTE steps */
trk[0].step[k].time = k < pl ? ST_NOTE : ST_REST;
@@ -1232,6 +1232,23 @@ static void check_theme(void)
ok = param_turn(&FMT_WDESC[7], 0, 1) == 38 && param_turn(&LOFI_WAVNUM, 64, 1) == 76 && param_turn(&NOISE_LONG, 0, 3) == 56 &&
param_turn(&FMT_WDESC[0], 5, 1) == 6; /* (LOOP 5 names; WAV# 16; LEN 8; POS no names: a value) */
check(" the other named values a name a detent (LOOP, LOFI WAV#, NOISE LEN); POS a value a detent", ok);
{ /* (0.9.17) between the detents: the blend */
static char t8[2048], tv[2048];
uint32_t s1, l, same = 1, diff = 1;
for (l = LG_ES; l <= LG_JA; l++) {
gen_text(l, 1, 0, 6, 9, t8, sizeof t8, &s1);
for (k = 0; k <= 8u; k += 4u) { /* a name's low half: its words, bit for bit (projects) */
gen_text(l, 1, 0x100u + k, 6, 9, tv, sizeof tv, &s1);
same &= !strcmp(t8, tv);
}
gen_text(l, 1, 0x100u + 15u, 6, 9, tv, sizeof tv, &s1);
diff &= strcmp(t8, tv) != 0 && s1; /* the top: the next theme's words in it, phrases whole */
gen_text(l, 1, 1, 6, 9, t8, sizeof t8, &s1);
gen_text(l, 1, 0x100u + 16u, 6, 9, tv, sizeof tv, &s1);
same &= !strcmp(t8, tv);
}
check(" THEME between detents: 0..8 of a name its words as at the detent, 15 a blend with the next", same && diff);
}
}
int main(int argc, char **argv)