/// Converts the contents of an AudioBuffer into an equivalent destination AudioBuffer of a
/// different type. If the types are the same then this is a copy operation.
Converts the contents of an AudioBuffer into an equivalent destination AudioBuffer of a
different type. If the types are the same then this is a copy operation.
Converts the contents of an AudioBuffer into an equivalent destination AudioBuffer of a different type . If the types are the same then this is a copy operation .
pub fn convert<T: Sample>(&self, dest: &mut AudioBuffer<T>)
    where
        S: IntoSample<T>
    {
        assert!(dest.n_frames == self.n_frames);
        assert!(dest.n_capacity == self.n_capacity);
        assert!(dest.spec == self.spec);
        for c in 0..self.spec.channels.count() {
            let begin = c * self.n_capacity;
            let end = begin + self.n_frames;
            for (d, s) in dest.buf[begin..end].iter_mut().zip(&self.buf[begin..end]) {
                *d = (*s).into_sample();
            }
        }
    }
pub fn convert < T : Sample > ( & self , dest : & mut AudioBuffer < T > ) where S : IntoSample < T > { assert ! ( dest n_frames self n_frames ) ; assert ! ( dest n_capacity self n_capacity ) ; assert ! ( dest spec self spec ) ; for c in 0 .. self . spec . channels . count ( ) { let begin = c * self . n_capacity ; let end = begin + self . n_frames ; for ( d , s ) in dest . buf [ begin .. end ] . iter_mut ( ) . zip ( & self . buf [ begin .. end ] ) { * d = ( * s ) . into_sample ( ) ; } } }
Converts the contents of an AudioBuffer into an equivalent destination AudioBuffer of a
different type.
Converts the contents of an AudioBuffer into an equivalent destination AudioBuffer of a different type .
&self
dest
&mut AudioBuffer<T>