pub fn new(duration: Duration, spec: SignalSpec) -> RawSampleBuffer<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);

        // Allocate enough memory for all the samples.
        let byte_length = n_samples as usize * mem::size_of::<S::StreamType>();
        let buf = vec![0u8; byte_length];

        RawSampleBuffer {
            buf,
            n_written: 0,
            sample_format: PhantomData,
        }
    }
/// Instantiate a new `RawSampleBuffer` using the specified signal specification and of the given
/// duration.
Instantiate a new `RawSampleBuffer` using the specified signal specification and of the given
duration.
Instantiate a new ` RawSampleBuffer ` using the specified signal specification and of the given duration .
pub fn new(duration: Duration, spec: SignalSpec) -> RawSampleBuffer<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);
        // Allocate enough memory for all the samples.
        let byte_length = n_samples as usize * mem::size_of::<S::StreamType>();
        let buf = vec![0u8; byte_length];
        RawSampleBuffer {
            buf,
            n_written: 0,
            sample_format: PhantomData,
        }
    }
pub fn new ( duration : Duration , spec : SignalSpec ) -> RawSampleBuffer < 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 ) ; // Allocate enough memory for all the samples. let byte_length = n_samples as usize * mem :: size_of :: < S :: StreamType > ( ) ; let buf = vec ! [ 0u8 byte_length ] ; RawSampleBuffer { buf , n_written : 0 , sample_format : PhantomData , } }
Instantiate a new `RawSampleBuffer` using the specified signal specification and of the given
duration.
Instantiate a new ` RawSampleBuffer ` using the specified signal specification and of the given duration .
duration
Duration
spec
SignalSpec
duration
Duration
spec
SignalSpec