diff --git a/firmware/src/ui_layer.c b/firmware/src/ui_layer.c index ea91ec3f..7986303e 100644 --- a/firmware/src/ui_layer.c +++ b/firmware/src/ui_layer.c @@ -1246,6 +1246,11 @@ static void pk_load(void) /* the slot played, from for (s = 0; s < PK_KEYS; s++) if ((pk.e[s] & 31u) > PK_N || (pk.e[s] > 31u && (pk.e[s] & 31u) != PK_MOD + 1u)) pk.e[s] = 0; /* (unknown: the * map's own; bit 5 a PARAM key's HOW only) */ + else if (pk.e[s] && pk.e[s] <= PF_R32 + 1u && (pk.o[s] & 0x20u)) + pk.o[s] &= (uint8_t)~0x30u; /* (V10.8.86, the owner) a REPEAT key's QUANT plays as HOLD: REPEAT + * starts on the beat itself (perform.c perf_q); QUANT's wait + * (pk_step, the block after the beat) put it a beat late. The + * slot keeps QUANT (the editor shows it) */ pk.qpend = pk.exd = pk.exs = 0; memset(pk.mt, 0, sizeof pk.mt); pk.mod = pk.mon = pk.edit = pk.pkey = 0; diff --git a/tests/macro_mx_test.c b/tests/macro_mx_test.c index 6b5cae3c..53045083 100644 --- a/tests/macro_mx_test.c +++ b/tests/macro_mx_test.c @@ -107,6 +107,39 @@ int main(void) bad += check("PUNCH-IN EDITOR: OCT+ on FX > PUNCH IN opens, a key + KNOB 1 / 2 its effect and how, OCT+ saves, OCT- leaves; LATCH, QUANT play so", ok); memset(&favorites.factory[0][5], 0, 27); memset(&favorites.factory[2][5], 0, 27); pk.magic = 0; frame(); } + { /* (V10.8.86, the owner) a REPEAT key set to QUANT in the editor starts on the same beat as a plain one (HOLD): + * the first beat after the press, QUANT adding nothing (it waited for the beat, then REPEAT for the next) */ + static int32_t o[2 * CTL]; + uint32_t s0 = key_at(0, 0), m, b, P, at[2] = {0, 0}, pr[2] = {0, 0}; + ok = 1; + for (m = 0; m < 2u; m++) { + sine_song(); + memset(&favorites.factory[0][5], 0, 27); memset(&favorites.factory[2][5], 0, 27); + memset(&favorites.factory[7][5], 0, 27); + favorites.factory[6][18] = 0; + favorites.factory[0][5] = PF_R16 + 1u; /* (slot A, F3: RPT 1/16, HOLD or QUANT) */ + favorites.factory[2][5] = (uint8_t)(m ? 2u << 4 : 0u); + pk.magic = 0; frame(); + transport_req = 1; + btn_down(B_FX); frames(480); + for (b = 0; b < 500u + 37u * m; b++) mix_block(o, CTL); /* (the transport running: mid-beat, not the same + * place twice) */ + P = div_samples(2); + key_down(s0); + for (b = 0; b < 1000u && !(perf_act & PF_BIT(PF_R16)); b++) { + mix_block(o, CTL); /* (clk_pos, clk_n: this block's start) */ + if (!b) pr[m] = clk_n * P + clk_pos; /* (the block the key is seen in) */ + if (perf_act & PF_BIT(PF_R16)) at[m] = clk_n * P + clk_pos + pf.split; + } + ok &= at[m] && !(at[m] % (4u * P)) && at[m] > pr[m] && at[m] - pr[m] <= 4u * P; + key_up(s0); frames(32); btn_up(B_FX); frames(64); + transport_req = 2; frames(8); + } + if (!ok) printf(" quant: HOLD pressed at %u, started %u; QUANT pressed at %u, started %u (a beat %u)\n", pr[0], at[0], + pr[1], at[1], 4u * P); + bad += check("PUNCH-IN EDITOR: a REPEAT key on QUANT starts on the first beat after the press, as one on HOLD", ok); + memset(&favorites.factory[0][5], 0, 27); memset(&favorites.factory[2][5], 0, 27); pk.magic = 0; frame(); + } { /* (V10.7.65) MOD: a key moves its macro (TARGET M2, RAMP UP over a beat) while held, as it was when let go; * SELECT in the editor picks the slot, OCT+ saves and plays it */ uint32_t s0 = key_at(0, 0), mv, mx = 0, k; diff --git a/tools/audio_map.txt b/tools/audio_map.txt index de9977f2..d0aaebfe 100644 --- a/tools/audio_map.txt +++ b/tools/audio_map.txt @@ -1329,7 +1329,7 @@ phys_gone_render 2 text * pitch_inc 36 text pk_amt 6 text pk_fill 128 text ux_mix -pk_load 162 text memcpy memset pk_row +pk_load 190 text memcpy memset pk_row pk_name 146 text str_cpy str_nth pk_per 46 text pk_press 150 text * diff --git a/tools/build.py b/tools/build.py index 99a560c3..493ff7b5 100644 --- a/tools/build.py +++ b/tools/build.py @@ -421,7 +421,8 @@ def late_fns(): "scr_rows", "vx_swarm", "gen_make", "bt_hw_status", "gen_radio", "gen_tick", "gen_draw_sig", "bt_get", "hold_banner", "tl_do", "tl_stretch", "tl_repeat", "tl_motion_map", "seq_overlay", "tl_nudge", "nudge_key", "home_life", "up_value", "sel_poll", "tl_shape", "song_save_as", "undo_ui", "section_store", "param_format", - "wv_span", "wv_span_add"} # (V10.8.52) the save confirm and its undo # (V10.8.49) SEQ TOOLS STRETCH SQUEEZE REPEAT # (V10.8.39) GEN's radio: UI, past the tables # (V10.8.26) the screen mirror's row check: past the tables + "wv_span", "wv_span_add", + "pk_load"} # (V10.8.86) a REPEAT key's QUANT played as HOLD: its gap before perf_slot overflowed # (V10.8.52) the save confirm and its undo # (V10.8.49) SEQ TOOLS STRETCH SQUEEZE REPEAT # (V10.8.39) GEN's radio: UI, past the tables # (V10.8.26) the screen mirror's row check: past the tables for f in LATE_SRC: names |= set(re.findall(r"^static [^;=()]*?\b(\w+)\((?![^)]*\)\s*;)", (FW / "src" / f).read_text(), flags=re.M)) return names