Isle-Slingers/js/audio/agents.md

15 lines
829 B
Markdown
Raw Permalink Normal View History

# js/audio/ — agents.md
Part of the modularization pass. Module map: `MODULES.md`; runtime model: `architecture.md`.
Self-contained module. Exports `ISLE_AUDIO = { AudioEngine }`.
- `new AudioEngine()` + `.init()` + `.resume()` + `.setMuted(m)` + `.play(ev)`
where `ev` is an item from `state.events` ({type, strength, mat, ...}).
- All sound is synthesized (oscillators + noise buffers); no assets, offline.
Must degrade silently when `AudioContext` is undefined (the DOM-stub test
asserts boot with `AudioContext: undefined`).
- Event names are a contract with physics/damage + step ('launch','hit',
'break','crack','pop','crush','bird_ground','ability_*','bird_gone',
'level_won','level_lost','star','ui'). Adding an event type means adding its
synth branch here (unknown types no-op — that is intentional).