Skip to content

feat(audio): whole-song tone picker in the player menu - #10

Merged
mattromano merged 5 commits into
customfrom
feat/whole-song-tone-lock
Nov 7, 2026
Merged

mattromano merged 5 commits into
customfrom
feat/whole-song-tone-lock

Conversation

@mattromano

Copy link
Copy Markdown
Owner

What

The player menu's Tone & tuning group gets a Tone dropdown:

  • Tone: follow song: normal switching, using Tone Automation or the per-tone mappings.
  • Tone: <preset>: holds that saved preset for the whole song.

The pick is remembered per song (localStorage slopsmith-song-tone-lock). A pick that points at a deleted preset is ignored.

Why

Tone Automation classifies tones by name. A song whose base tone is called mychdead_solo plays its whole length on the solo preset. There was also no simple way to say "just use Main Lead for this song".

How

  • The lock is enforced in installTaSwitcherForSong and _applyToneMappingsImpl, which every switching path goes through, and at song start before MIDI/TA/bypass.
  • The locked switcher ignores the song's tone changes and doesn't show the tone toast.
  • The dropdown carries data-ae-chain, so core's player menu files it under Tone & tuning with no core change.

Testing

  • tests/song-tone-lock.test.js (new): store/clear, deleted preset, corrupt storage, lock ignores tone changes, every path checks the lock, picker placement.
  • npm test: 149 pass, 0 fail.
  • Live, in a packaged build on a real profile with Tone Automation on (My Chemical Romance, "Dead!"):
    • following the song → Mesa, from the _solo base tone
    • picking Main Lead → Main Lead
    • replaying the song → Main Lead again, with the picker showing it
    • back to follow → Mesa
    • no console errors

🤖 Generated with Claude Code

mattromano and others added 2 commits November 6, 2026 13:13
A "Tone: …" dropdown in the player's Tone & tuning group holds one saved
preset for the entire song ("Tone: follow song" keeps normal switching).
The pick is remembered per song and wins over Tone Automation and per-tone
mappings: the lock is enforced inside installTaSwitcherForSong and
_applyToneMappingsImpl (every switching path funnels through one of them)
and at song start, and the locked switcher ignores the song's tone changes
(no tone toast either).

Why: Tone Automation classifies by tone name, so a song whose BASE tone is
named e.g. "mychdead_solo" plays its whole length on the solo preset, and
there was no simple way to just pick a tone for a song.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picking a tone while a play queue / album playthrough is running now keeps
it for the rest of that run instead of only the current song; the next
song loads on the same tone. A song's own pick still wins, "Tone: follow
song" releases the run lock, and it clears when the queue ends
(queue:changed active:false, re-checked lazily against playQueue.active()).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattromano

Copy link
Copy Markdown
Owner Author

Added: a tone picked while a queue / album playthrough is running now holds for the rest of that run (the next song loads on the same tone). A song's own pick still wins, "Tone: follow song" releases it, and it clears when the queue ends. Tests: 151 pass. Live: picked Metal Lead on song 1 of a 2-song queue; song 2 (no per-song pick) loaded on Metal Lead with the picker showing it.

mattromano and others added 2 commits November 6, 2026 14:16
A tone saved while a song was playing didn't appear until the next song,
because the options were built once at song start. Rebuild on
pointerdown/focus, only when the preset list actually changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The song-start lock check in the preload (second IIFE) called
getSongToneLock/applySongToneLock, which only exist in the first IIFE, so
every song's preload threw ReferenceError and aborted. Go through the
window._aeSongToneLock export instead.

New tests/renderer-iife-scope.test.js pins the whole class: no IIFE in
screen.js may call a top-level function only another IIFE declares. It also
caught an older one: the bypass-mode preload called getPresetItems() from
the second IIFE (fixed with a local alias).

Fixes #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattromano
mattromano merged commit a6f2c5d into custom Nov 7, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant