Expand description
Audio playback — AudioPlugin inserts AudioOutput as a resource,
opening the default output device once at startup, exactly like
crate::time::TimePlugin. App::new() already builds this in, so
Res<AudioOutput> works without registering anything yourself.
No wasm32 support — the underlying rodio/cpal stack doesn’t
build on wasm32-unknown-unknown at all. A known gap, not solved here.
Backend-agnostic, same as crate::time/crate::gamepad — nothing
here depends on pebble::wgpu or any particular rendering backend.
Sound needs no Asset/Handle/GPU
pipeline — it’s not a GPU resource, and decoding it is a synchronous,
one-shot call, not something worth an async pipeline (same reasoning as
wgpu::gltf_loader::load_gltf).
Structs§
- Audio
Output - The audio output device — a resource, inserted by
AudioPlugin. - Audio
Plugin - Registers
AudioOutputas a resource, opening the default output device once at startup. - Playing
Sound - A sound actively playing, with volume/pause/stop control — returned by
AudioOutput::play_controlled. Dropping this stops playback (the same RAII behavior as closing an audio stream elsewhere) — for “play it and don’t worry about the handle,” useAudioOutput::play/AudioOutput::play_loopedinstead, which don’t hand back anything to accidentally drop. - Sound
- Decoded sound data, ready to play — cheap to clone (an
Arc-backed sample buffer internally) and to play more than once or simultaneously. Plain data — the only way to construct one isSoundBuilder. - Sound
Builder - Builds a
Soundby decoding an audio file. Fully decodes up front (not a streaming decoder) — fine for sound effects and short music clips; a very long track means a correspondingly large in-memory buffer.