Fix EQ/reverb double-application and blocked track state sync - #275
Merged
Conversation
This commit fixes a bug where EQ and reverb effects could be applied twice, causing excessive audio processing. The issue was most likely to occur on Windows due to slower AudioContext operations, but could happen on any platform during rapid track transitions or effect changes. Root causes fixed: 1. Race condition in effect reapplication - Multiple async paths could trigger updateAudioEffect() simultaneously without synchronization 2. Incomplete equalizer cleanup - The filter chain's input/output nodes weren't being disconnected from the external audio chain, allowing duplicate connections to accumulate 3. Redundant effect dispatch - processMediaPlayInit() was calling setEffect() when REQUEST_EFFECT_REAPPLY already handles this Changes: - media-override.ts: Added synchronization lock (_effectUpdateInProgress) to ensure only one effect update runs at a time - audio-manager.ts: Fixed cleanupEffectChain() to properly disconnect equalizer input/output nodes from external chain while preserving internal filter connections - track.ts: Removed redundant setEffect() call from processMediaPlayInit() since REQUEST_EFFECT_REAPPLY message handles effect reapplication - SkipButton.svelte: Added chorus:track-blocked event dispatcher to sync with blocked tracks dialog The fix ensures thread-safe effect application and prevents duplicate audio processing without changing the public API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…utton Listen for both chorus:track-blocked and chorus:track-unblocked events in TrackListSkipButton to properly reflect block state changes made from SkipButton or BlockedTracksDialog. Query dataStore.blocked as source of truth when handling events instead of relying on static prop values.
- Fix loop count logic: iteration now decrements to 0 before stopping - Enable looping for full tracks (not just snipped tracks) - Handle track advancement after loop count exhausted - Properly separate infinite vs count-based loop handling
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.
Summary
Changes
Audio Effects Race Condition Fix
_effectUpdateInProgresslock inmedia-override.tsto prevent concurrent effect updatesaudio-manager.tsduring cleanup to prevent duplicate connectionssetEffect()call intrack.tssince it's already triggered viaREQUEST_EFFECT_REAPPLYmessageBlocked Track State Sync Fix
chorus:track-blockedandchorus:track-unblockedeventsdataStore.blockedas source of truth when handling events instead of relying on static prop valueschorus:track-blockedevent for proper sync with tracklist iconsLoop Count Fix
Test plan