Repository navigation
fix(audio): tone switches no longer freeze the engine; verdicts say if timed - #21
Merged
Merged
Conversation
…f timed Tone switch stall: LoadPreset loads each NAM/IR slot by path and then applies its saved state, which loaded the SAME model a second time while the slot was live. The audio callback froze ~0.75 s on every switch (reproduced on ASIO: the renderer bus backed up to ~37k frames and then dropped), heard as a hard glitch plus a song-delay jump. State restore now skips a same-file reload (NAM and IR), and NAMProcessor::processBlock try-locks the model so the audio thread never waits on a swap. Verdict timing: a hit with no matched pick attack was stamped at the chart time with no flag, so consumers read a measured 0 ms. Verdicts now carry `timed` (true only when an onset was claimed), exposed by getNoteVerdicts and getSourceNoteVerdicts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tone switch freeze
Every tone switch froze the whole audio callback for about 0.75 s. I reproduced it live on ASIO4ALL: the renderer bus, which trims itself to about 85 ms whenever the engine reads it, backed up to about 37k frames (about 770 ms) and then dropped. You heard a hard glitch, and the song delay jumped afterwards.
I narrowed it down by changing one thing at a time:
clearChain()onlyloadPresetwith no slot stateclearChain()+ fullloadPresetThe cause is in
LoadPreset. It loads each NAM or IR slot by path, then applies the slot's saved state, and that state'smodelPath/irPathnames the same file. So the same model was loaded a second time while the slot was already live.Fix:
NAMProcessor::setStateInformationandIRLoader::setStateInformationonly reload when the state names a different file.NAMProcessor::processBlocknow usesScopedTryLockonmodelLock, so the audio thread never waits on a model swap. If the lock is busy, that block is silent.Verdict timing
When
NoteVerifiercan't match a hit to a pick attack, it stamps the hit at the chart time, and nothing marked it as such. Consumers read that as a measured 0 ms, which skewed timing stats and Sync Lab. Verdicts now carrytimed: true only when an onset was claimed. BothgetNoteVerdictsandgetSourceNoteVerdictsexpose it.The consumer side is mattromano/feedBack-plugin-notedetect#6.
Tests
tests/tone-load-no-stall.test.js(source-level).🤖 Generated with Claude Code