WIP 0.9.17: DRUM-X OCT repeats half again; ARP NOTES/SEQ/SCALE one note a lap; COMP's LAP

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:51:17 +00:00
1 parent 03a31f873b
commit 1eb74440b1
6 files changed
+103 -88

No files matched your search

+7 -5
View File
@@ -98,16 +98,18 @@ static uint32_t drum_gm_ix(uint32_t note) { return (note >= 35u && note <= 81u ?
/* (JIANT 0.8.5) the octaves of the kit. OCT 0, where the keys play the GM map (key 7 the kick, 36), is the kit as it
* always was. The other octaves play the same sounds on the same keys (drum_keys: OCT no longer moves the notes).
* Above, repeated in time while held (seq.c dxo_tick; 0.9.13: half as fast, x2 already too fast to play): OCT +1 the
* hit once a step (a roll at the step rate, a hit recorded on every step entered while held), +2 x2 a step, +3 x4;
* recorded as the hit and its lane's mode (none, x2, x4; seq.c rec_lmode). Below, each hit with a
* Above, repeated in time while held (seq.c dxo_tick; 0.9.13: half as fast, x2 already too fast to play; 0.9.17: half
* again): OCT +1 the hit every other step (a hit recorded on every other step entered while held), +2 once a step (a
* roll at the step rate, a hit recorded on every step entered), +3 x2 a step; recorded as the hit and its lane's mode
* (none, none, x2; seq.c rec_lmode). Below, each hit with a
* TOUCH (drum_lane_t.dm; the step's TOUCH component, core.h CP_TOUCH, when recorded): OCT -1 SHORT (half the decay),
* -2 GHOST (short, darker, at ~45 % of its level: a ghost note), -3 FLAM (a soft grace hit, then the hit itself
* DXO_FLAM later, ~20 ms whatever the tempo). MIDI keeps the GM map on 35..81, as ever; the notes around it, which
* played their octave of 36..47 plain, are those octaves' bands: 23..34 -1, 11..22 -2, 0..10 -3, 82..93 +1, 94..105
* +2, 106..127 +3, each by its pitch class (84 the kick x2, 24 the kick SHORT). dx_in_tch: a live hit's TOUCH,
* track_t.dtch: a step's */
static const uint8_t DXO_RAT[4] = {1, 1, 2, 4}; /* OCT 0 +1 +2 +3: hits a step (0.9.13: was 1 2 4 8) */
static const uint8_t DXO_RAT[4] = {1, 1, 1, 2}; /* OCT 0 +1 +2 +3: hits a step (0.9.13: was 1 2 4 8; 0.9.17:
* was 1 1 2 4, +1 now every other step: seq.c dxo_t.half) */
static const int8_t DXO_DEC[4] = {0, -14, -14, 0}; /* TOUCH 0..3: on DECAY (14: half the decay time, dx_tau) */
static const int8_t DXO_TON[4] = {0, 0, -24, 0}; /* .. on TONE (COLOR: the lane's filter, its drive) */
static const uint8_t DXO_VEL[4] = {128, 128, 58, 58}; /* .. on the velocity, /128 (FLAM: its grace hit's) */
@@ -136,7 +138,7 @@ static uint32_t drum_oct_note(uint32_t note, int32_t o)
}
static const char *drum_oct_name(int32_t o) /* what OCT does on a DRUM track (ui_input.c) */
{
static const char *const N[7] = {"FLAM", "GHOST", "SHORT", "DRUM-X KIT", "REPEAT", "RATCHET x2", "RATCHET x4"};
static const char *const N[7] = {"FLAM", "GHOST", "SHORT", "DRUM-X KIT", "REPEAT 1/2", "REPEAT", "RATCHET x2"};
return N[clamp(o, -3, 3) + 3];
}
+18 -12
View File
@@ -831,7 +831,8 @@ static void input_off(track_t *t, uint32_t note)
/* ------------------------------------------- (0.8.5) the kit's octaves --- */
/* A DRUM track's note in another octave than the kit's (eng_drum.c DXO_*): a key at OCT +-n (kb_oct), a MIDI note of a
* band around the GM map (drum_oct_of). Below: the hit with TOUCH n (dx_in_tch on its note-on: SHORT GHOST FLAM).
* Above: the hit, then again once / x2 / x4 a step while held (dxo_tick; 0.9.13, was x2 x4 x8): playing, on the grid the sequencer's lane
* Above: the hit, then again every other step / once / x2 a step while held (dxo_tick; 0.9.13, was x2 x4 x8; 0.9.17,
* was once x2 x4): playing, on the grid the sequencer's lane
* ratchets use (a part every step / n from each step's start, swung as the steps are: seq_lane_rat), stopped, every
* step / n from the press. Recording, playing (rec_on), the step it goes into gets the hit and its lane's mode
* (rec_lmode: that lane only); every step entered while it is held too, before it plays (dxo_rec_hold: the sequencer
@@ -846,6 +847,8 @@ typedef struct {
uint8_t note, vel, r, part; /* the hit, its hits a step, the part struck last (255 none) */
uint8_t quiet, rec; /* a step (+ 1) it is silent in (the sequencer plays it); the
* step (+ 1) its press was recorded into */
uint8_t half, ph; /* (0.9.17) OCT +1: every other step; ph the steps since the
* press, odd: none */
uint32_t cnt; /* stopped: samples since its last hit */
} dxo_t;
static dxo_t dxo[NPART][DXO_N];
@@ -885,6 +888,8 @@ static void dxo_on(track_t *t, uint32_t note, int32_t o, uint32_t vel, uint32_t
e->note = (uint8_t)note;
e->vel = (uint8_t)vel;
e->r = dx_in_rat;
e->half = o == 1;
e->ph = 0;
e->cnt = 0;
e->idx = t->seq_idx;
e->part = song.playing && t->seq_pos < 0x7FFFFFFFu ? (uint8_t)dxo_part(t, e->r) : 255u;
@@ -926,7 +931,7 @@ static __attribute__((noinline)) void dxo_rec_hold(track_t *t, uint32_t idx)
e->quiet = (uint8_t)(idx + 1u);
continue;
}
if (!rec_on(t) || !drum_track(t))
if (!rec_on(t) || !drum_track(t) || (e->half && !e->ph)) /* (0.9.17: OCT +1, every other step) */
continue;
if (!bak) {
dxo_bak[ti] = t->step[src];
@@ -953,7 +958,7 @@ static __attribute__((noinline)) void dxo_tick(track_t *t, uint32_t n)
dxo_t *e = &dxo[ti][k];
uint32_t r = e->r ? e->r : 1u, part;
if (!song.playing || t->seq_pos >= 0x7FFFFFFFu) { /* stopped: from the press */
uint32_t per = div_samples((uint32_t)t->p[P_SDIV]) / r;
uint32_t per = div_samples((uint32_t)t->p[P_SDIV]) / r << e->half;
e->part = 255u;
e->idx = 0xFFFFu;
e->cnt += n;
@@ -970,6 +975,7 @@ static __attribute__((noinline)) void dxo_tick(track_t *t, uint32_t n)
if (t->seq_idx != e->idx) {
e->idx = t->seq_idx;
e->part = 255u;
e->ph ^= 1u;
}
if (e->quiet == t->seq_idx + 1u) {
e->part = (uint8_t)part;
@@ -977,7 +983,8 @@ static __attribute__((noinline)) void dxo_tick(track_t *t, uint32_t n)
}
if (part != e->part) {
e->part = (uint8_t)part;
dxo_hit(t, e);
if (!(e->half & e->ph))
dxo_hit(t, e);
}
}
}
@@ -1359,11 +1366,12 @@ static const step_t *comp_lane(track_t *t, const step_t *s)
t->cv_on = 1;
return &t->cvs;
}
/* (0.9.17) an ARP component walks its notes a lap at a time: the step plays one, the next the next time the pattern
* comes round (seq_step: t->loops, its ORDER), held over the TIEs after it as a plain note (no RATE: was its notes
* in the step, over the TIEs) */
static const step_t *arp_owner(const track_t *t, const step_t *s)
{
const step_t *o = s;
if (s->time == ST_TIE && t->arp_from)
o = t->arp_from == CV_IDX ? &t->cva : &seq_steps(t)[(t->arp_from - 1u) % NSTEP];
return o->time == ST_NOTE && (o->n || (o->hit && trk_kit(t))) && cp_get(t, o, CP_ARPN, CP_ARPS, 0) ? o : 0; /* (0.6.82:
* a kit's hits too) */
}
@@ -1375,10 +1383,8 @@ static uint32_t step_parts(const track_t *t, const step_t *s, uint32_t *div)
const step_t *o = arp_owner(t, s);
uint32_t h, d;
uint8_t a;
if (o) {
cp_get(t, o, CP_ARPN, CP_ARPS, &a);
return *div = CP_RATES[CP_RATE(a) % CP_NRATE];
}
if (o) /* (0.9.17: one note a lap, not RATE) */
return *div = 1u;
h = s->time == ST_NOTE && CP_HAS(t, s, CP_ECHO, &a) ? 2u + (a & ~CP_ECHO_EVEN) % 7u : step_ratchet(s);
if ((d = live_rat(t)) > h) /* (0.9.11) LIVE RATCH: every step at least that many parts */
return *div = d;
@@ -1753,7 +1759,7 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint
}
}
for (i = 0; i < (arp ? 1u : s->n) && i < 4u && !(kit && arp); i++) {
uint32_t x = arp ? cp_arp_note(t, arp, ac, aa, t->arp_k++) : s->note[i];
uint32_t x = arp ? cp_arp_note(t, arp, ac, aa, t->loops) : s->note[i]; /* (0.9.17: this lap's) */
x = (uint32_t)clamp((int32_t)x + up, 0, 127);
if (!kit) { /* (0.6.42) TONAL, RAND, OCT; (0.6.98) WALK, CLIMB */
if (walk)
@@ -1794,7 +1800,7 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint
int32_t dp = 0, deg = 0; /* OCT RAND TONAL and ARP SCALE tune the hits, BEND bends them */
if (arp) {
uint8_t kn[4 + NLANE];
uint32_t c2 = cp_kit_arp(t, arp, ac, aa, t->arp_k++, kn, &deg);
uint32_t c2 = cp_kit_arp(t, arp, ac, aa, t->loops, kn, &deg);
for (i = 0; i < c2 && m < 4u + NLANE; i++) {
nn[m] = kn[i];
vv[m++] = (uint8_t)vel;
+13 -3
View File
@@ -1413,9 +1413,19 @@ static void draw_columns(void)
uint32_t r = CP_WRATES[CP_WRATE(ca) % CP_NWRATE];
fmt_int(val, (int32_t)r);
draw_column(3, "EVERY", val, r == 1u ? "LOOP" : "LOOPS", VAL(3u), -1, ICON_RATE);
} else if (v >= COMP_ARPN && v <= COMP_ARPS && comp_slot() == 0u) { /* (0.6.92) RATE as a note value of the track's DIV */
rate_name(TSEL, CP_RATES[CP_RATE(ca) % CP_NRATE], val);
draw_column(3, "RATE", val, "", VAL(3u), -1, ICON_RATE);
} else if (v >= COMP_ARPN && v <= COMP_ARPS && comp_slot() == 0u) { /* (0.9.17) LAP: the note it plays this
* pass of the pattern (one a lap; was RATE: its notes in the step) */
uint32_t lap = song.playing ? TSEL->loops : 0u, c = CP_ARPN + v - COMP_ARPN;
if (CP_ORD(ca) == 3u) /* (RND: a new one each lap, not known before) */
str_cpy(val, "RND", sizeof val);
else if (drum_track(TSEL)) {
uint8_t kn[4 + NLANE];
int32_t deg;
str_cpy(val, cp_kit_arp(TSEL, cs, c, ca, lap, kn, &deg) ? drum_lane_abbr(TSEL, drum_lane(kn[0])) : "-",
sizeof val);
} else
note_name(val, cp_arp_note(TSEL, cs, c, ca, lap));
draw_column(3, "LAP", val, "", VAL(3u), -1, ICON_RATE);
} else if ((v == COMP_RATCH || v == COMP_ECHO) && comp_slot() == 0u) { /* (0.6.82) the parts' spacing */
if (CT_DIV(cs)) rate_name(TSEL, CT_DIVS[CT_DIV(cs) % CT_NDIV], val); else str_cpy(val, "FIT", sizeof val);
draw_column(3, "RATE", val, "", CT_DIV(cs) ? VAL(3u) : T_DIM, -1, ICON_RATE);
+1 -6
View File
@@ -922,12 +922,7 @@ static void comp_knob(uint32_t slot, int32_t steps)
} else if (v >= COMP_ARPN && v <= COMP_ARPS && slot == 2u) { /* (0.6.92) ORDER x RANGE: one list, a range after another */
int32_t i = clamp((int32_t)(CP_ORD(*ap) * 4u + CP_RNG(*ap)) + d, 0, 15);
*ap = CP_ARG((uint32_t)i / 4u, CP_RATE(*ap), (uint32_t)i % 4u);
} else if (v >= COMP_ARPN && v <= COMP_ARPS && slot == 3u) { /* (0.6.92) RATE: x1 x2 x3 x4 x6 x8 (in the track's time) */
uint32_t i;
for (i = 0; i < CP_NRATE && CP_RATE_ORD[i] != CP_RATE(*ap) % CP_NRATE; i++) {}
i = (uint32_t)clamp((int32_t)i + e, 0, CP_NRATE - 1);
*ap = CP_ARG(CP_ORD(*ap), CP_RATE_ORD[i], CP_RNG(*ap));
}
} /* (0.9.17: an ARP's KNOB 4 shows the lap's note, no RATE) */
}
/* (0.6.85) SEQ > STRETCH: KNOB 1 STRETCH /8 .. /2, x1, x2 .. x8; KNOB 2 REPEAT OFF, x2 .. x8, TO 64; (0.6.92) done as the
* knob turns, always from the sequence as it was before the first turn (its base: the steps, LEN and automation,
+30 -28
View File
@@ -5,7 +5,7 @@
* sequencer, MIDI, project and UI sources (with the stubs of tests/ui_test.c):
* CENTRE OCT 0: the keys' notes and hits as before (key 7 the kick, 36), no ratchet, no TOUCH, a hit bit for bit
* the one a plain note-on renders; recorded: the hit alone.
* UP OCT +1 / +2 / +3: the same sound once / x2 / x4 a step while held (0.9.13; was x2 / x4 / x8), stopped (from the press, a
* UP OCT +1 / +2 / +3: the same sound every other step / once / x2 a step while held (0.9.17; 0.9.13 once / x2 / x4), stopped (from the press, a
* step / n apart) and playing (on the sequencer's RATCH grid); the release ends it.
* DOWN OCT -1 SHORT (half the length, its level), -2 GHOST (short, darker, under 55 % of the level), -3 FLAM (a
* soft grace hit, the hit itself ~20 ms later at its level): measured on the engine's output.
@@ -215,11 +215,12 @@ static int up(void)
{
int bad = 0, ok = 1;
uint32_t at[64], nh, k, per, o;
static const uint8_t R[4] = {1, 1, 2, 4}; /* (0.9.13: half as fast, was 1 2 4 8) */
static const uint8_t R[4] = {2, 1, 2, 4}; /* hits in two steps (0.9.13: half as fast, was 2 4 8 16; 0.9.17: half
* again, was 2 4 8) */
for (o = 1; o <= 3u; o++) {
nh = held_stopped((int32_t)o, 4, at);
per = div_samples((uint32_t)dt->p[P_SDIV]) / R[o];
ok &= nh == 4u * R[o] && dxo_n[3] == 1u;
per = 2u * div_samples((uint32_t)dt->p[P_SDIV]) / R[o];
ok &= nh == 2u * R[o] && dxo_n[3] == 1u;
for (k = 1; k < nh && k < 64u; k++) {
int32_t d = (int32_t)(at[k] - at[0]) - (int32_t)(k * per); /* (in the block holding its sample) */
ok &= d > -(int32_t)CTL && d <= 0;
@@ -231,7 +232,7 @@ static int up(void)
ok &= nh == 0u && !dxo_n[3];
if (!ok) printf("ui: OCT +%u stopped: %u hits in 4 steps\n", o, held_stopped((int32_t)o, 4, at));
}
bad += check("OCT +1 / +2 / +3 stopped: once / x2 / x4 a step from the press, the kick; the release ends it", ok);
bad += check("OCT +1 / +2 / +3 stopped: every other step / once / x2 a step from the press, the kick; the release ends it", ok);
/* playing: on the sequencer's grid (a part every step / n from each step's start) */
ok = 1;
for (o = 1; o <= 3u; o++) {
@@ -247,15 +248,16 @@ static int up(void)
nh = 0;
run_b((step_len(0) * 4u) / CTL - 1u, at, 64, &nh);
key_upk(KICK_KEY);
ok &= nh == 4u * R[o];
for (i = 1; i < nh && i < 64u; i++) { /* hit i: part i % n of step i / n */
uint32_t want = s0 + (i / R[o]) * step_len(0) + (i % R[o]) * (step_len(0) / R[o]);
ok &= nh == 2u * R[o];
for (i = 1; i < nh && i < 64u; i++) { /* hit i: part i % n of step i / n (+1: every other step) */
uint32_t r = R[o] / 2u, want = r ? s0 + (i / r) * step_len(0) + (i % r) * (step_len(0) / r)
: s0 + 2u * i * step_len(0);
int32_t d = (int32_t)at[i] - (int32_t)want;
ok &= d >= 0 && d < (int32_t)CTL;
}
seq_stop();
}
bad += check("OCT +1 / +2 / +3 playing: n hits a step, each on the RATCH grid of the step (to the block)", ok);
bad += check("OCT +1 / +2 / +3 playing: every other step / once / x2 a step, each on the RATCH grid of the step (to the block)", ok);
return bad;
}
@@ -326,7 +328,7 @@ static int rec_up(void)
{
int bad = 0, ok = 1;
uint32_t live[32], back[32], nl = 0, nb = 0, k, s2, loop, o;
static const uint8_t R[4] = {1, 1, 2, 4}; /* (0.9.13: half as fast, was 1 2 4 8) */
static const uint8_t R[4] = {1, 1, 1, 2}; /* the lane's hits a step (0.9.13: was 1 2 4 8; 0.9.17: 1 1 2 4) */
for (o = 1; o <= 3u; o++) {
drum_setup();
song.octave = (int32_t)o;
@@ -349,7 +351,7 @@ static int rec_up(void)
loop += step_len(k);
for (k = 0; k < 16u; k++) {
const step_t *s = &dt->step[k];
int has = k >= 2u && k <= 4u;
int has = k >= 2u && k <= 4u && (o != 1u || k != 3u); /* (+1: every other step) */
ok &= has ? s->time == ST_NOTE && s->hit == 1u << DV_KICK && lm_hits(step_lmode(s, DV_KICK)) == R[o] &&
!s->comp && step_ratchet(s) == 1u && lane_modes_but(s, DV_KICK) == 0u
: s->time != ST_NOTE || (!s->hit && !s->n);
@@ -357,7 +359,7 @@ static int rec_up(void)
nb = 0;
while (!(dt->seq_idx == 5u)) /* the next pass, steps 3..5 */
run_b(1, back, 32, &nb);
ok &= nl == 3u * R[o] && nb == nl;
ok &= nl == (o == 1u ? 2u : 3u * R[o]) && nb == nl;
for (k = 0; k < nl && k < nb && k < 32u; k++) {
int32_t d = (int32_t)(back[k] - loop) - (int32_t)live[k]; /* (the press: a block late, as heard) */
ok &= d >= -(int32_t)CTL && d <= (int32_t)CTL;
@@ -366,10 +368,10 @@ static int rec_up(void)
if (!ok) printf("ui: REC OCT +%u: %u hits live, %u played back\n", o, nl, nb);
seq_stop();
}
bad += check("REC OCT +1 / +2 / +3: the kick and the KICK lane's none / x2 / x4 in each step held (the step x1); played back as heard", ok);
bad += check("REC OCT +1 / +2 / +3: the kick (every other step / each / each) and the KICK lane's none / none / x2 (the step x1); played back as heard", ok);
/* an early release in a step it was held into puts that step back */
drum_setup();
song.octave = 2; /* (x2; 0.9.13: OCT +2) */
song.octave = 3; /* (x2; 0.9.13: OCT +2, 0.9.17: +3) */
song.rec = 1u << 3;
seq_start();
nb = 0;
@@ -386,7 +388,7 @@ static int rec_up(void)
bad += check(" let go early in the next step: that step back as it was (one step recorded)", ok);
/* late in a step: into the next one (the sequencer plays its later parts, the live ones stop) */
drum_setup();
song.octave = 2; /* (x2; 0.9.13: OCT +2) */
song.octave = 3; /* (x2; 0.9.13: OCT +2, 0.9.17: +3) */
song.rec = 1u << 3;
seq_start();
nb = 0;
@@ -523,7 +525,7 @@ static int per_lane(void)
key_dn(KICK_KEY);
run_b(2, 0, 0, &nb);
key_upk(KICK_KEY);
song.octave = 3; /* (x4: 0.9.13 OCT +3, was +2) */
song.octave = 3; /* (x2: 0.9.17 OCT +3, was x4) */
key_dn(KICK_KEY + 6u); /* F#: the closed hat */
run_b(2, 0, 0, &nb);
key_upk(KICK_KEY + 6u);
@@ -536,16 +538,16 @@ static int per_lane(void)
{
const step_t *s = &dt->step[4];
ok = s->hit == (1u << DV_KICK | 1u << DV_HATC | 1u << DV_SNARE) && step_lmode(s, DV_KICK) == LM_NONE &&
step_lmode(s, DV_HATC) == LM_X4 && step_lmode(s, DV_SNARE) == LM_GHOST && step_ratchet(s) == 1u && !s->comp;
step_lmode(s, DV_HATC) == LM_X2 && step_lmode(s, DV_SNARE) == LM_GHOST && step_ratchet(s) == 1u && !s->comp;
}
while (dt->seq_idx != 3u) /* the next pass: step 5 plays them each its own way */
run_b(1, 0, 0, &nb);
memset(cnt, 0, sizeof cnt);
while (dt->seq_idx != 5u)
run_c(1);
ok &= cnt[36] == 1u && cnt[42] == 4u && cnt[38] == 1u && lane(DV_KICK)->dm == 0u && lane(DV_SNARE)->dm == 2u;
ok &= cnt[36] == 1u && cnt[42] == 2u && cnt[38] == 1u && lane(DV_KICK)->dm == 0u && lane(DV_SNARE)->dm == 2u;
seq_stop();
bad += check("REC per sound: kick OCT 0, hat OCT +3, snare OCT -2 on one step: the kick 1, the hat x4, the snare GHOST", ok);
bad += check("REC per sound: kick OCT 0, hat OCT +3, snare OCT -2 on one step: the kick 1, the hat x2, the snare GHOST", ok);
/* the grid: KNOB 3 HIT goes -- ON x2 x4 x8 SHORT GHOST FLAM on the selected lane */
drum_setup();
go_page(GR_ROLL);
@@ -634,7 +636,7 @@ static int midi(void)
now_s = 0;
nb = mev(0x90, UPN[i], 100);
run_b(4u * div_samples((uint32_t)dt->p[P_SDIV]) / CTL - 1u, 0, 0, &nb);
ok &= nb == 4u * R[i] && dxo_n[3] == 1u;
ok &= nb == 2u * R[i] && dxo_n[3] == 1u; /* (R: in two steps, 0.9.17) */
mev(0x80, UPN[i], 0);
nb = 0;
run_b(div_samples((uint32_t)dt->p[P_SDIV]) * 2u / CTL, 0, 0, &nb);
@@ -646,7 +648,7 @@ static int midi(void)
ok &= nb == 1u && lane(DV_KICK)->dm == i + 1u;
}
}
bad += check("MIDI 84 / 96 / 108: the kick once a step / x2 / x4 while held; 24 / 12 / 0: the kick SHORT / GHOST / FLAM", ok);
bad += check("MIDI 84 / 96 / 108: the kick every other step / once / x2 a step while held; 24 / 12 / 0: the kick SHORT / GHOST / FLAM", ok);
/* MIDI recording */
drum_setup();
song.rec = 1u << 3;
@@ -654,9 +656,9 @@ static int midi(void)
nb = 0;
while (!(dt->seq_idx == 3u && dt->seq_pos < CTL))
run_b(1, 0, 0, &nb);
mev(0x90, 102, 100); /* F#: the closed hat, +2 (x2; 0.9.13: was 90, +1) */
mev(0x90, 114, 100); /* F#: the closed hat, +3 (x2; 0.9.13: 102, +2; was 90, +1) */
run_b(4, 0, 0, &nb);
mev(0x80, 102, 0);
mev(0x80, 114, 0);
while (!(dt->seq_idx == 5u && dt->seq_pos < CTL))
run_b(1, 0, 0, &nb);
mev(0x90, 26, 100); /* D: the snare, -1 */
@@ -666,7 +668,7 @@ static int midi(void)
seq_stop();
ok = dt->step[3].hit == 1u << DV_HATC && step_lmode(&dt->step[3], DV_HATC) == LM_X2 && !dt->step[4].hit &&
dt->step[5].hit == 1u << DV_SNARE && step_lmode(&dt->step[5], DV_SNARE) == LM_SHORT && !dt->step[5].comp;
bad += check("MIDI REC: 102 the closed hat x2, 26 the snare SHORT, each into its step", ok);
bad += check("MIDI REC: 114 the closed hat x2, 26 the snare SHORT, each into its step", ok);
{ /* FUNC round trip */
project_t before, after;
project_store_t packed;
@@ -685,9 +687,9 @@ static int ui_part(void)
drum_setup();
frame();
press(B_OCTUP);
ok = song.octave == 1 && msg_is("REPEAT");
ok = song.octave == 1 && msg_is("REPEAT 1/2");
press(B_OCTUP);
ok &= song.octave == 2 && msg_is("RATCHET x2");
ok &= song.octave == 2 && msg_is("REPEAT");
press(B_OCTDN);
press(B_OCTDN);
press(B_OCTDN);
@@ -698,8 +700,8 @@ static int ui_part(void)
ok &= song.octave == -3 && msg_is("FLAM");
song.octave = 2;
press(B_OCTUP);
ok &= song.octave == 3 && msg_is("RATCHET x4");
bad += check("OCT on a DRUM track: REPEAT, RATCHET x2 / x4, SHORT, GHOST, FLAM", ok);
ok &= song.octave == 3 && msg_is("RATCHET x2");
bad += check("OCT on a DRUM track: REPEAT 1/2, REPEAT, RATCHET x2, SHORT, GHOST, FLAM", ok);
song.octave = 0;
dt->step[2] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK};
dt->step[2].comp = CP_TOUCH;
+34 -34
View File
@@ -377,44 +377,42 @@ static int components(void)
uint32_t n;
track_t *t;
project_store_t st;
/* ARP NOTES: x4 UP over a chord, one octave: the chord's notes in turn, again from the bottom */
/* (0.9.17) an ARP walks its notes a lap at a time (seq.c arp_owner): one note a pass of the pattern, the next the
* next time round, in its ORDER; RATE no longer counts (a one-step loop: a lap a pass) */
t = one_step(1, 0); /* NOTES UP over a chord, one octave */
t->step[0] = (step_t){{60, 64, 67}, 3, ST_NOTE, 0, 100};
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(0u, 4u, 0u); /* (RATE x8 stored: one a lap all the same) */
n = run_notes(t, passes(t, 4), nt, sizeof nt);
bad += check("ARP NOTES UP: one note a lap, 60 | 64 | 67 | 60 over four passes", n == 4u && nt[0] == 60u &&
nt[1] == 64u && nt[2] == 67u && nt[3] == 60u);
t = one_step(1, 0);
t->step[0] = (step_t){{60, 64, 67}, 3, ST_NOTE, 0, 100};
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(0u, 2u, 0u);
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(1u, 1u, 1u); /* DOWN, two octaves */
n = run_notes(t, passes(t, 3), nt, sizeof nt);
bad += check("ARP NOTES DOWN over two octaves, a lap each: 79 | 76 | 72", n == 3u && nt[0] == 79u && nt[1] == 76u &&
nt[2] == 72u);
seq_stop(); /* PLAY from a stop: from its first note again */
seq_start();
n = run_notes(t, passes(t, 1), nt, sizeof nt);
bad += check("ARP NOTES x4 UP: 60 64 67 60 in one step", n == 4u && nt[0] == 60u && nt[1] == 64u && nt[2] == 67u &&
nt[3] == 60u);
t = one_step(1, 0);
t->step[0] = (step_t){{60, 64, 67}, 3, ST_NOTE, 0, 100};
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(1u, 1u, 1u); /* DOWN x3, two octaves */
n = run_notes(t, passes(t, 1), nt, sizeof nt);
bad += check("ARP NOTES x3 DOWN over two octaves: 79 76 72", n == 3u && nt[0] == 79u && nt[1] == 76u && nt[2] == 72u);
t = one_step(1, 0); /* over the TIE after it: the arpeggio goes on */
bad += check(" PLAY again: the first note (79), as the other components' loops", n == 1u && nt[0] == 79u);
t = one_step(1, 0); /* a TIE after it: the lap's note held over it, no new one */
t->p[P_SLEN] = 2;
t->step[0] = (step_t){{60, 64, 67}, 3, ST_NOTE, 0, 100};
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(0u, 0u, 0u); /* x2 */
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(0u, 0u, 0u);
t->step[1] = (step_t){{0}, 0, ST_TIE, 0, 0};
seq_start();
n = run_notes(t, 2u * step_len(t, 0) / CTL - 1u, nt, sizeof nt);
bad += check("ARP x2 over a TIE: 60 64 | 67 60 (the TIE goes on with it)", n == 4u && nt[0] == 60u && nt[1] == 64u &&
nt[2] == 67u && nt[3] == 60u);
n = run_notes(t, 2u * step_len(t, 0) / CTL - 2u, nt, sizeof nt);
ok = n == 1u && nt[0] == 60u && t->seq_n == 1u;
n = run_notes(t, 2u * step_len(t, 0) / CTL, nt, sizeof nt);
bad += check("ARP over a TIE: the lap's note held through it (60, then 64 the next lap)", ok && n == 1u && nt[0] == 64u);
t = one_step(1, 0); /* SCALE: C major up from the step's note, 3 degrees */
t->p[P_ROOT] = 0; t->p[P_SCALE] = 1;
t->step[0] = (step_t){{60}, 1, ST_NOTE, 0, 100};
t->step[0].comp = CP_ARPS; t->step[0].carg = CP_ARG(0u, 2u, 0u);
n = run_notes(t, passes(t, 1), nt, sizeof nt);
bad += check("ARP SCALE x4 UP, 3 degrees of C major: 60 62 64 60", n == 4u && nt[0] == 60u && nt[1] == 62u &&
nt[2] == 64u && nt[3] == 60u);
t = one_step(1, 0); /* SEQ: every note of the pattern */
t->p[P_SLEN] = 2;
t->step[0] = (step_t){{60}, 1, ST_NOTE, 0, 100};
t->step[0].comp = CP_ARPQ; t->step[0].carg = CP_ARG(0u, 0u, 0u);
t->step[1] = (step_t){{67}, 1, ST_NOTE, 0, 100};
seq_start();
n = run_notes(t, 2u * step_len(t, 0) / CTL - 1u, nt, sizeof nt);
bad += check("ARP SEQ x2: the pattern's notes (60 67), then the next step's own 67", n == 3u && nt[0] == 60u &&
nt[1] == 67u && nt[2] == 67u);
/* (0.6.82) SEQ: the pattern's melody in its order (67 60 64), NOTES would sort it */
n = run_notes(t, passes(t, 4), nt, sizeof nt);
bad += check("ARP SCALE UP, 3 degrees of C major, a lap each: 60 | 62 | 64 | 60", n == 4u && nt[0] == 60u &&
nt[1] == 62u && nt[2] == 64u && nt[3] == 60u);
/* SEQ: the pattern's melody in its order (67 60 64; NOTES would sort it), a note of it a lap */
t = one_step(1, 0);
t->p[P_SLEN] = 3;
t->step[0] = (step_t){{67}, 1, ST_NOTE, 0, 100};
@@ -422,9 +420,10 @@ static int components(void)
t->step[1] = (step_t){{60}, 1, ST_NOTE, 0, 100};
t->step[2] = (step_t){{64}, 1, ST_NOTE, 0, 100};
seq_start();
n = run_notes(t, step_len(t, 0) / CTL - 1u, nt, sizeof nt);
bad += check("ARP SEQ x4: the pattern's melody as it plays: 67 60 64 67", n == 4u && nt[0] == 67u && nt[1] == 60u &&
nt[2] == 64u && nt[3] == 67u);
n = run_notes(t, 4u * 3u * step_len(t, 0) / CTL - 1u, nt, sizeof nt);
bad += check("ARP SEQ: the melody a lap at a time: 67 60 64 | 60 60 64 | 64 60 64 | 67 60 64", n == 12u &&
nt[0] == 67u && nt[1] == 60u && nt[2] == 64u && nt[3] == 60u && nt[6] == 64u && nt[9] == 67u &&
nt[10] == 60u && nt[11] == 64u);
/* TRIG: the loops it plays on (a one-step loop: a loop a pass) */
{
static const uint8_t COND[4] = {0, 1, 10, 11}, WANT[4] = {2, 2, 1, 3}; /* 1:2 2:2 FIRST NOT FIRST, 4 loops */
@@ -459,8 +458,9 @@ static int components(void)
ok = str_eq(cur_page()->title, "COMP") && comp_view() == COMP_OFF;
turn(EN_K2, 3); /* OFF CHANCE RATCH NOTES */
ok &= t->step[0].comp == CP_ARPN && t->step[0].carg == CP_ARG(0u, 2u, 0u);
turn(EN_K3, 4); turn(EN_K3, 1); turn(EN_K4, 1); /* (0.6.92) KNOB 3 ORDER x RANGE: DOWN over two octaves; KNOB 4 RATE x6 */
ok &= CP_ORD(t->step[0].carg) == 1u && CP_RATE(t->step[0].carg) == 3u && CP_RNG(t->step[0].carg) == 1u;
turn(EN_K3, 4); turn(EN_K3, 1); turn(EN_K4, 1); /* (0.6.92) KNOB 3 ORDER x RANGE: DOWN over two octaves; (0.9.17)
* KNOB 4 the lap's note, shown: nothing to turn (RATE kept) */
ok &= CP_ORD(t->step[0].carg) == 1u && CP_RATE(t->step[0].carg) == 2u && CP_RNG(t->step[0].carg) == 1u;
turn(EN_K2, 2); /* SCALE: the values kept */
ok &= t->step[0].comp == CP_ARPS && CP_ORD(t->step[0].carg) == 1u;
turn(EN_K2, 1); turn(EN_K3, 4); turn(EN_K3, 1); /* TRIG 1:2 .. 2:4 (4 detents a pass at most) */
@@ -784,7 +784,7 @@ static int components3(void)
ok &= proj_import(&proj_scratch, &st, sizeof st) && !project_restore_runtime(&proj_scratch);
ok &= t->step[0].comp2 == CP_REV && t->step[0].carg2 == 2u && t->step[0].cwhen == 0xBu && t->step[0].ctime == 0x5Cu;
bad += check("a project keeps the second component, WHEN, DIV and LEN (FUNC round trip)", ok);
/* on a drum kit: OCT +1 tunes the hit an octave up; ARP NOTES x4 over BD + SD plays them in turn; BEND bends it */
/* on a drum kit: OCT +1 tunes the hit an octave up; ARP NOTES over BD + SD plays them in turn, a lap each; BEND bends it */
{
uint32_t kick = DRUM_LANE_NOTE[DV_KICK], snr = DRUM_LANE_NOTE[DV_SNARE];
int32_t base = DRUM_GM[drum_gm_ix(kick)][1];
@@ -803,7 +803,7 @@ static int components3(void)
t->step[0] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK | 1u << DV_SNARE, 0};
t->step[0].comp = CP_ARPN; t->step[0].carg = CP_ARG(0u, 2u, 0u);
seq_start();
n = run_notes(t, step_len(t, 0) / CTL - 1u, nt, sizeof nt);
n = run_notes(t, passes(t, 4), nt, sizeof nt); /* (0.9.17: a sound a lap) */
ok &= n == 4u && nt[0] == kick && nt[1] == snr && nt[2] == kick && nt[3] == snr;
bad += check("on a drum kit: OCT tunes the hit, BEND bends it, ARP NOTES plays its sounds in turn", ok);
}