Skip to main content

normalize_volume

Function normalize_volume 

Source
fn normalize_volume(volume: f32) -> f32
Expand description

Normalise a volume arriving over IPC to the 0.0..=1.0 range every backend works in.

NaN is handled before the clamp rather than by it: f32::clamp returns NaN for a NaN input (it only panics on NaN bounds), and NaN then survives every comparison downstream, so a backend clamp cannot catch it either. It is treated as “no volume asked for” and floored to 0.0.

TRACES: DR-212 | UT-206