#[non_exhaustive]pub struct Synthesizer { /* private fields */ }Expand description
An instance of the SoundFont synthesizer.
Implementations§
Source§impl Synthesizer
impl Synthesizer
Sourcepub const CHANNEL_COUNT: usize = 16usize
pub const CHANNEL_COUNT: usize = 16usize
The number of channels.
Sourcepub const PERCUSSION_CHANNEL: usize = 9usize
pub const PERCUSSION_CHANNEL: usize = 9usize
The percussion channel.
Sourcepub fn new(
sound_font: &Arc<SoundFont>,
settings: &SynthesizerSettings,
) -> Result<Self, SynthesizerError>
pub fn new( sound_font: &Arc<SoundFont>, settings: &SynthesizerSettings, ) -> Result<Self, SynthesizerError>
Initializes a new synthesizer using a specified SoundFont and settings.
§Arguments
sound_font- The SoundFont instance.settings- The settings for synthesis.
Sourcepub fn process_midi_message(
&mut self,
channel: i32,
command: i32,
data1: i32,
data2: i32,
)
pub fn process_midi_message( &mut self, channel: i32, command: i32, data1: i32, data2: i32, )
Processes a MIDI message.
§Arguments
channel- The channel to which the message will be sent.command- The type of the message.data1- The first data part of the message.data2- The second data part of the message.
Sourcepub fn note_on(&mut self, channel: i32, key: i32, velocity: i32)
pub fn note_on(&mut self, channel: i32, key: i32, velocity: i32)
Starts a note.
§Arguments
channel- The channel of the note.key- The key of the note.velocity- The velocity of the note.
Sourcepub fn note_off_all(&mut self, immediate: bool)
pub fn note_off_all(&mut self, immediate: bool)
Stops all the notes in the specified channel.
§Arguments
immediate- Iftrue, notes will stop immediately without the release sound.
Sourcepub fn note_off_all_channel(&mut self, channel: i32, immediate: bool)
pub fn note_off_all_channel(&mut self, channel: i32, immediate: bool)
Stops all the notes in the specified channel.
§Arguments
channel- The channel in which the notes will be stopped.immediate- Iftrue, notes will stop immediately without the release sound.
Sourcepub fn reset_all_controllers(&mut self)
pub fn reset_all_controllers(&mut self)
Resets all the controllers.
Sourcepub fn reset_all_controllers_channel(&mut self, channel: i32)
pub fn reset_all_controllers_channel(&mut self, channel: i32)
Sourcepub fn get_sound_font(&self) -> &SoundFont
pub fn get_sound_font(&self) -> &SoundFont
Gets the SoundFont used as the audio source.
Sourcepub fn get_sample_rate(&self) -> i32
pub fn get_sample_rate(&self) -> i32
Gets the sample rate for synthesis.
Sourcepub fn get_block_size(&self) -> usize
pub fn get_block_size(&self) -> usize
Gets the block size for rendering waveform.
Sourcepub fn get_maximum_polyphony(&self) -> usize
pub fn get_maximum_polyphony(&self) -> usize
Gets the number of maximum polyphony.
Sourcepub fn get_enable_reverb_and_chorus(&self) -> bool
pub fn get_enable_reverb_and_chorus(&self) -> bool
Gets the value indicating whether reverb and chorus are enabled.
Sourcepub fn get_master_volume(&self) -> f32
pub fn get_master_volume(&self) -> f32
Gets the master volume.
Sourcepub fn set_master_volume(&mut self, value: f32)
pub fn set_master_volume(&mut self, value: f32)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Synthesizer
impl RefUnwindSafe for Synthesizer
impl Send for Synthesizer
impl Sync for Synthesizer
impl Unpin for Synthesizer
impl UnwindSafe for Synthesizer
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