pub struct Volume(/* private fields */);target_os=none only.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 AudioClipBuf::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.
Trait Implementations§
impl Copy for Volume
impl Eq for Volume
impl StructuralPartialEq for Volume
Auto Trait Implementations§
impl Freeze for Volume
impl RefUnwindSafe for Volume
impl Send for Volume
impl Sync for Volume
impl Unpin for Volume
impl UnwindSafe for Volume
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more