Skip to main content

SynthEngine

Struct SynthEngine 

Source
pub struct SynthEngine { /* private fields */ }

Implementations§

Source§

impl SynthEngine

Source

pub fn new() -> Result<Self, SynthError>

Source

pub fn get_sample_cache(&self) -> &HashMap<String, SampleData>

Source

pub fn load_sample( &mut self, name: &str, path: &str, ) -> Result<(), Box<dyn Error>>

Load a .wav file into the sample cache

Source

pub fn load_melody( &mut self, name: &str, path: &str, ) -> Result<(), Box<dyn Error>>

Source

pub fn load_arrangement(&self, path: &str) -> Result<Arrangement, SynthError>

Source

pub fn play_arrangement( &mut self, arrangement: Arrangement, ) -> Result<(), SynthError>

Source

pub fn crossfade_to( &mut self, new_arrangement: Arrangement, duration: f32, ) -> Result<(), SynthError>

Source

pub fn set_loop_enabled(&self, enabled: bool)

Source

pub fn pause(&self)

Source

pub fn resume(&self)

Source

pub fn stop(&mut self)

Source

pub fn set_master_volume(&self, volume: f32)

Source

pub fn set_master_pitch(&self, pitch: f32)

Source

pub fn set_track_enabled(&self, track_name: &str, enabled: bool)

Source

pub fn set_track_volume(&self, track_name: &str, volume: f32)

Source

pub fn interpolate_track_volume( &self, track_name: &str, target: f32, duration: f32, )

Source

pub fn get_playback_position(&self) -> f32

Source

pub fn get_playback_state(&self) -> PlaybackState

Source

pub fn synthesize_arrangement( &self, arrangement: &Arrangement, ) -> Result<Vec<f32>, SynthError>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.