Function sample::signal::from_interleaved_samples [] [src]

pub fn from_interleaved_samples<I, F>(samples: I) -> FromInterleavedSamples<I, F> where I: Iterator, I::Item: Sample, F: Frame<Sample=I::Item>

An iterator that converts the given Iterator yielding Samples to a Signal yielding frames of type F.

Example

extern crate sample;

use sample::signal;

fn main() {
    let foo = [0, 1, 2, 3];
    let mut signal = signal::from_interleaved_samples::<_, [i32; 2]>(foo.iter().cloned());
    assert_eq!(signal.next(), Some([0, 1]));
    assert_eq!(signal.next(), Some([2, 3]));
    assert_eq!(signal.next(), None);

    let bar = [0, 1, 2];
    let mut signal = signal::from_interleaved_samples::<_, [i32; 2]>(bar.iter().cloned());
    assert_eq!(signal.next(), Some([0, 1]));
    assert_eq!(signal.next(), None);
}