Struct RealtimeSynth

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

A realtime MIDI synthesizer using an audio device for output.

Implementations§

Source§

impl RealtimeSynth

Source

pub fn open_with_all_defaults() -> Self

Initializes a new realtime synthesizer using the default config and the default audio output.

Source

pub fn open_with_default_output(config: XSynthRealtimeConfig) -> Self

Initializes as new realtime synthesizer using a given config and the default audio output.

See the XSynthRealtimeConfig documentation for the available options.

Source

pub fn open( config: XSynthRealtimeConfig, device: &Device, stream_config: SupportedStreamConfig, ) -> Self

Initializes a new realtime synthesizer using a given config and a specified audio output device.

See the XSynthRealtimeConfig documentation for the available options. See the cpal crate documentation for the device and stream_config parameters.

Source

pub fn send_event(&mut self, event: SynthEvent)

Sends a SynthEvent to the realtime synthesizer.

See the SynthEvent documentation for more information.

Source

pub fn send_event_u32(&mut self, event: u32)

Sends a u32 event to the realtime synthesizer.

Source

pub fn get_sender_ref(&self) -> &RealtimeEventSender

Returns a reference to the event sender of the realtime synthesizer. This can be used to clone the sender so it can be passed in threads.

See the RealtimeEventSender documentation for more information on how to use.

Source

pub fn get_sender_mut(&mut self) -> &mut RealtimeEventSender

Returns a mutable reference the event sender of the realtime synthesizer. This can be used to modify its parameters (eg. ignore range). Please note that each clone will store its own distinct parameters.

See the RealtimeEventSender documentation for more information on how to use.

Source

pub fn get_stats(&self) -> RealtimeSynthStatsReader

Returns the statistics reader of the realtime synthesizer.

See the RealtimeSynthStatsReader documentation for more information on how to use.

Source

pub fn stream_params(&self) -> AudioStreamParams

Returns the stream parameters of the audio output device.

Source

pub fn pause(&mut self) -> Result<(), PauseStreamError>

Pauses the playback of the audio output device.

Source

pub fn resume(&mut self) -> Result<(), PlayStreamError>

Resumes the playback of the audio output device.

Source

pub fn set_buffer(&self, render_window_ms: f64)

Changes the length of the buffer reader.

Trait Implementations§

Source§

impl Drop for RealtimeSynth

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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<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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,