• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

excaliburjs / Excalibur / 1003
84%
main: 89%

Build:
Build:
LAST BUILD BRANCH: renovate/fontsource-monorepo
DEFAULT BRANCH: main
Ran 03 Sep 2016 04:53AM UTC
Jobs 1
Files 1
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
1003

push

travis-ci

eonarheim
[Closes #515] Refactor sound resources to address inconsistent behaviors (#644)

Closes #515

## Context

Before this change, there were multiple subtle issues with how sounds were being paused and played. Both the `AudioTag` and `WebAudio` resources treated simultaneous playing and pausing differently--they weren't consistent with each other. In addition, they both inconsistently fetched the resource via XHR and handled setting data differently as well as volume (web audio was global volume and audio tags could be individual).

I basically standardized a multi-track based approach for both resources, where each "play" track keeps track of its own state. I also refactored enough where we can now share all the base controller logic for an audio resource, delegating any implementation-specific logic to new `AudioTagTrack` and `WebAudioTrack` classes.

## Tasks

- [x] Test sandbox sounds
- [x] Add more proper debug logging
- [x] I think `Resources\Sound.ts` and my new `AbstractAudioResource` are essentially the same, I might be able to consolidate that (or at least fix the weird loading logic in `AbstractAudioResource`)
- [x] Write tests against `AbstractAudioResource` class (create test mock)

## Looking for feedback:

- **(Done)** Does `Track` make sense or would `Instance` make more sense? Or a different word? They essentially represent *individual* plays of a sound. But I don't want it to get confused with real multi-tracking similar to #380

## Proposed Changes:

- Create consistent implementation that handles behavior logic for both audio tags and web audio
- Behavior changes:
  - Calling `play()` when *paused* will resume all unfinished tracks and will not trigger a new track to be played. 
  - Calling `play()` when *not paused* will ensure current tracks play and will trigger a new track to be played.
- Both audio tag and web audio tracks *can* support individual volume per play (but that is not supported in the API interface yet)
- Updated type annotations to take advantage of new `AudioContext` support in TS 1.5+
- Fix audio tag pausing/resuming to properly track offsets for each "play"
- Fix web audio pausing/resuming to properly track offsets for each "play"
- Fix issue with web audio where playing a sound during `hidden` game event would not mute the new sound

6780 of 9066 relevant lines covered (74.78%)

74.69 hits per line

Jobs
ID Job ID Ran Files Coverage
1 1003.1 03 Sep 2016 04:53AM UTC 0
74.78
Travis Job 1003.1
Source Files on build 1003
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1003
  • bda6db24 on github
  • Prev Build on master (#998)
  • Next Build on master (#1004)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc