pub struct Volume(pub pa_volume_t);
Expand description
Software volume expressed as an integer.
Tuple Fields§
§0: pa_volume_t
Implementations§
Source§impl Volume
impl Volume
Sourcepub fn ui_max() -> Self
pub fn ui_max() -> Self
Get the 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
Multiplies two software volumes, returning the result.
This uses Volume::NORMAL
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
Divides two software volumes, returning the result.
This uses Volume::NORMAL
as neutral element of division. If a division by zero is tried
the result will be 0
.
This is only valid for software volumes!
Sourcepub fn print_verbose(&self, print_db: bool) -> String
pub fn print_verbose(&self, print_db: bool) -> String
Pretty prints 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§
Source§impl From<Volume> for VolumeDB
Converts a volume to a decibel value (amplitude, not power).
impl From<Volume> for VolumeDB
Converts a volume to a decibel value (amplitude, not power).
This is only valid for software volumes!
Source§impl From<Volume> for VolumeLinear
Converts a volume to a linear factor.
impl From<Volume> for VolumeLinear
Converts a volume to a linear factor.
This is only valid for software volumes!
Source§impl From<VolumeDB> for Volume
Converts a decibel value to a volume (amplitude, not power).
impl From<VolumeDB> for Volume
Converts a decibel value to a volume (amplitude, not power).
This is only valid for software volumes!
Source§impl From<VolumeLinear> for Volume
Converts a linear factor to a volume.
impl From<VolumeLinear> for Volume
Converts a linear factor to a volume.
0.0
and less is muted while 1.0
is Volume::NORMAL
.
This is only valid for software volumes!