Struct libpulse_binding::volume::ChannelVolumes
source ·
[−]#[repr(C)]pub struct ChannelVolumes { /* private fields */ }Expand description
A structure encapsulating a per-channel volume
Implementations
Maximum number of allowed channels.
Initializes the specified volume and return a pointer to it.
The sample spec will have a defined state but is_valid() will fail for
it.
Sets the number of active channels.
Volumes for up to Self::CHANNELS_MAX channels can be held. This sets the portion of
the internal array considered “active” and thus available for reading/writing (i.e. when
borrowing self as a slice).
Panics if the number of channels specified is greater than Self::CHANNELS_MAX.
Gets a mutable slice of the set of “active” channels.
Sets the volume of the specified number of channels to the supplied volume.
Sets the volume of the first n channels to Volume::NORMAL.
Sets the volume of the first n channels to Volume::MUTED.
Returns the average volume of all channels that are included in the specified channel map with the specified channel position mask.
If no channel is selected the returned value will be Volume::MUTED. If mask is None,
has the same effect as passing POSITION_MASK_ALL.
Gets the maximum volume of all channels that are included in the specified channel map with the specified channel position mask.
If no channel is selected the returned value will be Volume::MUTED. If mask is None,
has the same effect as passing POSITION_MASK_ALL.
Gets the minimum volume of all channels that are included in the specified channel map with the specified channel position mask.
If no channel is selected the returned value will be Volume::MUTED. If mask is None,
has the same effect as passing POSITION_MASK_ALL.
Multiplies two per-channel volumes.
If with is None, multiplies with itself. This is only valid for software volumes!
Returns pointer to self.
Multiplies a per-channel volume with a scalar volume.
This is only valid for software volumes! Returns pointer to self.
Divides two per-channel volumes.
If with is None, divides with itself. This is only valid for software volumes! Returns
pointer to self.
Divides a per-channel volume by a scalar volume.
This is only valid for software volumes! Returns pointer to self.
Remaps a volume from one channel mapping to a different channel mapping.
Returns pointer to self.
Checks if the specified volume is compatible with the specified sample spec.
Checks if the specified volume is compatible with the specified channel map.
Calculates a ‘balance’ value for the specified volume with the specified channel map.
The return value will range from -1.0 (left) to +1.0 (right). If no balance value is
applicable to this channel map the return value will always be 0.0. See
Map::can_balance().
Adjusts the ‘balance’ value for the specified volume with the specified channel map.
The balance is a value between -1.0 and +1.0. This operation might not be reversible!
Also, after this call get_balance() is not guaranteed to actually
return the requested balance value (e.g. when the input volume was zero anyway for all
channels). If no balance value is applicable to this channel map the volume will not be
modified. See Map::can_balance().
Returns pointer to self, or None on error.
Calculates a ‘fade’ value (i.e. ‘balance’ between front and rear) for the specified volume with the specified channel map.
The return value will range from -1.0f (rear) to +1.0f (left). If no fade value is
applicable to this channel map the return value will always be 0.0. See
Map::can_fade().
Adjusts the ‘fade’ value (i.e. ‘balance’ between front and rear) for the specified volume with the specified channel map.
The balance is a value between -1.0 and +1.0. This operation might not be reversible!
Also, after this call get_fade() is not guaranteed to actually return
the requested fade value (e.g. when the input volume was zero anyway for all channels). If
no fade value is applicable to this channel map the volume will not be modified. See
Map::can_fade().
Returns pointer to self, or None on error.
This is supported on crate feature pa_v8 only.
pa_v8 only.Calculates a ‘lfe balance’ value for the specified volume with the specified channel map.
The return value will range from -1.0 (no lfe) to +1.0 (only lfe), where 0.0 is
balanced. If no value is applicable to this channel map the return value will always be
0.0. See Map::can_lfe_balance().
This is supported on crate feature pa_v8 only.
pa_v8 only.Adjusts the ‘LFE balance’ value for the specified volume with the specified channel map.
The balance is a value between -1.0 (no lfe) and +1.0 (only lfe). This operation might
not be reversible! Also, after this call get_lfe_balance() is not guaranteed to actually
return the requested value (e.g. when the input volume was zero anyway for all channels). If
no lfe balance value is applicable to this channel map the volume will not be modified. See
Map::can_lfe_balance().
Returns pointer to self, or None on error.
Scales so that the maximum volume of all channels equals max.
The proportions between the channel volumes are kept.
Returns pointer to self, or None on error.
pub fn scale_mask(
&mut self,
max: Volume,
cm: &mut Map,
mask: Option<PositionMask>
) -> Option<&mut Self>
pub fn scale_mask(
&mut self,
max: Volume,
cm: &mut Map,
mask: Option<PositionMask>
) -> Option<&mut Self>
Scales so that the maximum volume of all channels selected via cm/mask equals max.
This also modifies the volume of those channels that are unmasked. The proportions between the channel volumes are kept.
If mask is None, has the same effect as passing POSITION_MASK_ALL.
Returns pointer to self, or None on error.
Sets the passed volume to all channels at the specified channel position.
Returns None if either invalid data was provided, or if there is no channel at the
position specified. You can check if a channel map includes a specific position by calling
Map::has_position(). On success, returns pointer to self.
Gets the maximum volume of all channels at the specified channel position.
Will return 0 if there is no channel at the position specified. You can check if a channel
map includes a specific position by calling Map::has_position().
Merges one set of channel volumes with another.
The channel count is set to the minimum between that of self and that of with. Only this
number of channels are processed. For each channel processed, volume is set to the greatest
of the values from self and from with. I.e if one set has three channels and the other has
two, the number of channels will be set to two, and only the first two channels will be
compared, with the greatest values of these two channels being stored. The third channel in
the one set will be ignored.
Returns pointer to self, or None on error.
Increases the volume passed in by inc, but not exceeding limit.
The proportions between the channels are kept.
Returns pointer to self, or None on error.
Increases the volume passed in by inc.
The proportions between the channels are kept.
Returns pointer to self, or None on error.
Decreases the volume passed in by dec.
The proportions between the channels are kept.
Returns pointer to self, or None on error.
This is supported on crate feature pa_v5 only.
pa_v5 only.Pretty prints a volume structure in a verbose way.
The volume for each channel is printed in several formats: the raw volume value,
percentage, and if print_db is non-zero, also the dB value. If map is provided, the
channel names will be printed.
Trait Implementations
Performs the conversion.
Performs the conversion.
Returns the “default value” for a type. Read more
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for ChannelVolumes
impl Send for ChannelVolumes
impl Sync for ChannelVolumes
impl Unpin for ChannelVolumes
impl UnwindSafe for ChannelVolumes
Blanket Implementations
Mutably borrows from an owned value. Read more