/// Instantiate a new `SampleBuffer` using the specified signal specification and of the given
/// duration.
Instantiate a new `SampleBuffer` using the specified signal specification and of the given
duration.
Instantiate a new ` SampleBuffer ` using the specified signal specification and of the given duration .
pub fn new(duration: Duration, spec: SignalSpec) -> SampleBuffer<S> {
        let n_samples = duration * spec.channels.count() as u64;
        // Practically speaking, it is not possible to allocate more than usize samples.
        assert!(n_samples <= usize::max_value() as u64);
        SampleBuffer {
            buf: vec![S::MID; n_samples as usize],
            n_written: 0,
        }
    }
pub fn new ( duration : Duration , spec : SignalSpec ) -> SampleBuffer < S > { let n_samples = duration * spec . channels . count ( ) as u64 ; // Practically speaking, it is not possible to allocate more than usize samples. assert ! ( n_samples usize max_value ( ) as u64 ) ; SampleBuffer { buf : vec ! [ S MID n_samples as usize ] , n_written : 0 , } }
Instantiate a new `SampleBuffer` using the specified signal specification and of the given
duration.
Instantiate a new ` SampleBuffer ` using the specified signal specification and of the given duration .
duration
Duration
spec
SignalSpec