pub fn new(duration: Duration, spec: SignalSpec) -> Self {
        let n_sample_capacity = duration * spec.channels.count() as u64;

        // Practically speaking, it is not possible to allocate more than usize samples.
        assert!(n_sample_capacity <= usize::max_value() as u64);

        // Allocate memory for the sample data and default initialize the sample to silence.
        let buf = vec![S::default(); n_sample_capacity as usize];

        AudioBuffer {
            buf,
            spec,
            n_frames: 0,
            n_capacity: duration as usize,
        }
    }
/// Instantiate a new `AudioBuffer` using the specified signal specification and of the given
/// duration.
Instantiate a new `AudioBuffer` using the specified signal specification and of the given
duration.
Instantiate a new ` AudioBuffer ` using the specified signal specification and of the given duration .
pub fn new(duration: Duration, spec: SignalSpec) -> Self {
        let n_sample_capacity = duration * spec.channels.count() as u64;
        // Practically speaking, it is not possible to allocate more than usize samples.
        assert!(n_sample_capacity <= usize::max_value() as u64);
        // Allocate memory for the sample data and default initialize the sample to silence.
        let buf = vec![S::default(); n_sample_capacity as usize];
        AudioBuffer {
            buf,
            spec,
            n_frames: 0,
            n_capacity: duration as usize,
        }
    }
pub fn new ( duration : Duration , spec : SignalSpec ) -> Self { let n_sample_capacity = duration * spec . channels . count ( ) as u64 ; // Practically speaking, it is not possible to allocate more than usize samples. assert ! ( n_sample_capacity usize max_value ( ) as u64 ) ; // Allocate memory for the sample data and default initialize the sample to silence. let buf = vec ! [ S default ( ) n_sample_capacity as usize ] ; AudioBuffer { buf , spec , n_frames : 0 , n_capacity : duration as usize , } }
Instantiate a new `AudioBuffer` using the specified signal specification and of the given
duration.
Instantiate a new ` AudioBuffer ` using the specified signal specification and of the given duration .
duration
Duration
spec
SignalSpec
duration
Duration
spec
SignalSpec