From 575519df68be82b4f7152ca3771586ec8cd28540 Mon Sep 17 00:00:00 2001 From: monkey-w1n5t0n Date: Sat, 11 Apr 2026 08:38:56 +0200 Subject: [PATCH] fix(modular): duplicate destNames declaration in modular-ui rebuildMatrixGrid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The matrix-seeding edit from the previous commit added a second `const destNames = engine.destNames || [];` inside rebuildMatrixGrid while the same name was already declared earlier in the function body. Chrome threw SyntaxError at parse time, which in turn prevented a-app.js from wiring window.__nisps at all, which is what made the earlier FaustWorkletProcessor error look like the root cause — it was just the next thing that broke once the parse error let partial modules load. Verified end-to-end in headless Chromium via Playwright: engine switches to modular, paramCount=32, audioCtx running, worklet node live, zero console errors. Also updates the Modular engine card description to reflect the new default (32 params = 4 ADSR × 4 + 8 LFO × 2, matrix cells opt-in). --- playground/js/a-app.js | 4 ++-- playground/js/ui/modular-ui.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/playground/js/a-app.js b/playground/js/a-app.js index 7c45998..fe19e87 100644 --- a/playground/js/a-app.js +++ b/playground/js/a-app.js @@ -1351,8 +1351,8 @@ async function init() { { id: 'modular', displayName: 'Modular', - paramCount: 512, - description: 'Shared mod pool (ADSRs + LFOs) routed through a matrix into a swappable voice. Starts with a 3-osc subtractive sub-engine.', + paramCount: 32, + description: 'Shared mod pool (4 ADSRs + 8 LFOs) driving a swappable voice via a routing matrix. Starts with a 3-osc subtractive sub-engine.', }, ]; const engineSwitcherEl = document.getElementById('synth-engine-switcher'); diff --git a/playground/js/ui/modular-ui.js b/playground/js/ui/modular-ui.js index 86d7fea..abb26a9 100644 --- a/playground/js/ui/modular-ui.js +++ b/playground/js/ui/modular-ui.js @@ -347,8 +347,7 @@ export function initModularUI({ getEngine, onStateChange } = {}) { // Seed current values from the engine's _lastRawByLabel map (which // tracks every write via setParam / _setRawByLabel / default patch), // falling back to the walk-entry init value for cells the user has - // never touched. - const destNames = engine.destNames || []; + // never touched. (destNames is already in scope from the early guard.) const lastRaw = engine._lastRawByLabel || new Map(); for (let d = 0; d < destNames.length; d++) { const destName = destNames[d];