mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
- byte-morph: lofi_byte_render byte for byte V10.8.77's (the FM-1's code identical, the host's too): lofi_render alone tests MORPH (a load and a branch a block); up, lofi_bmr hands the render a shadow of the track's FILTER / EDIT values (127: ALGO = B; between: ALGO 62, no start, VAR nor BEND) and lofi_bmorph (lofi_byte's 62, as USER's 63: t and a) makes A's and B's own times from the window's (start, VAR, BEND: A exactly as at MORPH 0, B as at 127), this core's lofi_mx (.pool) holding them. A factory sound's ALGO B B01; a project of before V10.7.36 (q->phys) clears a MATH track's EDIT > MORPH slot (a chip wave's morph of before V10.6e, set before WAVE BYTE: BYTE's MORPH now). No MOD route to BYTE's MORPH (a destination of its own: room and the matrix's tables; NRPN 71 and AUTO reach it). - The RAMP's tester: ui.c grid_hit cleared a REST step to add a hit (step_clear): a RAMP put on an empty DRUM step vanished when the step was held to lock it. Its notes and hits only now; components and CHANCE kept (tests/ramp_test.c: the FM-1's way and grid_hit itself). - Flash: trk_slot() for 12 more UI sites (lyrics, track colours, the latch, GEN, user presets), WHEEL's drw_part = trk_slot (the same function), lofi_bmorph one loop. Image 584272 B of 584336 (64 B free), BT 73660 (was 73692), RAM .data+.bss 98120 (unchanged), .pool +16 (lofi_mx). audio.c untouched; layout recorded again (REPIN=keep). - felucca.c: V10.8.78 and its note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
358 lines
21 KiB
C
358 lines
21 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) */
|
|
/* (V10.6v) the step component RAMP (core.h CV_RAMP_*, seq.c ramp_run; JUMP's code): the step's LOCK glides there from the
|
|
* knob's value (KNOB) or the other end (OPP) along its CURVE over its LENGTH (steps or bars), on the real sequencer,
|
|
* motion, project and UI sources (the stubs of tests/ui_test.c):
|
|
* the target reached at the end, then the knob's value back (gliding, RAMP_BACK); no restart on the next passes when it
|
|
* is longer than the pattern, a restart each pass when shorter; a STOP puts the knob's value back; no lock: nothing;
|
|
* an engine's parameter (ANALOG's CUT); the curves (monotonic but ZIGZAG, 0 to 1); a project of before with JUMPs loads
|
|
* (a VALUE no RAMP can mean: none; legacy CP_JUMP / CP_REV: none; the global lane's: none); SEQ > COMP's knobs and cards.
|
|
* cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/ramp_test.c -lm -o build/ramp
|
|
* (its demo: tests/swarm_test.c SWARM_WAV) */
|
|
#define UI_TEST_NO_MAIN 1
|
|
#include "ui_test.c"
|
|
|
|
static int rbad;
|
|
static project_store_t st;
|
|
static void rcheck(const char *what, int ok)
|
|
{
|
|
printf("ramp: %-86s %s\n", what, ok ? "ok" : "FAIL");
|
|
rbad += !ok;
|
|
}
|
|
/* track 1: ANALOG, len steps of 1/16 (a note each), C major, no swing; CUT 40 (the knob); a LOCK of CUT `to` on step 0
|
|
* with a RAMP of VALUE v, LENGTH l (clen) */
|
|
static track_t *rpat(uint32_t len, uint32_t v, uint32_t l, int16_t to, int lock)
|
|
{
|
|
track_t *t;
|
|
uint32_t i;
|
|
ui_power_on();
|
|
t = &trk[0];
|
|
host_preset(t, ENGI_ANALOG, 0);
|
|
track_defaults_steps(t);
|
|
t->p[P_SLEN] = (int16_t)len; t->p[P_SDIV] = 2; t->p[P_SGATE] = 64; t->p[P_SSWING] = 0; song.g[G_SWING] = 0;
|
|
t->p[P_ROOT] = 0; t->p[P_SCALE] = 1;
|
|
t->p[P_E4] = 40;
|
|
for (i = 0; i < len; i++) t->step[i] = (step_t){{(uint8_t)(48 + (i % 4u) * 3u)}, 1, ST_NOTE, 0, 100};
|
|
t->step[0].comp = CO_MAKE(CA_RAMP, CC_ALWAYS); t->step[0].carg = (uint8_t)v; t->step[0].clen[0] = (uint8_t)l;
|
|
motion_clear(t);
|
|
if (lock) motion_set_lock(t, 0, P_E4, to);
|
|
return t;
|
|
}
|
|
static uint32_t rstep(const track_t *t) { return div_samples((uint32_t)t->p[P_SDIV]); }
|
|
/* the value of CUT at the end of each of `steps` steps (into v[]) */
|
|
static void rrun(track_t *t, uint32_t steps, int16_t *v)
|
|
{
|
|
uint32_t s, b, per = rstep(t), done = 0;
|
|
for (s = 0; s < steps; s++) {
|
|
for (b = 0; done + CTL <= (s + 1u) * per; b++, done += CTL)
|
|
seq_tick(t, CTL);
|
|
v[s] = t->p[P_E4];
|
|
}
|
|
}
|
|
static int ramp_tests(void)
|
|
{
|
|
int16_t v[200];
|
|
uint32_t i, c;
|
|
int ok;
|
|
track_t *t;
|
|
{ /* the curves: 0 .. 1, monotonic (all but ZIGZAG) */
|
|
ok = 1;
|
|
for (c = 0; c < CV_RAMP_NC; c++) {
|
|
int32_t p = -1, x, y, back = 0;
|
|
ok &= ramp_curve(c, 0) == 0 && ramp_curve(c, 32768) == 32768;
|
|
for (x = 0; x <= 32768; x += 64) {
|
|
y = ramp_curve(c, x);
|
|
ok &= y >= 0 && y <= 32768;
|
|
if (y < p) back = 1;
|
|
p = y;
|
|
}
|
|
ok &= c == 5u ? back : !back;
|
|
}
|
|
ok &= ramp_curve(1, 8192) < 8192 && ramp_curve(2, 8192) > 8192 && ramp_curve(3, 8192) < 8192 && ramp_curve(3, 24576) > 24576;
|
|
rcheck("curves LIN EXP LOG S STEPS ZIGZAG: 0 to 1; monotonic, ZIGZAG bouncing; EXP slow first, LOG fast, S both", ok);
|
|
}
|
|
{ /* 24 steps (a pass of 16 and a half), LIN, OPP: CUT 0 -> 120, no restart at the second pass, then back to 40;
|
|
* launched again at the third */
|
|
t = rpat(16, 6u, 23, 120, 1);
|
|
seq_start();
|
|
rrun(t, 40, v);
|
|
ok = v[0] <= 8 && v[22] >= 108 && v[23] >= 116;
|
|
for (i = 1; i < 24u; i++) ok &= v[i] >= v[i - 1u];
|
|
ok &= v[16] > v[15] && v[16] > 60; /* (the step again at the second pass: on, not from 0) */
|
|
ok &= v[25] == 40 && v[31] == 40; /* (its end: the knob's value back) */
|
|
ok &= v[32] < 10 && v[39] > 30; /* (pass 3: launched again) */
|
|
printf("ramp: CUT by step:"); for (i = 0; i < 40u; i++) printf(" %d", v[i]); printf("\n");
|
|
rcheck("24 steps LIN from OPP, a pattern of 16: 0 -> 120 rising, no restart at the next pass, the knob's 40, again", ok);
|
|
t = rpat(16, 6u, 31, 120, 1); /* (32 steps: its end the step again, launched again at once) */
|
|
seq_start();
|
|
rrun(t, 70, v);
|
|
ok = v[31] >= 116 && v[32] < 10 && v[48] > 60 && v[63] >= 116 && v[64] < 10;
|
|
rcheck(" 32 steps on 16: no restart at pass 2, its end and the launch of pass 3 together (a riser every 2 passes)", ok);
|
|
}
|
|
{ /* 4 steps (shorter than the pattern of 16), KNOB, EXP: each pass from 40 to 100, back to 40 by step 6 */
|
|
int16_t w[48];
|
|
t = rpat(16, 1u, 3, 100, 1);
|
|
seq_start();
|
|
rrun(t, 48, w);
|
|
ok = w[2] > 40 && w[2] < 100 && w[3] >= 95 && w[5] == 40 && w[15] == 40;
|
|
ok &= w[16 + 2] == w[2] && w[32 + 2] == w[2] && w[16 + 3] == w[3] && w[16 + 6] == 40;
|
|
ok &= w[1] - 40 < (w[2] - w[1]); /* (EXP: slow first) */
|
|
printf("ramp: CUT by step:"); for (i = 0; i < 24u; i++) printf(" %d", w[i]); printf("\n");
|
|
rcheck("4 steps EXP from KNOB, a pattern of 16: 40 -> 100 each pass (restarts), the knob's 40 between", ok);
|
|
}
|
|
{ /* bars: 1 bar (16 steps of 1/16) from KNOB LIN over a pattern of 12 */
|
|
t = rpat(12, CV_RAMP_BARS, 0, 120, 1);
|
|
seq_start();
|
|
rrun(t, 30, v);
|
|
ok = v[7] > 60 && v[7] < 100 && v[12] > v[11] && v[15] >= 116 && v[17] == 40 && v[23] == 40 && v[24] < 50 && v[29] > 60;
|
|
printf("ramp: CUT by step:"); for (i = 0; i < 30u; i++) printf(" %d", v[i]); printf("\n");
|
|
rcheck("LENGTH in bars: 1 bar over a pattern of 12 (no restart at step 12), the target at the bar's end, again at 24", ok);
|
|
}
|
|
{ /* STOP mid-way: the knob's value; no lock: nothing; the track's records off: nothing */
|
|
t = rpat(16, 0, 31, 120, 1);
|
|
seq_start();
|
|
rrun(t, 10, v);
|
|
ok = t->p[P_E4] > 40;
|
|
seq_stop();
|
|
ok &= t->p[P_E4] == 40;
|
|
rrun(t, 4, v); /* (stopped: nothing moves it) */
|
|
ok &= t->p[P_E4] == 40;
|
|
t = rpat(16, 6u, 31, 120, 0);
|
|
seq_start();
|
|
rrun(t, 20, v);
|
|
for (i = 0; i < 20u; i++) ok &= v[i] == 40;
|
|
ok &= rmp[0].id == RAMP_MOD; /* (V10.8.78: MOD's RAMP alone; no slot reads it) */
|
|
rcheck("a STOP puts the knob's value back; a RAMP without a LOCK moves no parameter", ok);
|
|
}
|
|
{ /* the knob's value back without a jump: RAMP_BACK samples of a line */
|
|
int32_t mx = 0, pv;
|
|
uint32_t b;
|
|
t = rpat(16, 0, 1, 127, 1);
|
|
t->p[P_E4] = 0;
|
|
motion_clear(t); motion_set_lock(t, 0, P_E4, 127);
|
|
seq_start();
|
|
pv = 0;
|
|
for (b = 0; b < 4u * rstep(t) / CTL; b++) {
|
|
seq_tick(t, CTL);
|
|
if (b > rstep(t) / CTL) { int32_t d = pv - t->p[P_E4]; mx = d > mx ? d : mx; }
|
|
pv = t->p[P_E4];
|
|
}
|
|
ok = mx > 0 && mx <= 127 * CTL / (int32_t)RAMP_BACK + 2 && t->p[P_E4] == 0;
|
|
printf("ramp: back: at most %d a block\n", mx);
|
|
rcheck("its end: the knob's value back over ~23 ms (a few steps of CUT a block), not a jump", ok);
|
|
}
|
|
{ /* a project of before with JUMPs (RAMP's code): a VALUE no RAMP can mean (REV 64, a step past 32, curve 6/7) none;
|
|
* one that can (a JUMP to step 4: 3, S) a RAMP; legacy CP_JUMP / CP_REV none; the global lane's none */
|
|
step_t ls[NSTEP];
|
|
t = rpat(16, 0, 0, 100, 1);
|
|
t->step[1].comp = CO_MAKE(CA_RAMP, CC_ALWAYS); t->step[1].carg = 64; /* REV */
|
|
t->step[2].comp = CO_MAKE(CA_RAMP, CC_NM); t->step[2].carg = 44; t->step[2].cnm[0] = CNM_MAKE(1u, 2u);
|
|
t->step[3].comp2 = CO_MAKE(CA_RAMP, CC_ALWAYS); t->step[3].carg2 = 3; /* step 4: S from KNOB */
|
|
t->step[4].comp = CO_MAKE(CA_RAMP, CC_ALWAYS); t->step[4].carg = 13;
|
|
t->step[5].comp = CO_MAKE(CA_RAMP, CC_ALWAYS); t->step[5].carg = 32 | 2; /* (a step past 32) */
|
|
glane[3].comp = CO_MAKE(CA_RAMP, CC_ALWAYS); glane[3].val = 5; glane[3].mask = 63; glane[3].nm = CNM_MAKE(1u, 2u);
|
|
project_capture(&proj_scratch);
|
|
ok = proj_pack(&st, &proj_scratch);
|
|
ok &= !proj_import(&proj_scratch, &st, sizeof st) && proj_sl_found == 2; /* (V10.8.51: refused as old, OPEN IN
|
|
* STUDIO: before V10.6v's RAMP; a build that still migrates it converts) */
|
|
comp_migrate(trk[0].step, 16u); /* (the migration itself, GEN's and DICE's: in memory) */
|
|
ok &= !trk[0].step[1].comp && !trk[0].step[2].comp && !trk[0].step[4].comp && !trk[0].step[5].comp;
|
|
ok &= trk[0].step[3].comp2 == CO_MAKE(CA_RAMP, CC_ALWAYS) && trk[0].step[3].carg2 == 3u;
|
|
memset(ls, 0, sizeof ls);
|
|
comp_legacy(&ls[0], 0, CP_JUMP, 2); comp_legacy(&ls[1], 0, CP_REV, 1); comp_legacy(&ls[2], 1, CP_JUMP, 0x80u | 3u);
|
|
comp_migrate(ls, 4);
|
|
ok &= !ls[0].comp && !ls[1].comp && !ls[2].comp2 && ls[0].clen[0] != CL_LEGACY && ls[2].clen[1] != CL_LEGACY;
|
|
seq_start(); rrun(&trk[0], 40, v); seq_stop();
|
|
rcheck("old projects (V10.8.51: refused, OPEN IN STUDIO; migrated in memory): JUMP whose VALUE is no RAMP none (REV, steps 33..64, 12..15), one that is a RAMP; "
|
|
"CP_JUMP / CP_REV none; the global lane's none; it plays", ok);
|
|
}
|
|
{ /* (V10.7.62) its END: HOLD stays at the lock's value past its LENGTH (8 steps of a 16), till the next launch; BOUNCE
|
|
* (8 steps of a 12) goes back down over its LENGTH, not relaunched when the pattern comes round (step 12) */
|
|
t = rpat(16, CV_RAMP_ENDV(1), 7, 100, 1);
|
|
seq_start(); rrun(t, 20, v); seq_stop();
|
|
ok = v[7] >= 98 && v[10] == 100 && v[15] == 100 && v[17] < 70;
|
|
if (!ok) printf(" HOLD: %d %d %d %d\n", v[7], v[10], v[15], v[17]);
|
|
t = rpat(12, CV_RAMP_ENDV(2), 7, 100, 1);
|
|
seq_start(); rrun(t, 24, v); seq_stop();
|
|
ok &= v[7] >= 98 && v[11] >= 64 && v[11] <= 80 && v[12] > 55 && v[12] < v[11] && v[15] <= 45 && v[19] >= 64;
|
|
if (!ok) printf(" PING: %d %d %d %d %d\n", v[7], v[11], v[12], v[15], v[19]);
|
|
rcheck("END: HOLD stays at the lock till the next launch; PING back and forth, not relaunched", ok);
|
|
}
|
|
{ /* SEQ > COMP: KNOB 1 to RAMP (16 steps, "LOCK A PARAM" without a lock), KNOB 2 past 32 steps into bars, KNOB 4
|
|
* FROM + CURVE; the cards */
|
|
uint32_t a;
|
|
t = rpat(16, 0, 0, 100, 0);
|
|
t->step[0].comp = t->step[0].carg = t->step[0].clen[0] = 0;
|
|
go_page(GR_COMP); cursor_set(0); frame();
|
|
for (a = 0; a < 40u && comp_view() != CA_RAMP; a++) turn(EN_K1, 1);
|
|
frame();
|
|
ok = comp_view() == CA_RAMP && t->step[0].clen[0] == 15u && strstr(ui.msg, "LOCK A PARAM OR MOD>RAMP") != 0;
|
|
ok &= !strncmp(ui.col[3], "KNOB|LIN|", 9); /* (V10.8.78: no NO LOCK, MOD's RAMP without one) */
|
|
motion_set_lock(t, 0, P_E4, 100);
|
|
turn(EN_K4, 7); frame(); /* OPP EXP */
|
|
ok &= t->step[0].carg == 7u && !strncmp(ui.col[3], "OPP|EXP|", 8);
|
|
turn(EN_K2, 4); turn(EN_K2, 4); turn(EN_K2, 4); turn(EN_K2, 4); turn(EN_K2, 4); frame(); /* 16 + 20: 4 bars */
|
|
ok &= (t->step[0].carg & CV_RAMP_BARS) && t->step[0].clen[0] == 3u && strstr(ui.col[1], "BAR") != 0 &&
|
|
(t->step[0].carg & ~CV_RAMP_BARS) == 7u;
|
|
turn(EN_K4, 1); frame(); /* OPP LOG: BARS kept */
|
|
ok &= t->step[0].carg == (CV_RAMP_BARS | 8u);
|
|
printf("ramp: cards: [%s] [%s] [%s] [%s]\n", ui.col[0], ui.col[1], ui.col[2], ui.col[3]);
|
|
for (a = 0; a < 20u; a++) turn(EN_K2, -4);
|
|
ok &= !(t->step[0].carg & CV_RAMP_BARS) && t->step[0].clen[0] == 0u;
|
|
rcheck("SEQ > COMP: ACTION RAMP (16 steps; LOCK A PARAM), LENGTH 32 steps then bars, VALUE FROM + CURVE, the cards", ok);
|
|
{ /* every LENGTH in bars and every VALUE, plain and LARGE: the cards whole (as ui_test test_comp_cards) */
|
|
uint32_t sk, lg, l, v, cut = 0;
|
|
for (sk = 0; sk < 1u; sk++) /* (V10.7.23: COLORS, the one skin) */
|
|
for (lg = 0; lg < 2u; lg++)
|
|
for (l = 0; l < 16u; l++)
|
|
for (v = 0; v <= CA_VMAX[CA_RAMP]; v++) { /* (V10.7.62: with its END) */
|
|
if (lg) ui_prefs |= PREF_LARGE; else ui_prefs &= ~PREF_LARGE;
|
|
t->step[0].carg = (uint8_t)(CV_RAMP_BARS | comp_vat(CA_RAMP, v)); t->step[0].clen[0] = (uint8_t)l;
|
|
ut_card_bad = 0; ut_card_txt = 0;
|
|
ui.force = 1; frame();
|
|
if (ut_card_bad && !cut) printf(" cut: LARGE %u bars %u value %u: %s\n", lg, l + 1u, v, ut_card_what);
|
|
cut += ut_card_bad != 0u;
|
|
}
|
|
ui_prefs &= ~PREF_LARGE;
|
|
rcheck(" every LENGTH in bars x every VALUE, plain and LARGE: the cards whole", !cut);
|
|
}
|
|
}
|
|
{ /* (V10.8.78) end to end as on the FM-1: a DRUM track's step 1 (a hit), SEQ > COMP KNOB 1 to RAMP, SEQ > STEP the
|
|
* step's key held + KNOB 1 (a lock of HOME's first knob), PLAY: it glides there over the RAMP's 16 steps */
|
|
uint32_t a, k0, id;
|
|
int16_t base;
|
|
ui_power_on(); song.sel = 3; t = &trk[3];
|
|
track_defaults_steps(t); t->p[P_SLEN] = 16; grid_hit(t, 0, 0, 1);
|
|
go_page(GR_COMP); cursor_set(0); frame();
|
|
for (a = 0; a < 40u && comp_view() != CA_RAMP; a++) turn(EN_K1, 1);
|
|
go_page(GR_ROLL); frame();
|
|
k0 = key_at(0, 0); id = lock_id(0);
|
|
fm1_in.notes |= 1u << k0; host_notes |= 1u << k0; frame();
|
|
turn(EN_K1, 20);
|
|
fm1_in.notes &= ~(1u << k0); frame();
|
|
base = t->p[id];
|
|
seq_start();
|
|
for (i = 0; i < 16u; i++) {
|
|
uint32_t b, per = div_samples((uint32_t)t->p[P_SDIV]);
|
|
for (b = 0; b < per / CTL; b++) seq_tick(t, CTL);
|
|
v[i] = t->p[id];
|
|
}
|
|
seq_stop();
|
|
ok = CO_ACT(t->step[0].comp) == CA_RAMP && motion_lock_count(t) == 1u && v[0] > base && v[15] >= base + 18 &&
|
|
v[7] > v[0] && v[15] > v[7] && t->p[id] == base;
|
|
printf("ramp: the UI's lock (id %u, %d -> %d):", id, base, base + 20); for (i = 0; i < 16u; i++) printf(" %d", v[i]); printf("\n");
|
|
rcheck("the FM-1's way: COMP KNOB 1 RAMP, STEP a step held + KNOB 1 its lock, PLAY: the lock glides there", ok);
|
|
}
|
|
{ /* (V10.8.78, the RAMP's tester) a RAMP put on an EMPTY step of a DRUM track, then the step held + KNOB 1 to lock it:
|
|
* the hit the hold adds keeps the step's components (ui.c grid_hit cleared the whole step: the RAMP vanished) */
|
|
uint32_t a, k0, id;
|
|
ui_power_on(); song.sel = 3; t = &trk[3];
|
|
track_defaults_steps(t); t->p[P_SLEN] = 16;
|
|
go_page(GR_COMP); cursor_set(0); frame();
|
|
for (a = 0; a < 40u && comp_view() != CA_RAMP; a++) turn(EN_K1, 1);
|
|
ok = t->step[0].time != ST_NOTE && CO_ACT(t->step[0].comp) == CA_RAMP;
|
|
go_page(GR_ROLL); frame();
|
|
k0 = key_at(0, 0); id = lock_id(0);
|
|
fm1_in.notes |= 1u << k0; host_notes |= 1u << k0; frame();
|
|
turn(EN_K1, 20);
|
|
fm1_in.notes &= ~(1u << k0); frame();
|
|
ok &= CO_ACT(t->step[0].comp) == CA_RAMP && motion_lock_count(t) == 1u && t->step[0].time == ST_NOTE && t->step[0].hit;
|
|
{ /* grid_hit itself: a REST step with both components and a CHANCE: the hit added, the components and CHANCE kept */
|
|
step_t *s = &t->step[5];
|
|
step_clear(s);
|
|
s->comp = t->step[0].comp; s->carg = 9; s->comp2 = 3; s->carg2 = 4; s->cwhen = 5; s->ctime = 6;
|
|
s->clen[0] = 7; s->clen[1] = 8; s->cnm[0] = 1; s->cnm[1] = 2; s->probability = 50;
|
|
grid_hit(t, 5, 2, 1);
|
|
ok &= s->time == ST_NOTE && s->hit == 4u && s->carg == 9 && s->comp2 == 3 && s->carg2 == 4 && s->cwhen == 5 &&
|
|
s->ctime == 6 && s->clen[0] == 7 && s->clen[1] == 8 && s->cnm[0] == 1 && s->cnm[1] == 2 &&
|
|
s->probability == 50 && s->comp == t->step[0].comp && !s->n;
|
|
}
|
|
printf("ramp: empty step + RAMP, then held + KNOB 1 (id %u): comp %u, locks %u\n", id, CO_ACT(t->step[0].comp),
|
|
motion_lock_count(t));
|
|
rcheck("a RAMP on an empty DRUM step stays when the step is held to lock it (grid_hit keeps the components)", ok);
|
|
}
|
|
{ /* (V10.8.78, the owner) RAMP as a MOD source (mod.c MS_RAMP): a step's RAMP drives the matrix, with or without a
|
|
* lock; nothing routed: as before */
|
|
int32_t sg[40];
|
|
uint32_t a;
|
|
t = rpat(16, 0, 7, 0, 0); /* (LIN from KNOB, 8 steps, no lock) */
|
|
t->p[P_M2SRC] = MS_RAMP; t->p[P_M2DST] = MD_E1 + 4; t->p[P_M2AMT] = 64; /* (slot 2: RAMP -> E5, ANALOG's CUT) */
|
|
seq_start();
|
|
for (i = 0; i < 20u; i++) {
|
|
rrun(t, 1, v);
|
|
sg[i] = mod_tsrc(t, MS_RAMP, 0);
|
|
if (i == 3u) { /* (the matrix moves CUT this block, mod_end puts the knob's back) */
|
|
mod_begin(t); v[30] = t->p[P_E4]; mod_end(t);
|
|
}
|
|
}
|
|
seq_stop();
|
|
ok = sg[0] > 3000 && sg[0] < 5000 && sg[7] >= 32000 && sg[8] == 0 && sg[15] == 0 && sg[16] > sg[0] - 200 && sg[16] < sg[0] + 200;
|
|
for (i = 1; i < 8u; i++) ok &= sg[i] > sg[i - 1u];
|
|
ok &= v[30] > 40 + 50 && t->p[P_E4] == 40 && !motion_lock_count(t) && mod_tsrc(t, MS_RAMP, 0) == 0;
|
|
if (!ok) printf(" mod: %d %d %d %d %d | %d %d\n", sg[0], sg[7], sg[8], sg[15], sg[16], v[30], t->p[P_E4]);
|
|
printf("ramp: MOD RAMP by step:"); for (i = 0; i < 18u; i++) printf(" %d", (int)(sg[i] >> 8)); printf(" (CUT moved: %d)\n", v[30]);
|
|
rcheck("MOD SRC RAMP, no lock: 0 -> 1 over its 8 steps, back to 0, again each pass; CUT moved by the slot; STOP: 0", ok);
|
|
{ /* a lock's glide on its way: a RAMP without a lock on a later step does not cut it (a project of before the
|
|
* same), the matrix's RAMP follows the glide */
|
|
int16_t w[24];
|
|
t = rpat(16, 0, 11, 120, 1);
|
|
seq_start(); rrun(t, 24, w); seq_stop();
|
|
t = rpat(16, 0, 11, 120, 1);
|
|
t->step[4].comp = CO_MAKE(CA_RAMP, CC_ALWAYS); t->step[4].clen[0] = 1;
|
|
seq_start(); rrun(t, 24, v); seq_stop();
|
|
ok = !memcmp(v, w, sizeof w) && v[10] > 100;
|
|
rcheck(" a RAMP without a lock while a lock's glide runs: the glide goes on, the values as before", ok);
|
|
}
|
|
t = rpat(16, 6u | CV_RAMP_ENDV(1), 3, 0, 0); /* (OPP, HOLD, 4 steps) */
|
|
t->p[P_M1SRC] = MS_RAMP; t->p[P_M1DST] = MD_PAN; t->p[P_M1AMT] = -40;
|
|
seq_start();
|
|
for (i = 0; i < 10u; i++) { rrun(t, 1, v); sg[i] = mod_tsrc(t, MS_RAMP, 0); }
|
|
seq_stop();
|
|
ok = sg[0] > 24000 && sg[1] < sg[0] && sg[3] < 600 && sg[4] == 0 && sg[9] == 0;
|
|
t = rpat(16, CV_RAMP_ENDV(1), 3, 0, 0); /* (KNOB, HOLD) */
|
|
t->p[P_M1SRC] = MS_RAMP; t->p[P_M1DST] = MD_PAN; t->p[P_M1AMT] = 40;
|
|
motion_set_enabled(t, 0); /* (AUTOMATION off: its locks off, the matrix's RAMP not) */
|
|
seq_start();
|
|
for (i = 0; i < 10u; i++) { rrun(t, 1, v); sg[i] = mod_tsrc(t, MS_RAMP, 0); }
|
|
seq_stop();
|
|
ok &= sg[3] > 32000 && sg[9] == 32767;
|
|
rcheck(" FROM OPP: 1 -> 0; HOLD: 1 held; AUTOMATION off: the matrix's RAMP still runs", ok);
|
|
{ /* with a lock: the lock glides as before (the same values); MOD's RAMP is the RAMPs without one */
|
|
int16_t w[24];
|
|
t = rpat(16, 1u, 3, 100, 1);
|
|
seq_start(); rrun(t, 24, w); seq_stop();
|
|
t = rpat(16, 1u, 3, 100, 1);
|
|
t->p[P_M1SRC] = MS_RAMP; t->p[P_M1DST] = MD_PAN; t->p[P_M1AMT] = 40;
|
|
seq_start();
|
|
for (i = 0, ok = 1; i < 24u; i++) { rrun(t, 1, v); ok &= v[0] == w[i]; sg[i] = mod_tsrc(t, MS_RAMP, 0); }
|
|
seq_stop();
|
|
if (!ok) printf(" lock+mod: glide differs\n");
|
|
for (i = 0; i < 24u; i++) ok &= sg[i] == 0;
|
|
rcheck(" a step with a lock: the lock's glide the same as before, MOD's RAMP 0 (a RAMP drives one or the other)", ok);
|
|
}
|
|
/* the UI: MOD's SRC to RAMP (KNOB 2), its names; SEQ > COMP: RAMP with no lock, its card FROM + CURVE */
|
|
t = rpat(16, 0, 7, 0, 0);
|
|
t->step[0].comp = t->step[0].carg = t->step[0].clen[0] = 0;
|
|
go_page(GR_MOD); frame();
|
|
turn(EN_K1, 1); frame(); /* (slot 2) */
|
|
for (a = 0; a < 40u && t->p[P_M2SRC] != MS_RAMP; a++) turn(EN_K2, 1);
|
|
turn(EN_K3, 16); turn(EN_K4, 30); frame();
|
|
ok = t->p[P_M2SRC] == MS_RAMP && str_eq(PN_AT(N_MSRC, MS_RAMP), "RAMP") && strstr(ui.col[1], "RAMP") == ui.col[1] + 4 &&
|
|
str_eq(str_nth(MX_SRC_FULL, MS_RAMP), "STEP RAMP") && t->p[P_M2DST] && t->p[P_M2AMT];
|
|
printf("ramp: MOD cards: [%s] [%s] [%s] [%s]\n", ui.col[0], ui.col[1], ui.col[2], ui.col[3]);
|
|
go_page(GR_COMP); cursor_set(0); frame();
|
|
for (a = 0; a < 40u && comp_view() != CA_RAMP; a++) turn(EN_K1, 1);
|
|
frame();
|
|
ok &= comp_view() == CA_RAMP && !strncmp(ui.col[3], "KNOB|LIN|", 9);
|
|
printf("ramp: COMP cards: [%s] [%s] [%s] [%s]\n", ui.col[0], ui.col[1], ui.col[2], ui.col[3]);
|
|
rcheck(" MOD: KNOB 2 SRC to RAMP (named so, STEP RAMP in full); SEQ > COMP: RAMP without a lock, FROM + CURVE", ok);
|
|
}
|
|
return rbad;
|
|
}
|
|
int main(void)
|
|
{
|
|
int r = ramp_tests();
|
|
printf(r ? "ramp: %d FAILED\n" : "ramp: all ok\n", r);
|
|
return r != 0;
|
|
}
|