pub struct Cm32lSynth { /* private fields */ }Expand description
CM-32L synthesizer with Web Audio output.
Wraps a moont::cm32l::Device and connects it to a Web Audio
ScriptProcessorNode for real-time 32 kHz stereo playback.
Supports both live MIDI input (play_midi,
play_sysex) and SMF file playback
(load_smf).
Implementations§
Source§impl Cm32lSynth
impl Cm32lSynth
Sourcepub fn from_rom(
control_rom: &[u8],
pcm_rom: &[u8],
) -> Result<Cm32lSynth, JsValue>
pub fn from_rom( control_rom: &[u8], pcm_rom: &[u8], ) -> Result<Cm32lSynth, JsValue>
Creates a new CM-32L synthesizer from dynamically loaded ROM data.
Pass the full contents of the CM-32L control ROM (64 KiB) and PCM ROM (1 MiB) as byte slices.
Sourcepub fn play_midi(&self, data: &[u8]) -> bool
pub fn play_midi(&self, data: &[u8]) -> bool
Plays a MIDI channel message from raw bytes (1-3 bytes).
Returns true if the message was successfully enqueued.
Sourcepub fn play_sysex(&self, data: &[u8]) -> bool
pub fn play_sysex(&self, data: &[u8]) -> bool
Plays a SysEx message from raw bytes.
Returns true if the message was successfully enqueued.
Sourcepub fn load_smf(&self, data: &[u8]) -> Result<f64, JsValue>
pub fn load_smf(&self, data: &[u8]) -> Result<f64, JsValue>
Loads an SMF (Standard MIDI File) for incremental playback.
Events are fed to the synthesizer incrementally during audio rendering. All event times are offset by the current synth time so playback starts immediately. Returns the total duration in seconds, or throws on parse error.
Sourcepub fn smf_elapsed(&self) -> f64
pub fn smf_elapsed(&self) -> f64
Returns elapsed playback time of the current SMF in seconds.
Sourcepub fn current_time(&self) -> f64
pub fn current_time(&self) -> f64
Returns the current playback position in seconds.
Trait Implementations§
Source§impl From<Cm32lSynth> for JsValue
impl From<Cm32lSynth> for JsValue
Source§fn from(value: Cm32lSynth) -> Self
fn from(value: Cm32lSynth) -> Self
Source§impl FromWasmAbi for Cm32lSynth
impl FromWasmAbi for Cm32lSynth
Source§impl IntoWasmAbi for Cm32lSynth
impl IntoWasmAbi for Cm32lSynth
Source§impl LongRefFromWasmAbi for Cm32lSynth
impl LongRefFromWasmAbi for Cm32lSynth
Source§impl OptionFromWasmAbi for Cm32lSynth
impl OptionFromWasmAbi for Cm32lSynth
Source§impl OptionIntoWasmAbi for Cm32lSynth
impl OptionIntoWasmAbi for Cm32lSynth
Source§impl RefFromWasmAbi for Cm32lSynth
impl RefFromWasmAbi for Cm32lSynth
Source§type Anchor = RcRef<Cm32lSynth>
type Anchor = RcRef<Cm32lSynth>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for Cm32lSynth
impl RefMutFromWasmAbi for Cm32lSynth
Source§impl TryFromJsValue for Cm32lSynth
impl TryFromJsValue for Cm32lSynth
Source§impl VectorFromWasmAbi for Cm32lSynth
impl VectorFromWasmAbi for Cm32lSynth
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Cm32lSynth]>
Source§impl VectorIntoWasmAbi for Cm32lSynth
impl VectorIntoWasmAbi for Cm32lSynth
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Cm32lSynth]>) -> Self::Abi
Source§impl WasmDescribeVector for Cm32lSynth
impl WasmDescribeVector for Cm32lSynth
impl SupportsConstructor for Cm32lSynth
impl SupportsInstanceProperty for Cm32lSynth
impl SupportsStaticProperty for Cm32lSynth
Auto Trait Implementations§
impl Freeze for Cm32lSynth
impl !RefUnwindSafe for Cm32lSynth
impl !Send for Cm32lSynth
impl !Sync for Cm32lSynth
impl Unpin for Cm32lSynth
impl UnsafeUnpin for Cm32lSynth
impl !UnwindSafe for Cm32lSynth
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<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.