pub struct CM32LWeb { /* private fields */ }Expand description
CM-32L synthesizer with Web Audio output.
Wraps a moont::CM32L 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 CM32LWeb
impl CM32LWeb
Sourcepub fn from_rom(control_rom: &[u8], pcm_rom: &[u8]) -> Result<CM32LWeb, JsValue>
pub fn from_rom(control_rom: &[u8], pcm_rom: &[u8]) -> Result<CM32LWeb, 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 FromWasmAbi for CM32LWeb
impl FromWasmAbi for CM32LWeb
Source§impl IntoWasmAbi for CM32LWeb
impl IntoWasmAbi for CM32LWeb
Source§impl LongRefFromWasmAbi for CM32LWeb
impl LongRefFromWasmAbi for CM32LWeb
Source§impl OptionFromWasmAbi for CM32LWeb
impl OptionFromWasmAbi for CM32LWeb
Source§impl OptionIntoWasmAbi for CM32LWeb
impl OptionIntoWasmAbi for CM32LWeb
Source§impl RefFromWasmAbi for CM32LWeb
impl RefFromWasmAbi for CM32LWeb
Source§impl RefMutFromWasmAbi for CM32LWeb
impl RefMutFromWasmAbi for CM32LWeb
Source§impl TryFromJsValue for CM32LWeb
impl TryFromJsValue for CM32LWeb
Source§impl VectorFromWasmAbi for CM32LWeb
impl VectorFromWasmAbi for CM32LWeb
Source§impl VectorIntoWasmAbi for CM32LWeb
impl VectorIntoWasmAbi for CM32LWeb
impl SupportsConstructor for CM32LWeb
impl SupportsInstanceProperty for CM32LWeb
impl SupportsStaticProperty for CM32LWeb
Auto Trait Implementations§
impl Freeze for CM32LWeb
impl !RefUnwindSafe for CM32LWeb
impl !Send for CM32LWeb
impl !Sync for CM32LWeb
impl Unpin for CM32LWeb
impl UnsafeUnpin for CM32LWeb
impl !UnwindSafe for CM32LWeb
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.