You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tone preload throws 'getSongToneLock is not defined' on every song (PR #10 scoping bug) #12
Component: feedBack-desktop, src/renderer/screen.js (audio_engine). Introduced by the open PR #10 (whole-song tone picker), so fix it before that PR merges.
What happens
On every song load the tone preload throws:
[tone-switcher] Preload failed: ReferenceError: getSongToneLock is not defined
at .../api/plugins/audio_engine/screen.js?v=0.4.0:4871:34
This happened on 14 song loads across a 1.5-hour session.
Why
The song-start hook in the preload flow calls getSongToneLock. That function is defined in a different IIFE in the same file, so the preload closure can't see it. It's the same scoping trap as _preloadedToneCacheKey and startToneAutoSwitch, both hit earlier in that PR.
Impact
Each song's tone preload aborts after its preflight. The MIDI/bypass preload path, the preset gain/gate/polish re-apply and the preload cache key are skipped.
Tone switching still works, because the Tone Automation install path (installTaSwitcherForSong) enforces the lock separately. That's why it went unnoticed.
Fix
Call the exported helpers (window._aeSongToneLock.get/apply) from the preload closure, or move the lock helpers to a scope both IIFEs share.
Test gap
tests/song-tone-lock.test.js checks where the hook sits in the source, not that the call resolves at runtime. Add a test that executes the preload closure.
Found in a live session audit (read-only). Notes: audit-notes/session-audit-2026-11-06.md, item 1.
Activity
fix(audio): tone preload called lock helpers across IIFEs (issue #12)