Struct rsynth::backend::combined::memory::AudioChunkReader [−][src]
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]
T: Borrow<AudioChunk<S>>,
S: Copy,
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]
T: Borrow<AudioChunk<S>>,
S: Copy,
type Err = Infallible
The type of the error that occurs when reading data.
fn number_of_channels(&self) -> usize
[src]
fn frames_per_second(&self) -> u64
[src]
fn fill_buffer(
&mut self,
output: &mut AudioBufferOut<'_, '_, S>
) -> Result<usize, Self::Err>
[src]
&mut self,
output: &mut AudioBufferOut<'_, '_, S>
) -> Result<usize, Self::Err>
impl<S> From<(Header, BitDepth)> for AudioChunkReader<S, AudioChunk<S>> where
S: Copy + FromSample<u8> + FromSample<i16> + FromSample<I24> + FromSample<f32>,
[src]
S: Copy + FromSample<u8> + FromSample<i16> + FromSample<I24> + FromSample<f32>,
Auto Trait Implementations
impl<S, T> RefUnwindSafe for AudioChunkReader<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for AudioChunkReader<S, T> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<S, T> Sync for AudioChunkReader<S, T> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<S, T> Unpin for AudioChunkReader<S, T> where
S: Unpin,
T: Unpin,
S: Unpin,
T: Unpin,
impl<S, T> UnwindSafe for AudioChunkReader<S, T> where
S: UnwindSafe,
T: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<S, T> Duplex<S> for T where
T: FromSample<S> + ToSample<S>,
T: FromSample<S> + ToSample<S>,
impl<T> From<T> for T
[src]
impl<S> FromSample<S> for S
pub fn from_sample_(s: S) -> S
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> ToSample<U> for T where
U: FromSample<T>,
U: FromSample<T>,
pub fn to_sample_(self) -> U
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,