Skip to content

fix(sound): play sounds through Web Audio and fade on start, pause, seek and stop - #359

Merged
theEvilReaper merged 6 commits into
developfrom
fix/soundWebAudio
Nov 28, 2026
Merged

theEvilReaper merged 6 commits into
developfrom
fix/soundWebAudio

Conversation

@theEvilReaper

@theEvilReaper theEvilReaper commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Proposed changes

Sounds played through an audio element, which cut the wave off hard on pause, stop, seek or switching files, so playback often clicked. Some Ogg files also ended early because the element trusted the container's timing. Playback now decodes the whole file with Web Audio and plays it from memory, ending exactly where the file ends, while every start, pause, seek and stop fades in or out over 15 ms.

Position bookkeeping across pauses, seeks and pitch changes moved into a small PlaybackTimeline class that is tested on the VM. Once nothing has played for 15 seconds, the player suspends its audio context to free the audio device and drops the decoded file unless a paused playback still needs it. Neither the SoundPlayer interface nor the controller changed.

Types of changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before
merging your code.

  • I have read the CONTRIBUTING.md
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@github-actions github-actions Bot added bug Something isn't working area: tests area: sound labels Nov 28, 2026
@theEvilReaper
theEvilReaper merged commit 6604baa into develop Nov 28, 2026
12 checks passed
@theEvilReaper
theEvilReaper deleted the fix/soundWebAudio branch November 28, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sound area: tests bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant