[−][src]Struct miniaudio::ChannelConverter
channel conversion is used for channel rearrangement and conversion from one channel count to another. The ChannelConverter API is used for channel conversion.
In addition to converting from one channel count to another the channel converter can also be used to rearrange channels. When initializing the channel converter, you can optionally pass in channel maps for both the input and output frames. If the channel counts are the same, each channel map contains teh same channel positions with the exception that they're in a different order, a simple shuffling of the channels will be performed. If, however, there is not a 1:1 mapping of channel positions, or the channel counts differ, the input channels will be mixed based on a mixing mode which is specified when initializing the ChannelConverterConfig object.
When converting from mono to multi-channel, the mono channel is simply copied to each output channel. When going the other way around, the audio of each output channel is simply averaged and copied to the mono channel.
In more complicated cases blending is used. ChannelMixMode::Simple
mode will drop excess
channels and silence extra channels. For example, convertion from 4 to 2 channels, the 3rd and
4th channels will be dropped, whereas converting from 2 to 4 channels will put silence into the
3rd and 4th channels.
ChannelModeMode::Rectangle
mode uses spacial locality based on a rectangle to compute a
simple distribution between input and output. Imaging sitting in the middle of a root, with
speakers on the walls representing channel positions. Channel::FrontLeft position can be
thought of as being in the corder of the front and left walls.
Finally, ChannelMixMode::CustomWeights
mode can be used to use custom user-defined weights.
Methods
impl ChannelConverter
[src]
pub fn new(config: &ChannelConverterConfig) -> Result<ChannelConverter, Error>
[src]
pub fn format(&self) -> Format
[src]
pub fn channels_in(&self) -> u32
[src]
pub fn channels_out(&self) -> u32
[src]
pub fn channel_map_in(&self) -> &[Channel]
[src]
pub fn channel_map_out(&self) -> &[Channel]
[src]
pub fn mixing_mode(&self) -> ChannelMixMode
[src]
pub fn is_passthrough(&self) -> bool
[src]
pub fn is_simple_shuffle(&self) -> bool
[src]
pub fn is_simple_mono_expansion(&self) -> bool
[src]
pub fn is_stereo_to_mono(&self) -> bool
[src]
pub fn shuffle_table(&self) -> &[u8; 32]
[src]
pub fn process_pcm_frames(
&mut self,
output: &mut FramesMut,
input: &Frames
) -> Result<(), Error>
[src]
&mut self,
output: &mut FramesMut,
input: &Frames
) -> Result<(), Error>
Trait Implementations
impl Clone for ChannelConverter
[src]
fn clone(&self) -> ChannelConverter
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for ChannelConverter
[src]
Auto Trait Implementations
impl RefUnwindSafe for ChannelConverter
impl Send for ChannelConverter
impl Sync for ChannelConverter
impl Unpin for ChannelConverter
impl UnwindSafe for ChannelConverter
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,