Skip to main content

SynthSourceImpl

Struct SynthSourceImpl 

Source
pub struct SynthSourceImpl<Generator>
where Generator: SynthSourceGenerator + Send + Sync,
{ /* private fields */ }
Expand description

A synth source which runs an externally defined synth source generator.

Implementations§

Source§

impl<Generator> SynthSourceImpl<Generator>
where Generator: SynthSourceGenerator + Send + Sync,

Source

pub fn new( generator_name: &str, generator: Generator, options: SynthPlaybackOptions, sample_rate: u32, ) -> Result<Self, Error>

Trait Implementations§

Source§

impl<Generator> Source for SynthSourceImpl<Generator>
where Generator: SynthSourceGenerator + Send + Sync + 'static,

Source§

fn channel_count(&self) -> usize

The source’s output channel count.
Source§

fn sample_rate(&self) -> u32

The source’s output sample rate.
Source§

fn is_exhausted(&self) -> bool

Returns whether the source finished playback. Exhausted sources should only return 0 on write and may be removed from a source render graph.
Source§

fn weight(&self) -> usize

Return a rough estimate of the processing costs for this source in range ~1..10, where 1 means pretty lightweight and 10 very CPU intensive. This is used in parallel processing to distribute work loads evenly before or without actual CPU measurements.
Source§

fn write(&mut self, output: &mut [f32], time: &SourceTime) -> usize

Write at most output.len() samples into the interleaved output The given SourceTime parameter specifies which absolute time this buffer in the final output stream refers to. It can be used to schedule and apply real-time events. Returns the number of written samples (not frames).
Source§

fn into_box(self) -> Box<dyn Source>
where Self: Sized,

Convert the Source impl into a boxed dyn Source. Read more
Source§

impl<Generator> SynthSource for SynthSourceImpl<Generator>
where Generator: SynthSourceGenerator + Send + Sync + 'static,

Source§

fn synth_name(&self) -> String

Name of the synth for debugging or display purposes.
Source§

fn playback_id(&self) -> PlaybackId

A unique ID, which can be used to identify sources in PlaybackStatusEvents
Source§

fn playback_options(&self) -> &SynthPlaybackOptions

The synth source’s playback options
Source§

fn playback_message_queue(&self) -> Arc<ArrayQueue<SynthPlaybackMessage>>

Message queue to control this sources’s playback.
Source§

fn playback_status_sender(&self) -> Option<SyncSender<PlaybackStatusEvent>>

Channel to receive file playback status from the synth.
Source§

fn set_playback_status_sender( &mut self, sender: Option<SyncSender<PlaybackStatusEvent>>, )

Source§

fn playback_status_context(&self) -> Option<PlaybackStatusContext>

Optional context passed along with the playback status.
Source§

fn set_playback_status_context( &mut self, context: Option<PlaybackStatusContext>, )

Auto Trait Implementations§

§

impl<Generator> !RefUnwindSafe for SynthSourceImpl<Generator>

§

impl<Generator> !UnwindSafe for SynthSourceImpl<Generator>

§

impl<Generator> Freeze for SynthSourceImpl<Generator>

§

impl<Generator> Send for SynthSourceImpl<Generator>

§

impl<Generator> Sync for SynthSourceImpl<Generator>

§

impl<Generator> Unpin for SynthSourceImpl<Generator>

§

impl<Generator> UnsafeUnpin for SynthSourceImpl<Generator>

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V