Skip to main content

concinnity_core/components/
audio_command.rs

1// src/components/audio_command.rs
2
3/// Runtime-only event sent by GraphicsSystem when a volume setting changes,
4/// read by AudioSystem from its `Events<AudioCommand>` queue.
5///
6/// Volumes are owned by the audio engine, not the renderer, so a change made in
7/// the settings menu is handed across as this event rather than read from disk
8/// each frame: the audio system scales its output on the same tick. World
9/// authors never declare this type directly.
10#[derive(Debug, Clone, Copy, PartialEq)]
11pub struct AudioCommand {
12    /// The output stage whose volume changed.
13    pub target: AudioTarget,
14    /// New volume as a linear gain (0.0 = silent, 1.0 = full).
15    pub gain: f32,
16}
17
18/// The output stage an [`AudioCommand`] addresses: the master mix or one of
19/// the three buses under it.
20#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub enum AudioTarget {
22    /// The master mix every bus feeds.
23    Master,
24    /// The music bus.
25    Music,
26    /// The sound-effects bus.
27    Sfx,
28    /// The voice bus.
29    Voice,
30}