pub struct AudioSynthManager { /* private fields */ }Implementations§
Source§impl AudioSynthManager
impl AudioSynthManager
pub fn new(sample_rate: Option<u32>) -> Result<Self>
pub fn set_envelope_config(&mut self, config: EnvelopeConfig)
pub fn start(&mut self) -> Result<()>
pub fn stop(&mut self) -> Result<()>
pub fn set_master_volume(&mut self, vol: f64) -> Result<()>
pub fn set_waveform(&mut self, wave_type: AudioWaveform) -> Result<()>
pub fn play_frequency(&mut self, frequency: f64, voice_id: usize) -> Result<()>
pub fn play_frequency_with_config( &mut self, frequency: f64, voice_id: usize, envelope_config: EnvelopeConfig, ) -> Result<()>
Sourcepub fn release_voice(&mut self, voice_id: usize) -> Result<()>
pub fn release_voice(&mut self, voice_id: usize) -> Result<()>
Release a specific voice (start release phase, don’t stop immediately)
Sourcepub fn stop_voice(&mut self, voice_id: usize) -> Result<()>
pub fn stop_voice(&mut self, voice_id: usize) -> Result<()>
Stop a voice immediately (use sparingly, prefer release_voice)
Sourcepub fn update_voice_frequency(
&mut self,
voice_id: usize,
frequency: f64,
_amplitude: f64,
) -> Result<()>
pub fn update_voice_frequency( &mut self, voice_id: usize, frequency: f64, _amplitude: f64, ) -> Result<()>
Update frequency and amplitude for a voice with smooth transition
Sourcepub fn play_note(&mut self, note: MusicalNote) -> Result<()>
pub fn play_note(&mut self, note: MusicalNote) -> Result<()>
Play a note with proper voice allocation
Sourcepub fn play_note_with_config(
&mut self,
note: MusicalNote,
envelope_config: EnvelopeConfig,
) -> Result<()>
pub fn play_note_with_config( &mut self, note: MusicalNote, envelope_config: EnvelopeConfig, ) -> Result<()>
Play a note with custom envelope
Sourcepub fn stop_note(&mut self, note: MusicalNote) -> Result<()>
pub fn stop_note(&mut self, note: MusicalNote) -> Result<()>
Release a specific note
Sourcepub fn stop_all_notes(&mut self) -> Result<()>
pub fn stop_all_notes(&mut self) -> Result<()>
Release all notes
pub fn waveform(&self) -> AudioWaveform
pub fn master_volume(&self) -> f64
pub fn is_active(&self) -> bool
pub fn active_notes(&self) -> Vec<MusicalNote>
pub fn sample_rate(&self) -> u32
Sourcepub fn get_voice_level(&self, voice_id: usize) -> f32
pub fn get_voice_level(&self, voice_id: usize) -> f32
Get the current envelope level for a voice (useful for visualization)
Sourcepub fn is_voice_active(&self, voice_id: usize) -> bool
pub fn is_voice_active(&self, voice_id: usize) -> bool
Check if a specific voice is active
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioSynthManager
impl RefUnwindSafe for AudioSynthManager
impl Send for AudioSynthManager
impl Sync for AudioSynthManager
impl Unpin for AudioSynthManager
impl UnsafeUnpin for AudioSynthManager
impl UnwindSafe for AudioSynthManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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