pub struct RealtimeSynth { /* private fields */ }
Expand description
A realtime MIDI synthesizer using an audio device for output.
Implementations§
Source§impl RealtimeSynth
impl RealtimeSynth
Sourcepub fn open_with_all_defaults() -> Self
pub fn open_with_all_defaults() -> Self
Initializes a new realtime synthesizer using the default config and the default audio output.
Sourcepub fn open_with_default_output(config: XSynthRealtimeConfig) -> Self
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.
Sourcepub fn open(
config: XSynthRealtimeConfig,
device: &Device,
stream_config: SupportedStreamConfig,
) -> Self
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.
Sourcepub fn send_event(&mut self, event: SynthEvent)
pub fn send_event(&mut self, event: SynthEvent)
Sends a SynthEvent to the realtime synthesizer.
See the SynthEvent
documentation for more information.
Sourcepub fn send_event_u32(&mut self, event: u32)
pub fn send_event_u32(&mut self, event: u32)
Sends a u32 event to the realtime synthesizer.
Sourcepub fn get_sender_ref(&self) -> &RealtimeEventSender
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.
Sourcepub fn get_sender_mut(&mut self) -> &mut RealtimeEventSender
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.
Sourcepub fn get_stats(&self) -> RealtimeSynthStatsReader
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.
Sourcepub fn stream_params(&self) -> AudioStreamParams
pub fn stream_params(&self) -> AudioStreamParams
Returns the stream parameters of the audio output device.
Sourcepub fn pause(&mut self) -> Result<(), PauseStreamError>
pub fn pause(&mut self) -> Result<(), PauseStreamError>
Pauses the playback of the audio output device.
Sourcepub fn resume(&mut self) -> Result<(), PlayStreamError>
pub fn resume(&mut self) -> Result<(), PlayStreamError>
Resumes the playback of the audio output device.
Sourcepub fn set_buffer(&self, render_window_ms: f64)
pub fn set_buffer(&self, render_window_ms: f64)
Changes the length of the buffer reader.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RealtimeSynth
impl !RefUnwindSafe for RealtimeSynth
impl Send for RealtimeSynth
impl Sync for RealtimeSynth
impl Unpin for RealtimeSynth
impl !UnwindSafe for RealtimeSynth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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