logo
pub struct Volume(pub pa_volume_t);
Expand description

Software volume expressed as an integer.

Tuple Fields

0: pa_volume_t

Implementations

A “normal” volume level.

A muted volume level.

A maximum volume level.

An invalid volume level.

Is a muted volume level.

Is a “normal” volume level.

Is a maximum volume level.

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.

Checks if volume is valid.

Clamps volume to the permitted range.

Multiplies two software volumes, returning the result.

This uses Volume::NORMAL as neutral element of multiplication.

This is only valid for software volumes!

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!

Pretty prints a volume.

Pretty prints a volume but showing dB values.

This is supported on crate feature pa_v5 only.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Converts a volume to a decibel value (amplitude, not power).

This is only valid for software volumes!

Performs the conversion.

Converts a volume to a linear factor.

This is only valid for software volumes!

Performs the conversion.

Converts a decibel value to a volume (amplitude, not power).

This is only valid for software volumes!

Performs the conversion.

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!

Performs the conversion.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Returns true if the volume of all channels are equal to the specified value.

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.