Dark98 6737a936df fix(audio): decode 8-bit PCM WAVs synchronously and preload FluidSynth assets
Eliminates per-sound async decodeAudioData latency and lazy SoundFont loading delays in the TeaVM webclient while preserving main-thread FluidSynth audio stability.

### Web Audio Pipeline
- src/main/webapp/index.html:
  - Added decodeWav8MonoSync(ctx, bytes) to decode 8-bit unsigned mono PCM WAVs from Sounds.java synchronously into an AudioBuffer with decodeAudioData fallback.
  - Added preloadFluidSynthAssets() on page load to initialize JSSynth and fetch TimGM6mb.sf2 before the first user gesture, and added midiPlaySeq cancellation across async playMidi() steps.
  - Configured AudioContext with { latencyHint: 'interactive' }, guarded playPcm() against suspended contexts, and kept FluidSynth ScriptProcessorNode at 4096 samples to avoid main-thread underruns.
- src/main/java/org/scape2006/web/DesktopHooks.java:
  - Skipped JS sound marshaling when vol <= 0.0f and forwarded delayMs to window.scapeWebAudio.playPcm(arr, vol, delayMs).
- src/main/webapp/sw.js:
  - Bumped CACHE_VERSION to 2006scape-web-v6 to invalidate stale cached web assets.
2026-12-02 00:28:48 +00:00
S
Description
No description provided
5.7 MiB
0 Stars 1 Watchers 0 Forks
Languages
Java 74.5%
HTML 24.3%
JavaScript 1.2%