arcomage / arcomage-hd

Web-based, free and open source, remastered 3D clone of 3DO/NWC's 2000 card game Arcomage. 13 languages. Desktop or mobile Android iOS. Online or offline PWA. Against AI or Multiplayer (w/o server). 🧝👾🃏 (ts+react+redux+rxjs, CSS-based anim, WebRTC)

Home Page:https://arcomage.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stereo panning with Web Audio API; WebM

tomchen opened this issue · comments

Refactor ./src/utils/playSound.ts with Web Audio API (howler.js used eventually).

  • Use GainNode to control volume
  • Use StereoPannerNode to add stereo panning. Sound effects for the player on the left/right should be panned left/right
  • Use webm rather than mp3
  • Restore MP3 instead of WebM for Safari compatibility (this is easier than using fallback)
  • Stereo Option (Enable or disable)

Refs:

  • Stereo Option (Enable or disable)
  • Use webm

Safari can't play WebM currently. Should have MP3 fallback

Detect WebM support:
https://stackoverflow.com/a/7451727

Edit: I eventually restored mp3 instead of webm. It's easier to control the preloading and PWA