Function dsp::slice::from_sample_slice_mut [] [src]

pub fn from_sample_slice_mut<'a, T, S>(slice: &'a mut [S]) -> Option<T> where S: Sample, T: FromSampleSliceMut<'a, S>

Converts the given mutable slice of Samples into some mutable slice T.

Returns None if the number of channels in a single frame is not a multiple of the number of samples in the given slice.

This is a convenience function that wraps the FromSampleSliceMut trait.

Examples

extern crate sample;

fn main() {
    let foo = &mut [0.0, 0.5, 0.0, -0.5][..];
    let bar: Option<&mut _> = sample::slice::from_sample_slice_mut(foo);
    assert_eq!(bar, Some(&mut [[0.0, 0.5], [0.0, -0.5]][..]));
}