Expand description
Sound: the AudioSource component and the AudioBus that scripts talk to.
The engine itself plays nothing. Scripts and components only queue requests on the
scene’s bus; a shell (the editor or the player) hands them to the kvas_audio backend
once per frame. That keeps the simulation deterministic and testable without a sound card.
use kvas_engine::audio::AudioBus;
let mut bus = AudioBus::default();
let id = bus.play("sounds/click.wav", 0.8);
bus.stop(id);
assert_eq!(bus.drain().len(), 2);Structs§
- Audio
Bus - Pending audio requests and the master volume. Lives in the scene, is never saved.
- Audio
Source - A sound attached to an object: ambience, a radio, a machine hum.
- SoundId
- Handle of a sound started through the bus; use it to stop or adjust that sound later.
Enums§
- Audio
Cmd - One queued request for the audio backend.
Functions§
- cone_
gain - Gain of a directional source: full inside the inner 60 % of the cone, fading to 10 % at its edge and beyond.
forwardis where the source points,to_listenerthe direction from the source to the listener. - distance_
gain - Gain for a 3D sound: 1 inside
min, falling linearly to 0 atmax. - stereo_
pan - Stereo position (-1 left .. 1 right) of a source seen from a listener.