Skip to content

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
StakeEngine:mainfrom
auraladigital:fix/sound-mute-volume-click
Open

fix(utils-sound): muted SFX emit a full-volume click — apply player volume to the Howl default#31
auraladigital wants to merge 1 commit into
StakeEngine:mainfrom
auraladigital:fix/sound-mute-volume-click

Conversation

@auraladigital

Copy link
Copy Markdown

What

createPlayer.volume() retunes sounds already in soundMap but never sets the Howl's own (default) volume. A sound played after volume() runs isn't in soundMap yet, so it starts at the Howl default (new Howl({ volume: 1 })) for the instant between howl.play() and initSoundVolume() 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 references howl, which isn't in scope in createPlayer (every call site uses playerOptions.howl), so it could never have been re-enabled as-is — likely commented out before a refactor renamed howlplayerOptions.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).

…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>
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