Struct rsynth::backend::combined::memory::AudioChunkReader[][src]

pub struct AudioChunkReader<S, T> where
    T: Borrow<AudioChunk<S>>,
    S: Copy
{ /* fields omitted */ }

An AudioReader that reads from a given AudioChunk. The generic parameter type S represents the sample type.

Example

The following example illustrates how an AudioChunk can be generated from a wav file.

Remark the example assumes the rsynth crate is compiled with the backend-combined-wav-0-6 feature.

Remark the example does not use proper error handling.

use std::fs::File;
use std::path::Path;
use rsynth::backend::combined::memory::{AudioChunkReader, wav_0_6::read};

fn create_reader_from_file(filename: &str) {
    let mut file = File::open(Path::new(filename)).unwrap();
    let (header, samples) = read(&mut file).unwrap();
    let reader = AudioChunkReader::<f32, _>::from((header, samples));
}

Implementations

impl<S, T> AudioChunkReader<S, T> where
    T: Borrow<AudioChunk<S>>,
    S: Copy
[src]

pub fn new(buffer: T, frames_per_second: u64) -> Self[src]

Construct a new AudioChunkReader with the given AudioChunk and sample rate in frames per second.

Trait Implementations

impl<S, T> AudioReader<S> for AudioChunkReader<S, T> where
    T: Borrow<AudioChunk<S>>,
    S: Copy
[src]

type Err = Infallible

The type of the error that occurs when reading data.

impl<S> From<(Header, BitDepth)> for AudioChunkReader<S, AudioChunk<S>> where
    S: Copy + FromSample<u8> + FromSample<i16> + FromSample<I24> + FromSample<f32>, 
[src]

Auto Trait Implementations

impl<S, T> RefUnwindSafe for AudioChunkReader<S, T> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

impl<S, T> Send for AudioChunkReader<S, T> where
    S: Send,
    T: Send

impl<S, T> Sync for AudioChunkReader<S, T> where
    S: Sync,
    T: Sync

impl<S, T> Unpin for AudioChunkReader<S, T> where
    S: Unpin,
    T: Unpin

impl<S, T> UnwindSafe for AudioChunkReader<S, T> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 

impl<T> From<T> for T[src]

impl<S> FromSample<S> for S

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.