pub struct Volume(/* private fields */);Expand description
Absolute playback loudness setting for the whole player.
Volume is used by the player-level controls
max_volume, initial_volume, and
set_volume,
which set the absolute playback loudness behavior for the whole player.
This is different from Gain and PcmClipBuf::with_gain, which
adjust the relative loudness of individual clips.
See the audio_player module documentation for usage examples.
Implementations§
Source§impl Volume
impl Volume
Sourcepub const fn percent(percent: u8) -> Self
pub const fn percent(percent: u8) -> Self
Creates a volume from a percentage of full scale.
Values above 100 are clamped to 100.
See the audio_player module documentation for usage examples.
Sourcepub const fn spinal_tap(spinal_tap: u8) -> Self
pub const fn spinal_tap(spinal_tap: u8) -> Self
Creates a humorous “goes to 11” demo volume scale.
0..=11 maps to 0..=100% using a perceptual curve
(roughly logarithmic, but not mathematically exact).
Values above 11 clamp to 11.
See the audio_player module documentation for usage examples.