From 201f5b2d0b055f44527a89d7184916bc49da9506 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 17 Nov 2023 16:15:56 +0100 Subject: [PATCH] Add `VolumeLevel::ZERO` (#10608) # Objective - Handy to have a constant instead of `VolumeLevel::new(0.0)` - `VolumeLevel::new` is not `const` ## Solution - Adds a `VolumeLevel::ZERO` constant, which we have for most of our other types where it makes sense. --- ## Changelog - Add `VolumeLevel::ZERO` --- crates/bevy_audio/src/audio.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/bevy_audio/src/audio.rs b/crates/bevy_audio/src/audio.rs index 80159eb7ef..57a0eebb4c 100644 --- a/crates/bevy_audio/src/audio.rs +++ b/crates/bevy_audio/src/audio.rs @@ -50,6 +50,9 @@ impl VolumeLevel { pub fn get(&self) -> f32 { self.0 } + + /// Zero (silent) volume level + pub const ZERO: Self = VolumeLevel(0.0); } /// The way Bevy manages the sound playback.