Struct libpulse_binding::volume::ChannelVolumes [−][src]
A structure encapsulating a per-channel volume
Fields
channels: u8
Number of channels.
values: [Volume; 32]
Per-channel volume.
Methods
impl ChannelVolumes
[src]
impl ChannelVolumes
ⓘImportant traits for &'a mut Rpub fn init(&mut self) -> &Self
[src]
pub fn init(&mut self) -> &Self
Initialize the specified volume and return a pointer to it. The sample spec will have a
defined state but is_valid
will fail for it.
ⓘImportant traits for &'a mut Rpub fn set(&mut self, channels: u32, v: Volume) -> &Self
[src]
pub fn set(&mut self, channels: u32, v: Volume) -> &Self
Set the volume of the specified number of channels to the supplied volume
ⓘImportant traits for &'a mut Rpub fn reset(&mut self, channels: u32) -> &Self
[src]
pub fn reset(&mut self, channels: u32) -> &Self
Set the volume of the first n channels to VOLUME_NORM
.
ⓘImportant traits for &'a mut Rpub fn mute(&mut self, channels: u32) -> &Self
[src]
pub fn mute(&mut self, channels: u32) -> &Self
Set the volume of the first n channels to VOLUME_MUTED
.
pub fn equal_to(&self, to: &Self) -> bool
[src]
pub fn equal_to(&self, to: &Self) -> bool
Returns true
when self is equal to to
.
This checks that the number of channels in self equals the number in to
and that the
channels volumes in self equal those in to
.
pub fn is_muted(&self) -> bool
[src]
pub fn is_muted(&self) -> bool
Returns true
if all channels are muted
pub fn is_norm(&self) -> bool
[src]
pub fn is_norm(&self) -> bool
Returns true
if all channels are at normal volume level
pub fn avg(&self) -> Volume
[src]
pub fn avg(&self) -> Volume
Returns the average volume of all channels
pub fn avg_mask(&self, cm: &Map, mask: Option<PositionMask>) -> Volume
[src]
pub fn avg_mask(&self, cm: &Map, mask: Option<PositionMask>) -> Volume
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 ::channelmap::POSITION_MASK_ALL
.
pub fn max(&self) -> Volume
[src]
pub fn max(&self) -> Volume
Return the maximum volume of all channels.
pub fn max_mask(&self, cm: &Map, mask: Option<PositionMask>) -> Volume
[src]
pub fn max_mask(&self, cm: &Map, mask: Option<PositionMask>) -> Volume
Return 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 ::channelmap::POSITION_MASK_ALL
.
pub fn min(&self) -> Volume
[src]
pub fn min(&self) -> Volume
Return the minimum volume of all channels.
pub fn min_mask(&self, cm: &Map, mask: Option<PositionMask>) -> Volume
[src]
pub fn min_mask(&self, cm: &Map, mask: Option<PositionMask>) -> Volume
Return 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 ::channelmap::POSITION_MASK_ALL
.
pub fn is_valid(&self) -> bool
[src]
pub fn is_valid(&self) -> bool
Returns true
when the ChannelVolumes
structure is valid.
pub fn channels_equal_to(&self, v: Volume) -> bool
[src]
pub fn channels_equal_to(&self, v: Volume) -> bool
Returns true
if the volume of all channels are equal to the specified value.
ⓘImportant traits for &'a mut Rpub fn sw_multiply(&mut self, with: Option<&Self>) -> &mut Self
[src]
pub fn sw_multiply(&mut self, with: Option<&Self>) -> &mut Self
Multiply two per-channel volumes.
If with
is None
, multiplies with itself. This is only valid for software volumes!
Returns pointer to self.
ⓘImportant traits for &'a mut Rpub fn sw_multiply_scalar(&mut self, with: Volume) -> &mut Self
[src]
pub fn sw_multiply_scalar(&mut self, with: Volume) -> &mut Self
Multiply a per-channel volume with a scalar volume.
This is only valid for software volumes! Returns pointer to self.
ⓘImportant traits for &'a mut Rpub fn sw_divide(&mut self, with: Option<&Self>) -> &mut Self
[src]
pub fn sw_divide(&mut self, with: Option<&Self>) -> &mut Self
Divide two per-channel volumes.
If with
is None
, divides with itself. This is only valid for software volumes! Returns
pointer to self.
ⓘImportant traits for &'a mut Rpub fn sw_divide_scalar(&mut self, with: Volume) -> &mut Self
[src]
pub fn sw_divide_scalar(&mut self, with: Volume) -> &mut Self
Divide a per-channel volume by a scalar volume.
This is only valid for software volumes! Returns pointer to self.
ⓘImportant traits for &'a mut Rpub fn remap(&mut self, from: &Map, to: &Map) -> &mut Self
[src]
pub fn remap(&mut self, from: &Map, to: &Map) -> &mut Self
Remap a volume from one channel mapping to a different channel mapping.
Returns pointer to self.
pub fn is_compatible_with_ss(&self, ss: &Spec) -> bool
[src]
pub fn is_compatible_with_ss(&self, ss: &Spec) -> bool
Returns true
if the specified volume is compatible with the specified sample spec.
pub fn is_compatible_with_cm(&self, cm: &Map) -> bool
[src]
pub fn is_compatible_with_cm(&self, cm: &Map) -> bool
Returns true
if the specified volume is compatible with the specified channel map.
pub fn get_balance(&self, map: &Map) -> f32
[src]
pub fn get_balance(&self, map: &Map) -> f32
Calculate 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
::channelmap::Map::can_balance
.
pub fn set_balance(&mut self, map: &Map, new_balance: f32) -> Option<&mut Self>
[src]
pub fn set_balance(&mut self, map: &Map, new_balance: f32) -> Option<&mut Self>
Adjust 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
::channelmap::Map::can_balance
.
Returns pointer to self, or None
on error.
pub fn get_fade(&self, map: &Map) -> f32
[src]
pub fn get_fade(&self, map: &Map) -> f32
Calculate 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
::channelmap::Map::can_fade
.
pub fn set_fade(&mut self, map: &Map, new_fade: f32) -> Option<&mut Self>
[src]
pub fn set_fade(&mut self, map: &Map, new_fade: f32) -> Option<&mut Self>
Adjust 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
::channelmap::Map::can_fade
.
Returns pointer to self, or None
on error.
pub fn get_lfe_balance(&self, map: &Map) -> f32
[src]
pub fn get_lfe_balance(&self, map: &Map) -> f32
Calculate 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 ::channelmap::Map::can_lfe_balance
.
pub fn set_lfe_balance(
&mut self,
map: &Map,
new_balance: f32
) -> Option<&mut Self>
[src]
pub fn set_lfe_balance(
&mut self,
map: &Map,
new_balance: f32
) -> Option<&mut Self>
Adjust 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
::channelmap::Map::can_lfe_balance
.
Returns pointer to self, or None
on error.
pub fn scale(&mut self, max: Volume) -> Option<&mut Self>
[src]
pub fn scale(&mut self, max: Volume) -> Option<&mut Self>
Scale 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>
[src]
pub fn scale_mask(
&mut self,
max: Volume,
cm: &mut Map,
mask: Option<PositionMask>
) -> Option<&mut Self>
Scale 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
::channelmap::POSITION_MASK_ALL
.
Returns pointer to self, or None
on error.
pub fn set_position(
&mut self,
map: &Map,
t: Position,
v: Volume
) -> Option<&mut Self>
[src]
pub fn set_position(
&mut self,
map: &Map,
t: Position,
v: Volume
) -> Option<&mut Self>
Set 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
::channelmap::Map::has_position
. On success, returns pointer to self.
pub fn get_position(&self, map: &Map, t: Position) -> Volume
[src]
pub fn get_position(&self, map: &Map, t: Position) -> Volume
Get 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 ::channelmap::Map::has_position
.
pub fn merge(&mut self, with: &Self) -> Option<&mut Self>
[src]
pub fn merge(&mut self, with: &Self) -> Option<&mut Self>
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.
pub fn inc_clamp(&mut self, inc: Volume, limit: Volume) -> Option<&mut Self>
[src]
pub fn inc_clamp(&mut self, inc: Volume, limit: Volume) -> Option<&mut Self>
Increase 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.
pub fn increase(&mut self, inc: Volume) -> Option<&mut Self>
[src]
pub fn increase(&mut self, inc: Volume) -> Option<&mut Self>
Increase the volume passed in by inc
.
The proportions between the channels are kept.
Returns pointer to self, or None
on error.
pub fn decrease(&mut self, dec: Volume) -> Option<&mut Self>
[src]
pub fn decrease(&mut self, dec: Volume) -> Option<&mut Self>
Decrease the volume passed in by dec
.
The proportions between the channels are kept.
Returns pointer to self, or None
on error.
pub fn print(&self) -> String
[src]
pub fn print(&self) -> String
Pretty print a volume structure
pub fn print_db(&self) -> String
[src]
pub fn print_db(&self) -> String
Pretty print a volume structure but show dB values.
pub fn print_verbose(&self, map: Option<&Map>, print_db: bool) -> String
[src]
pub fn print_verbose(&self, map: Option<&Map>, print_db: bool) -> String
Pretty print 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
impl Debug for ChannelVolumes
[src]
impl Debug for ChannelVolumes
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Copy for ChannelVolumes
[src]
impl Copy for ChannelVolumes
impl Clone for ChannelVolumes
[src]
impl Clone for ChannelVolumes
fn clone(&self) -> ChannelVolumes
[src]
fn clone(&self) -> ChannelVolumes
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for ChannelVolumes
[src]
impl Default for ChannelVolumes
fn default() -> ChannelVolumes
[src]
fn default() -> ChannelVolumes
Returns the "default value" for a type. Read more
impl PartialEq for ChannelVolumes
[src]
impl PartialEq for ChannelVolumes
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Display for ChannelVolumes
[src]
impl Display for ChannelVolumes
Auto Trait Implementations
impl Send for ChannelVolumes
impl Send for ChannelVolumes
impl Sync for ChannelVolumes
impl Sync for ChannelVolumes