Skip to content

fix: guard Howler rate calls when sound pool is empty - #189

Open
dazzatronus wants to merge 1 commit into
mainfrom
fix/howler-rate-empty-sounds
Open

dazzatronus wants to merge 1 commit into
mainfrom
fix/howler-rate-empty-sounds

Conversation

@dazzatronus

Copy link
Copy Markdown
Contributor

Why this change was needed:

Audio clip updates call Howler's rate() during the Pixi ticker. Howler's rate() getter reads self._sounds[0]._id with no empty-pool check, so an unloaded or cleaned Howl throws TypeError on _id and can crash the studio.

What changed:

  • Guard Howler control in AudioPlayer before rate / volume / play-path updates when state is not loaded or _sounds is empty.
  • Reset isPlaying when the Howl is not controllable so playback restarts cleanly once ready again.
  • Add focused regression tests that reproduce the empty-pool crash path.

Problem solved:

Ticker updates no longer throw when a Howl sound pool has been cleared (e.g. after unload) while the audio player still runs.

Manual check:

npm run dev

Then load the speed template (audio clip with speed: 1.5 in src/templates/speed.json) — change src/main.ts import to ./templates/speed.json if needed — play / scrub / change speed while audio loads and reloads.

Howler's rate() getter reads _sounds[0]._id without checking the pool.
Skip rate/volume control during AudioPlayer.update when the Howl is
unloaded or has no sounds, so the Pixi ticker no longer TypeErrors.
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