Struct libpulse_binding::volume::Volume
source · pub struct Volume(pub pa_volume_t);Expand description
Software volume expressed as an integer
Tuple Fields
0: pa_volume_tImplementations
sourceimpl Volume
impl Volume
pub fn is_muted(&self) -> bool
pub fn is_normal(&self) -> bool
pub fn is_max(&self) -> bool
sourcepub fn ui_max() -> Self
pub fn ui_max() -> Self
Recommended maximum volume to show in user facing UIs. Note: UIs should deal gracefully with volumes greater than this value and not cause feedback loops etc. - i.e. if the volume is more than this, the UI should not limit it and push the limited value back to the server.
sourcepub fn multiply(a: Self, b: Self) -> Self
pub fn multiply(a: Self, b: Self) -> Self
Multiply two software volumes, return the result.
This uses VOLUME_NORM as neutral element of multiplication.
This is only valid for software volumes!
sourcepub fn divide(a: Self, b: Self) -> Self
pub fn divide(a: Self, b: Self) -> Self
Divide two software volumes, return the result.
This uses VOLUME_NORM as neutral element of division. This is
only valid for software volumes! If a division by zero is tried the result will be 0.
sourcepub fn print_verbose(&self, print_db: bool) -> String
pub fn print_verbose(&self, print_db: bool) -> String
Pretty print a volume in a verbose way.
The volume is printed in several formats: the raw volume value, percentage, and if
print_db is true, also the dB value.
Trait Implementations
sourceimpl From<Volume> for VolumeDB
impl From<Volume> for VolumeDB
Convert a volume to a decibel value (amplitude, not power). This is only valid for software volumes!
sourceimpl From<Volume> for VolumeLinear
impl From<Volume> for VolumeLinear
Convert a volume to a linear factor. This is only valid for software volumes!
sourceimpl From<VolumeDB> for Volume
impl From<VolumeDB> for Volume
Convert a decibel value to a volume (amplitude, not power). This is only valid for software volumes!
sourceimpl From<VolumeLinear> for Volume
impl From<VolumeLinear> for Volume
Convert a linear factor to a volume.
0.0 and less is muted while 1.0 is VOLUME_NORM.
This is only valid for software volumes!
sourcefn from(v: VolumeLinear) -> Self
fn from(v: VolumeLinear) -> Self
sourceimpl Ord for Volume
impl Ord for Volume
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialOrd<Volume> for Volume
impl PartialOrd<Volume> for Volume
sourcefn partial_cmp(&self, other: &Volume) -> Option<Ordering>
fn partial_cmp(&self, other: &Volume) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more