pub struct AudioChannelMap { /* private fields */ }Expand description
Maps individual input channels to output channels and applies per-channel gain.
Implementations§
Source§impl AudioChannelMap
impl AudioChannelMap
Sourcepub fn identity(layout: AudioLayout) -> Self
pub fn identity(layout: AudioLayout) -> Self
Create an identity map (each input channel routes to the same output channel).
Sourcepub fn stereo_to_mono() -> Self
pub fn stereo_to_mono() -> Self
Create a downmix map from stereo to mono (equal-power mix of L+R).
Sourcepub fn compute_gain_db(&self, output_channel: usize) -> Option<f64>
pub fn compute_gain_db(&self, output_channel: usize) -> Option<f64>
Compute the gain in dB for a given output channel index.
Returns None if the output channel index is out of range.
Sourcepub fn validate_params(&self) -> Result<(), String>
pub fn validate_params(&self) -> Result<(), String>
Validate that the map is consistent with the declared layouts.
For downmix maps (e.g. stereo→mono), the number of routes equals the number of input channels being mixed, which may exceed the output channel count. We therefore only require that the route count is at least the output channel count.
Sourcepub fn output_channel_count(&self) -> usize
pub fn output_channel_count(&self) -> usize
Number of output channels.
Trait Implementations§
Source§impl Clone for AudioChannelMap
impl Clone for AudioChannelMap
Source§fn clone(&self) -> AudioChannelMap
fn clone(&self) -> AudioChannelMap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AudioChannelMap
impl Debug for AudioChannelMap
Source§impl<'de> Deserialize<'de> for AudioChannelMap
impl<'de> Deserialize<'de> for AudioChannelMap
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AudioChannelMap
impl RefUnwindSafe for AudioChannelMap
impl Send for AudioChannelMap
impl Sync for AudioChannelMap
impl Unpin for AudioChannelMap
impl UnsafeUnpin for AudioChannelMap
impl UnwindSafe for AudioChannelMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more