[−][src]Struct fon::Audio
Audio buffer (array of audio Sample
s at sample rate specified in hertz).
Implementations
impl<S: Sample> Audio<S>
[src]
pub fn sample(&self, index: usize) -> &S
[src]
pub fn sample_mut(&mut self, index: usize) -> &mut S
[src]
pub fn samples(&self) -> &[S]
[src]
Get a slice of all samples.
pub fn samples_mut(&mut self) -> &mut [S]
[src]
Get a mutable slice of all samples.
pub fn iter(&self) -> Iter<'_, S>
[src]
Returns an iterator over the samples.
pub fn iter_mut(&mut self) -> IterMut<'_, S>
[src]
Returns an iterator that allows modifying each sample.
pub fn with_sample(s_rate: u32, len: usize, sample: S) -> Self
[src]
Construct an Audio
buffer with all samples set to one value.
pub fn with_silence(s_rate: u32, len: usize) -> Self
[src]
Construct an Audio
buffer with all all samples set to the default
value.
pub fn with_audio<SrcS: Sample>(s_rate: u32, src: &Audio<SrcS>) -> Self where
S::Chan: From<SrcS::Chan>,
[src]
S::Chan: From<SrcS::Chan>,
Construct an Audio
buffer with another Audio
buffer.
The audio format can be converted with this function.
pub fn with_samples<B: Into<Box<[S]>>>(s_rate: u32, samples: B) -> Self
[src]
Construct an Audio
buffer with owned sample data. You can get
ownership of the pixel data back from the Audio
buffer as either a
Vec<S>
or a Box<[S]>
by calling into().
pub fn with_i8_buffer<B>(s_rate: u32, buffer: B) -> Self where
B: Into<Box<[i8]>>,
S: Sample<Chan = Ch8>,
[src]
B: Into<Box<[i8]>>,
S: Sample<Chan = Ch8>,
Construct an Audio
buffer from an i8
buffer.
pub fn with_i16_buffer<B>(s_rate: u32, buffer: B) -> Self where
B: Into<Box<[i16]>>,
S: Sample<Chan = Ch16>,
[src]
B: Into<Box<[i16]>>,
S: Sample<Chan = Ch16>,
Construct an Audio
buffer from an i16
buffer.
pub fn with_f32_buffer<B>(s_rate: u32, buffer: B) -> Self where
B: Into<Box<[f32]>>,
S: Sample<Chan = Ch32>,
[src]
B: Into<Box<[f32]>>,
S: Sample<Chan = Ch32>,
Construct an Audio
buffer from an f32
buffer.
pub fn with_f64_buffer<B>(s_rate: u32, buffer: B) -> Self where
B: Into<Box<[f64]>>,
S: Sample<Chan = Ch64>,
[src]
B: Into<Box<[f64]>>,
S: Sample<Chan = Ch64>,
Construct an Audio
buffer from an f64
buffer.
pub fn len(&self) -> usize
[src]
Get the length of the Audio
buffer.
pub fn is_empty(&self) -> bool
[src]
Check if Audio
buffer is empty.
pub fn sample_rate(&self) -> u32
[src]
Get the sample rate of the Audio
buffer.
pub fn blend_sample<O: Blend, R: RangeBounds<usize> + SliceIndex<[S], Output = [S]>>(
&mut self,
reg: R,
sample: S,
op: O
)
[src]
&mut self,
reg: R,
sample: S,
op: O
)
Blend Audio
buffer with a single sample.
pub fn blend_audio<O: Blend, R: RangeBounds<usize> + SliceIndex<[S], Output = [S]>>(
&mut self,
reg: R,
other: &Self,
op: O
)
[src]
&mut self,
reg: R,
other: &Self,
op: O
)
Blend Audio
buffer with another Audio
buffer.
pub fn copy_silence<R: RangeBounds<usize> + SliceIndex<[S], Output = [S]>>(
&mut self,
reg: R
)
[src]
&mut self,
reg: R
)
pub fn copy_sample<R: RangeBounds<usize> + SliceIndex<[S], Output = [S]>>(
&mut self,
reg: R,
sample: S
)
[src]
&mut self,
reg: R,
sample: S
)
pub fn stream<'a, R: RangeBounds<usize> + SliceIndex<[S], Output = [S]> + 'a>(
&'a self,
reg: R
) -> impl Stream<S> + 'a
[src]
&'a self,
reg: R
) -> impl Stream<S> + 'a
pub fn drain<'a, R: RangeBounds<usize> + SliceIndex<[S], Output = [S]> + Clone + 'a>(
&'a mut self,
reg: R
) -> impl Stream<S> + 'a
[src]
&'a mut self,
reg: R
) -> impl Stream<S> + 'a
pub fn sink<'a, R: 'a + RangeBounds<usize> + SliceIndex<[S], Output = [S]>>(
&'a mut self,
reg: R
) -> impl Sink<S> + 'a
[src]
&'a mut self,
reg: R
) -> impl Sink<S> + 'a
pub fn extend<M: Stream<S>>(&mut self, stream: &mut M)
[src]
Extend the audio buffer with all of the audio from a stream.
Don't call this with an infinite stream! This is the only way to collect a stream without knowing the size ahead of time.
Trait Implementations
impl<S: Debug + Sample> Debug for Audio<S>
[src]
impl<S: Sample> From<Audio<S>> for Box<[S]>
[src]
impl<S: Sample> From<Audio<S>> for Vec<S>
[src]
impl<S> From<Audio<S>> for Box<[i8]> where
S: Sample<Chan = Ch8>,
[src]
S: Sample<Chan = Ch8>,
impl<S> From<Audio<S>> for Box<[i16]> where
S: Sample<Chan = Ch16>,
[src]
S: Sample<Chan = Ch16>,
impl<S> From<Audio<S>> for Box<[f32]> where
S: Sample<Chan = Ch32>,
[src]
S: Sample<Chan = Ch32>,
impl<S> From<Audio<S>> for Box<[f64]> where
S: Sample<Chan = Ch64>,
[src]
S: Sample<Chan = Ch64>,
Auto Trait Implementations
impl<S> RefUnwindSafe for Audio<S> where
S: RefUnwindSafe,
[src]
S: RefUnwindSafe,
impl<S> Send for Audio<S> where
S: Send,
[src]
S: Send,
impl<S> Sync for Audio<S> where
S: Sync,
[src]
S: Sync,
impl<S> Unpin for Audio<S>
[src]
impl<S> UnwindSafe for Audio<S> where
S: UnwindSafe,
[src]
S: 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<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,