# Audio Middleware Sound Designer Guide

The middleware layer gives Maya Engine a single contract for Wwise, FMOD Studio,
and the built-in Maya audio fallback. Game code posts events, sets parameters,
updates 3D objects, and manages soundbanks through `AudioMiddlewareManager`
instead of calling backend-specific APIs directly.

## Authoring contract

Use consistent names across Wwise, FMOD, and engine data:

- Events: `Play_Footstep`, `Play_Rifle`, `Stop_Ambience_Forest`
- Parameters/RTPCs: `Speed`, `WeaponHeat`, `Health`
- Switches: `Surface=Stone|Wood|Metal`, `Weapon=Rifle|Pistol`
- States: `Combat=Low|High`, `Location=Interior|Exterior`
- Banks: `Init`, `Ambience`, `Weapons`, `Characters`

The project generation helper emits a manifest and backend project descriptor
from those names so content cook jobs and runtime event maps stay aligned.

## Runtime workflow

1. Register banks with tags and memory estimates.
2. Initialize the preferred backend. If the adapter is unavailable, the manager
   can fall back to the built-in Maya audio adapter.
3. Register sources for world objects and listeners for cameras.
4. Load banks directly or call `updateSoundbankStreaming(activeTags)`.
5. Use `triggerGameplayAudio()` for gameplay events that need switches, states,
   or parameters before posting the event.
6. Call `createProfilerFrame()` to feed engine profiler panels.

## Spatial audio

Sources and listeners use position, orientation, and velocity. The manager sends
object transforms to the active adapter every time a source or listener changes.
Split-screen is represented by multiple weighted listeners.

## Environments and occlusion

Environment zones are spherical authoring volumes with a reverb bus and send
level. `updateSourceEnvironment(sourceId)` applies all zones containing the
source and can also drive an RTPC.

Occlusion uses an engine-provided raycaster. The manager converts material hits
into normalized occlusion and obstruction values, then sends those values to the
active middleware adapter.

## Streaming and cook

Soundbanks can be tagged by world region or gameplay mode. Streaming banks load
when their tags are active and unload when no longer relevant. The cook-plan
helper creates per-platform jobs for Wwise, FMOD, or fallback bank pipelines.

## Hot reload

Use `hotReloadSoundbank(bankId)` in development tools after a bank is rebuilt.
The manager keeps the bank marked loaded and records a hot-reload command for
the active adapter.
