Skip to main content

WaveformPlayer

Struct WaveformPlayer 

Source
pub struct WaveformPlayer { /* private fields */ }
Expand description

Plays one Waveform into a sink’s buffers: mono and stereo to any sink with a channel mapping, no resampling. Create it with the sink’s config, keep the PlayerControl, and hand WaveformPlayer::into_render to AudioSink::start. It starts paused.

Implementations§

Source§

impl WaveformPlayer

Source

pub fn new( waveform: Waveform, config: &SinkConfig, ) -> Result<(WaveformPlayer, PlayerControl), PlayerError>

Source

pub fn render(&mut self, out: &mut [f32])

Fills out (interleaved, a whole number of output frames; any trailing partial frame is silenced). Allocation-free and lock-free.

Source

pub fn into_render(self) -> RenderFn

The render function for AudioSink::start.

Auto Trait Implementations§

§

impl Forget for WaveformPlayer

§

impl Freeze for WaveformPlayer
where *const ArcInner<[f32]> is !null: Freeze, PhantomData<ArcInner<[f32]>>: Freeze, *const ArcInner<Shared> is !null: Freeze, PhantomData<ArcInner<Shared>>: Freeze,

§

impl Move for WaveformPlayer

§

impl RefUnwindSafe for WaveformPlayer

§

impl Send for WaveformPlayer
where Arc<[f32]>: Send, Arc<Shared>: Send,

§

impl Sync for WaveformPlayer
where Arc<[f32]>: Sync, Arc<Shared>: Sync,

§

impl Unpin for WaveformPlayer
where Arc<[f32]>: Unpin, Arc<Shared>: Unpin,

§

impl UnsafeUnpin for WaveformPlayer
where *const ArcInner<[f32]> is !null: UnsafeUnpin, PhantomData<ArcInner<[f32]>>: UnsafeUnpin, *const ArcInner<Shared> is !null: UnsafeUnpin, PhantomData<ArcInner<Shared>>: UnsafeUnpin,

§

impl UnwindSafe for WaveformPlayer
where Arc<[f32]>: UnwindSafe, Arc<Shared>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.