# platform/audio (vanilla-engine 0.4.0)

> https://vanillapunch.com/docs/vanilla-engine/0.4.0/api/platform/audio/

Audio backend.
- The lower layer AudioManager, AudioPlayer, AudioAsset and BeepPlayer call to make sound. The common code is in core, resource and misc.
- Each backend exposes the following names in the same form.
  AudioContext (the shared context), AudioBuffer (decoded sound), AudioPlatformState (the backend state the manager holds),
  AudioPlayerBackend (the sound-making part of one player), AudioBusBackend (the sound-gathering part of one bus, create_player_backend makes a player that plays into that bus),
  HAS_USER_GESTURE_AT_START,
  create_audio_platform_state, create_audio_context, resume_audio_context, is_audio_context_running,
  load_audio_file, load_audio_bytes (take the load type AudioLoadType), get_audio_buffer_duration, play_beep_tone,
  AudioStream (a sound loaded for streaming, get_duration, get_stream_url), AudioPlayerBackend::start_stream_playback, get_stream_time
  suspend_audio_context (suspending the context), get_audio_context_time (the context clock), AudioPlayerBackend::set_pan (left and right)
- Desktop: the engine mixer on top of cpal output. (desktop.rs, mixer.rs. The node graph and math are the same as Chrome WebAudio) Sound files are decoded by decode/ the same way as Chrome decodeAudioData. (symphonia 0.6, opus-pure for Opus)
  The HRTF of PannerNode (draft, panner.rs) is computed by hrtf/, a port of Chrome's HRTFPanner and the IRCAM data (Composite.flac). (the FFT is the same rustfft as Chrome)
- Web: calls the same WebAudio as the original directly through web-sys. (web.rs)
- Only the two types AudioContext and AudioBuffer are exposed so game code can name them. The rest are used only inside the engine.
