fix(utils-sound): muted SFX emit a full-volume click — apply player volume to the Howl default#31
Open
auraladigital wants to merge 1 commit into
Open
Conversation
…olume to the Howl default createPlayer.volume() retuned sounds already in soundMap but never set the Howl's own (default) volume. A sound played after volume() runs starts at the Howl default (1) for the instant between howl.play() and initSoundVolume() applying its per-sound volume — a full-volume attack transient, audible as a click, most obviously when muted (player volume 0). The fix line existed but was commented out and referenced an out-of-scope `howl` (every call site uses playerOptions.howl), likely commented before a refactor renamed it. Re-enable it in the in-scope form; the per-sound loop still refines each active sound. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
createPlayer.volume()retunes sounds already insoundMapbut never sets the Howl's own (default) volume. A sound played aftervolume()runs isn't insoundMapyet, so it starts at the Howl default (new Howl({ volume: 1 })) for the instant betweenhowl.play()andinitSoundVolume()applying its per-sound volume. That instant is a full-volume attack transient — audible as a click, most obviously when the player is muted (player volume 0), where it's the only audible part of every SFX.Repro
Mute (player volume → 0), then trigger one-shot SFX (e.g. a spin's reel-stop / symbol-landing sounds). Each emits a click.
Fix
Set the Howl's default volume in
volume()so newly-played sounds inherit the current level. The line was already present but commented out — and as written it referenceshowl, which isn't in scope increatePlayer(every call site usesplayerOptions.howl), so it could never have been re-enabled as-is — likely commented out before a refactor renamedhowl→playerOptions.howl. The per-sound loop still refines each active sound; this only changes the default that new sounds start from. No change to the unmuted mix (the default was already 1).