feat(matrix): remove fist gestures

SC handlers (edge detector, tick, OSCdefs, pose/hands calls) and web
UI (Poings section, sensibilite poing slider, fistprogress indicators)
removed. Python FIST_ENABLE=0 kill-switch was already in effect.
Old .matrix files with fistThresh key load without error (key silently
ignored). Test harness Q section removed from test_global_actions.scd.
This commit is contained in:
L'électron rare
2026-07-02 14:42:43 +02:00
parent c66c4271fa
commit 3199aa326d
5 changed files with 6 additions and 136 deletions
+4 -57
View File
@@ -463,47 +463,7 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd });
};
};
// -- fist hold-to-fire state + edge detector + tick --
~matFistThresh = ~matFistThresh ? 0.15;
~matFistState = ~matFistState ? Array.fill(2, \unknown);
~matFistHeld = ~matFistHeld ? Array.fill(2, nil);
~matFistFired = ~matFistFired ? Array.fill(2, false);
~matFistThreshPush = { ~toscSend !? { ~toscSend.("/matrix/fisthresh", ~matFistThresh) } };
~matFistReloadCurrent = {
~matCurrentName.notNil.if({
~matLoad.(~matCurrentName);
~toscSend !? { ~toscSend.("/matrix/loaded", ~matCurrentName.asString) };
});
};
// fist edge from openness (hysteresis + presence guard). hand 0 = L, 1 = R.
~matFistEdge = { |hand, x, openness|
var present = x > 0.001;
var prev = ~matFistState[hand] ? \unknown;
var cur = present.if({
(openness <= ~matFistThresh).if({ \fist },
{ (openness >= (~matFistThresh + 0.15)).if({ \open }, { prev }) })
}, { \unknown });
((prev != \fist) and: { cur == \fist }).if({
~matFistHeld[hand] = Main.elapsedTime; ~matFistFired[hand] = false;
});
((prev == \fist) and: { cur != \fist }).if({
~matFistHeld[hand] = nil; ~matFistFired[hand] = false;
~toscSend !? { ~toscSend.("/matrix/fistprogress", hand, 0) };
});
~matFistState[hand] = cur;
};
~matFistTick = {
2.do { |hand|
(~matFistHeld[hand].notNil).if({
var prog = (((Main.elapsedTime - ~matFistHeld[hand]) * 1000) / ~matPinchHoldMs).clip(0, 1);
~toscSend !? { ~toscSend.("/matrix/fistprogress", hand, prog) };
((prog >= 1.0) and: { ~matFistFired[hand].not }).if({
~matFistFired[hand] = true;
(hand == 0).if({ ~matFistReloadCurrent.() }, { ~matNextPreset.() });
});
});
};
};
// fist gestures removed 2026-07-02 (user request; FIST_ENABLE=0 at the source)
// push settings to surfaces: transientBars, keepN, keep0..
~matGlobalSettingsPush = {
@@ -829,8 +789,7 @@ OSCdef(\mat_steps_get, { |msg, time, addr|
voicePoses: ~matVoices.collect({ |name| ~matVoicePoses[name] ? [] }),
globalActions: ~matGlobalActions,
globalSettings: ~matGlobalSettings,
pinchHoldMs: ~matPinchHoldMs,
fistThresh: ~matFistThresh
pinchHoldMs: ~matPinchHoldMs
);
File.use(path, "w", { |f| f.write(payload.asCompileString) });
~matSavedNames.add(safe.asSymbol);
@@ -940,7 +899,7 @@ OSCdef(\mat_steps_get, { |msg, time, addr|
~matGlobalSettings[\breakdownKeep] = g[\breakdownKeep].collect({ |v| v.asSymbol }) });
});
~matPinchHoldMs = ((raw.isArray.not) and: { raw[\pinchHoldMs].notNil }).if({ raw[\pinchHoldMs].asFloat.clip(50, 2000) }, { 300 });
~matFistThresh = ((raw.isArray.not) and: { raw[\fistThresh].notNil }).if({ raw[\fistThresh].asFloat.clip(0.05, 0.5) }, { 0.15 });
// fistThresh key accepted from old presets but no longer used (fist gestures removed 2026-07-02)
~lp[\matPlaying].if({ ~matApplyBar.(~lp[\matBar]) });
~matGridPush.();
~matInstrPush.();
@@ -951,7 +910,6 @@ OSCdef(\mat_steps_get, { |msg, time, addr|
~matGlobalActionsPush.();
~matGlobalSettingsPush.();
~matPinchHoldPush.();
~matFistThreshPush.();
("[matrix] loaded " ++ path).postln;
true
}, {
@@ -1189,15 +1147,6 @@ OSCdef(\mat_pinchhold_get, { |msg, time, addr|
~toscTouch !? { ~toscTouch.(addr) };
~matPinchHoldPush.()
}, '/matrix/pinchhold/get');
OSCdef(\mat_fisthresh, { |msg, time, addr|
~toscTouch !? { ~toscTouch.(addr) };
~matFistThresh = (msg[1] ? 0.15).asFloat.clip(0.05, 0.5);
~matFistThreshPush.()
}, '/matrix/fisthresh');
OSCdef(\mat_fisthresh_get, { |msg, time, addr|
~toscTouch !? { ~toscTouch.(addr) };
~matFistThreshPush.()
}, '/matrix/fisthresh/get');
OSCdef(\mat_bpm, { |msg, time, addr|
~toscTouch !? { ~toscTouch.(addr) };
~matSetBpm.((msg[1] ? 120))
@@ -1335,7 +1284,7 @@ OSCdef(\mat_audition, { |msg, time, addr|
~matModValuesRoutine = Routine({ loop { ~matModValuesPush.(); (1/12).wait } }).play(AppClock);
~matPinchRoutine !? { ~matPinchRoutine.stop };
~matPinchRoutine = Routine({ loop { ~matPinchTick.(); ~matFistTick.(); (1/30).wait } }).play(AppClock);
~matPinchRoutine = Routine({ loop { ~matPinchTick.(); (1/30).wait } }).play(AppClock);
// own capture listeners (independent of the pose pipeline's internal dicts)
OSCdef(\mat_mod_hands, { |msg|
@@ -1347,8 +1296,6 @@ OSCdef(\mat_mod_hands, { |msg|
~matModCache[\rOpen] = msg[8] ? 0;
~matModCache[\handSpeed] = ((msg[5] ? 0) max: (msg[9] ? 0));
~matModCache[\handDist] = msg[10] ? 0;
~matFistEdge.(0, msg[2] ? 0, msg[4] ? 0);
~matFistEdge.(1, msg[6] ? 0, msg[8] ? 0);
}, '/pose/hands');
OSCdef(\mat_mod_center, { |msg|
@@ -146,37 +146,7 @@ OSCdef(\mat_pinchhold).func.value(['/matrix/pinchhold', 500]);
(~matPinchHoldMs == 420).not.if({ pass = false; "FAIL: pinchHoldMs not restored".postln });
("rm -f '" ++ (~matDir +/+ "zz_phms_test.matrix") ++ "'").systemCmd;
// -- Q: fist hold-to-fire (engage records, tick fires, release/absent cancel, threshold, save) --
~matPinchRoutine !? { ~matPinchRoutine.stop };
~matPinchHoldMs = 300; ~matFistThresh = 0.15;
~matFistState = Array.fill(2, \unknown); ~matFistHeld = Array.fill(2, nil); ~matFistFired = Array.fill(2, false);
~loadedFist = nil; ~matCurrentName = \zztest_morceau;
~matLoadReal = ~matLoad; ~matLoad = { |n| ~loadedFist = n.asSymbol };
~matFistEdge.(0, 0.5, 0.05); // L fist engage -> held, no fire
(~matFistHeld[0].isNil).if({ pass = false; "FAIL: L fist engage not held".postln });
~matFistTick.();
(~loadedFist.notNil).if({ pass = false; "FAIL: L fist fired before hold".postln });
~matFistHeld[0] = Main.elapsedTime - 0.5; // 500ms held (> 300)
~matFistTick.();
(~loadedFist == \zztest_morceau).not.if({ pass = false; "FAIL: L fist hold did not reload current".postln });
~loadedFist = nil; ~matFistState = Array.fill(2, \unknown); ~matFistHeld = Array.fill(2, nil); ~matFistFired = Array.fill(2, false);
~matFistEdge.(1, 0.5, 0.05); // R fist engage
~matFistEdge.(1, 0.5, 0.40); // open (>= 0.30) -> release
~matFistTick.();
(~matFistHeld[1].isNil).not.if({ pass = false; "FAIL: R fist release did not clear".postln });
~matFistState = Array.fill(2, \unknown); ~matFistHeld = Array.fill(2, nil);
~matFistEdge.(0, 0.0, 0.0); // absent hand (x=0, openness 0) must NOT engage
(~matFistHeld[0].isNil).not.if({ pass = false; "FAIL: absent hand engaged a fist".postln });
OSCdef(\mat_fisthresh).func.value(['/matrix/fisthresh', 0.25]);
(~matFistThresh == 0.25).not.if({ pass = false; "FAIL: fisthresh not set".postln });
~matFistThresh = 0.15; ~matLoad = ~matLoadReal;
~matInstruments = ~matInstruments ? Array.fill(~matVoices.size, { \default });
~matColorDefs = ~matColorDefs ? Array.fill(~matVoices.size, { ~matDefaultColorDefs.value });
~matSavedNames = ~matSavedNames ? Set.new;
~matFistThresh = 0.22; ~matSave.("zz_fth_test"); ~matFistThresh = 0.15;
~matLoadFile.(~matDir +/+ "zz_fth_test.matrix");
(~matFistThresh == 0.22).not.if({ pass = false; "FAIL: fistThresh not restored".postln });
("rm -f '" ++ (~matDir +/+ "zz_fth_test.matrix") ++ "'").systemCmd;
// Q: fist gestures removed 2026-07-02 (user request; FIST_ENABLE=0 at the source)
pass.if({ "GLOBALACT PASS".postln }, { "GLOBALACT FAIL".postln });
0.exit;
-2
View File
@@ -186,8 +186,6 @@
<div id="morceau-slots" class="morceau-slots"></div>
<div class="morceau-title">Réglages</div>
<div id="morceau-settings" class="morceau-settings"></div>
<div class="morceau-title">Poings</div>
<div id="morceau-fists" class="morceau-fists"></div>
</div>
</section>
</div>
@@ -88,8 +88,6 @@ export function resetGlobalSettings() { matGlobalSettings = { transientBars: 1,
export let matPinchHoldMs = 300;
export function setPinchHoldMs(v) { matPinchHoldMs = v; }
export let matFistThresh = 0.15;
export function setFistThresh(v) { matFistThresh = v; }
// Decode /matrix/globalsettings args: [transientBars, keepN, keep0..]
export function parseGlobalSettings(args) {
const transientBars = Math.round(Number(args[0]));
@@ -192,8 +190,7 @@ export function saveMatState() {
try { localStorage.setItem(MATRIX_STORAGE_KEY,
JSON.stringify({ grid: matGrid, inst: matInst, cdef: matColorDefs,
vmod: matVoiceMods, vpose: matVoicePoses,
gact: matGlobalActions, gset: matGlobalSettings, phms: matPinchHoldMs,
fth: matFistThresh })); } catch (_e) {}
gact: matGlobalActions, gset: matGlobalSettings, phms: matPinchHoldMs })); } catch (_e) {}
}
export function loadMatState() {
@@ -223,7 +220,6 @@ export function loadMatState() {
if (raw.gset && typeof raw.gset === "object" && Array.isArray(raw.gset.breakdownKeep))
matGlobalSettings = raw.gset;
if (Number.isFinite(raw.phms)) matPinchHoldMs = raw.phms;
if (Number.isFinite(raw.fth)) matFistThresh = raw.fth;
return; }
if (Array.isArray(raw) && raw.length === MATRIX_VOICES.length) { matGrid = raw; return; } // legacy: bare grid
} catch (_e) {}
@@ -6,7 +6,6 @@ import {
GLOBAL_ACTION_CHOICES, GLOBAL_SLOTS, matGlobalActions, setGlobalAction, saveMatState,
matGlobalSettings, setGlobalSetting, parseGlobalSettings,
matPinchHoldMs, setPinchHoldMs,
matFistThresh, setFistThresh,
} from "./matrix-state.js";
import { MATRIX_VOICES } from "./matrix-state.js";
@@ -91,23 +90,6 @@ export function init() {
});
onOpen(() => send("/matrix/pinchhold/get"));
send("/matrix/pinchhold/get");
// --- Sensibilite poing slider (in Reglages) ---
const fRow = document.createElement("label");
fRow.className = "morceau-set-row";
const fSpan = document.createElement("span"); fSpan.textContent = "Sensibilité poing";
const fInp = document.createElement("input");
fInp.type = "range"; fInp.min = 0.05; fInp.max = 0.5; fInp.step = 0.01; fInp.value = matFistThresh;
const fOut = document.createElement("output"); fOut.textContent = matFistThresh;
fInp.addEventListener("input", () => { fOut.textContent = fInp.value; });
fInp.addEventListener("change", () => { setFistThresh(+fInp.value); send("/matrix/fisthresh", +fInp.value); saveMatState(); });
fRow.append(fSpan, fInp, fOut);
sHost.appendChild(fRow);
on("/matrix/fisthresh", (args) => {
const v = Number(args[0]);
if (Number.isFinite(v)) { fInp.value = v; fOut.textContent = v; setFistThresh(v); saveMatState(); }
});
onOpen(() => send("/matrix/fisthresh/get"));
send("/matrix/fisthresh/get");
const keepWrap = document.createElement("div");
keepWrap.className = "morceau-keep";
const keepTitle = document.createElement("span");
@@ -139,29 +121,6 @@ export function init() {
onOpen(() => send("/matrix/globalsettings/get"));
send("/matrix/globalsettings/get");
}
// --- Fist indicators (hand 0 = Poing G -> charger, hand 1 = Poing D -> suivant) ---
const fistHost = document.getElementById("morceau-fists");
if (fistHost) {
const fistFills = [];
[["Poing G → charger"], ["Poing D → suivant"]].forEach((lbl, hand) => {
const row = document.createElement("div");
row.className = "morceau-fist";
row.textContent = lbl[0];
const fl = document.createElement("div");
fl.className = "morceau-slot-fill";
row.appendChild(fl);
fistFills[hand] = fl;
fistHost.appendChild(row);
});
on("/matrix/fistprogress", (args) => {
const hand = Math.round(Number(args[0]));
const prog = Number(args[1]) || 0;
const fl = fistFills[hand];
if (!fl) return;
fl.style.width = (prog * 100) + "%";
fl.classList.toggle("fired", prog >= 1);
});
}
const bpm = document.getElementById("matrix-bpm");
const bpmOut = document.getElementById("matrix-bpm-out");
if (bpm) {