mirror of
https://github.com/ruppert/fmini-1.git
synced 2026-12-06 12:54:23 +01:00
FMini-1 DELAY: A-SYNC's TIME shows only the note values that fit the line
The knob skips the ARP RATE values longer than the delay line (1.48 s) at the tempo now, so they are not shown; a value that fits nowhere (a very slow tempo) stays. dly_div_fits() is the test, the delay stays silent for a stored value that does not fit. Tests: 60 BPM skips 1/2 and longer. Emulator regenerated (docs/emu2). Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
This commit is contained in:
4 files changed
+47
-3
No files matched your search
Binary file not shown.
+12
-1
@@ -307,6 +307,15 @@ static uint32_t dly_kind(void)
|
||||
uint32_t d = (uint32_t)song.g[G_DTIME];
|
||||
return d == 7u ? 0u : d % 7u;
|
||||
}
|
||||
/* A-SYNC: a note value longer than the delay line (1.48 s) is silent, not cut: the delay does not play (dly_block is skipped) */
|
||||
static uint32_t dly_div_fits(uint32_t div) /* A-SYNC: this note value is shorter than the line (at the tempo now) */
|
||||
{
|
||||
return div_samples(div) < DLY_LEN;
|
||||
}
|
||||
static uint32_t dly_fits(void)
|
||||
{
|
||||
return song.g[G_DTIME] != 7 || dly_div_fits((uint32_t)clamp(song.g[G_DRREV], 0, 9));
|
||||
}
|
||||
static uint32_t delay_samples(void)
|
||||
{
|
||||
if (song.g[G_DTIME] == 7) { /* A-SYNC: the time in N_DIV's note values (G_DRREV, 0..9), the tempo's */
|
||||
@@ -1221,7 +1230,9 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
|
||||
cho_block(cho_in, wet, n, cdepth, cinc);
|
||||
fx.ds_on = 1;
|
||||
}
|
||||
if (dly_act) {
|
||||
if (dly_act && !dly_fits()) { /* A-SYNC past the line: silent */
|
||||
fx.ds_on = 0;
|
||||
} else if (dly_act) {
|
||||
uint32_t ty = dly_kind();
|
||||
fx.ds_on |= (uint8_t)(ty == 3u || ty == 4u);
|
||||
if (ty == 6u && !fx.rv_n[0]) { /* REVERSE: two heads half a sweep apart, the newest sample first */
|
||||
|
||||
+23
-2
@@ -112,6 +112,24 @@ static void fmg_write(uint32_t b, uint32_t v)
|
||||
fmg_commit(p, b);
|
||||
}
|
||||
static int32_t fmg_acc(uint32_t role, int32_t s, int32_t range);
|
||||
/* A-SYNC's TIME: a turn of `steps` over the ARP RATE's order, skipping the note values that do not fit the delay line now
|
||||
* (dly_div_fits): only those are shown. A value that fits nowhere (a very slow tempo) stays. */
|
||||
static int32_t async_turn(int32_t v, int32_t steps)
|
||||
{
|
||||
const param_desc_t *d = &TP[P_ARATE];
|
||||
const uint8_t *o = enum_order(d);
|
||||
int32_t top = d->max - d->min, i = enum_rank(d, v) - d->min, dir = steps < 0 ? -1 : 1, left = steps < 0 ? -steps : steps;
|
||||
while (left > 0) {
|
||||
int32_t j = i + dir;
|
||||
while (j >= 0 && j <= top && !dly_div_fits(o[j]))
|
||||
j += dir;
|
||||
if (j < 0 || j > top)
|
||||
break;
|
||||
i = j;
|
||||
left--;
|
||||
}
|
||||
return o[i] + d->min;
|
||||
}
|
||||
/* TUNE's byte (0..127, 64 = A 440) <-> the dial's tenths (0..100, 50 = 5.0): each tenth its own byte, round trips exact */
|
||||
#define FMG_TUNE_D(v) (((uint32_t)(v) * 200u + 127u) / 254u)
|
||||
#define FMG_TUNE_B(d) (((uint32_t)(d) * 127u + 50u) / 100u)
|
||||
@@ -219,8 +237,11 @@ static void fmg_turn(uint32_t pg, uint32_t i, int32_t s, uint32_t role)
|
||||
}
|
||||
case FK_GLB: { /* a global (reverb decay, delay tempo, chorus rate, drive tone) */
|
||||
const param_desc_t *d = &GP[f->a];
|
||||
if (f->a == G_DRREV && song.g[G_DTIME] == 7) /* A-SYNC's TIME: the ARP RATE's note values, in its order */
|
||||
d = &TP[P_ARATE];
|
||||
if (f->a == G_DRREV && song.g[G_DTIME] == 7) { /* A-SYNC's TIME: the ARP RATE's note values that fit the line */
|
||||
song.g[f->a] = (int16_t)async_turn(song.g[f->a], fmg_acc(role, s, 0));
|
||||
fmg_gdirty = 1;
|
||||
break;
|
||||
}
|
||||
song.g[f->a] = (int16_t)param_turn(d, song.g[f->a], fmg_acc(role, s, d->fmt == F_ENUM ? 0 : d->max - d->min));
|
||||
fmg_gdirty = 1;
|
||||
break;
|
||||
|
||||
@@ -939,6 +939,18 @@ int main(int argc, char **argv)
|
||||
if (delay_samples() != div_samples(0)) { printf("A-SYNC: 1/4 is the tempo's quarter (%u)\n", delay_samples()); return 1; }
|
||||
song.g[G_DRREV] = 2;
|
||||
if (delay_samples() != div_samples(2)) { printf("A-SYNC: 1/16\n"); return 1; }
|
||||
song.g[G_DRREV] = 7; /* 1/1: longer than the line at a slow tempo: silent, the others play */
|
||||
if (dly_fits() != (div_samples(7) < DLY_LEN)) { printf("A-SYNC: the line's fit\n"); return 1; }
|
||||
song.g[G_DRREV] = 0;
|
||||
if (!dly_fits()) { printf("A-SYNC: 1/4 fits\n"); return 1; }
|
||||
{ /* the knob shows only the values that fit: at 60 BPM (quarter 1 s) 1/2 and longer do not fit */
|
||||
int16_t b0 = song.g[G_BPM]; uint8_t c0 = song.g[G_CLOCK];
|
||||
song.g[G_BPM] = 60; song.g[G_CLOCK] = 0;
|
||||
if (dly_div_fits(6) || !dly_div_fits(0) || !dly_div_fits(5)) { printf("A-SYNC: the fit at 60 BPM\n"); return 1; }
|
||||
if (async_turn(0, -1) != 0 || async_turn(0, -3) != 0) { printf("A-SYNC: 1/2 shown at 60 BPM (%d)\n", async_turn(0, -1)); return 1; }
|
||||
if (async_turn(0, 1) != 1 || async_turn(1, 1) != 4) { printf("A-SYNC: the next fitting value\n"); return 1; }
|
||||
song.g[G_BPM] = b0; song.g[G_CLOCK] = c0;
|
||||
}
|
||||
song.g[G_DTIME] = (int16_t)sv; song.g[G_DRREV] = (int16_t)sr;
|
||||
}
|
||||
{ /* a type's names: the five reverbs, eight delays, three choruses */
|
||||
|
||||
Reference in new issue
Block a user