bae_rs::sounds::simple_sound

Struct SimpleSound

Source
pub struct SimpleSound { /* private fields */ }
Expand description

Struct implementing the ability to run a single Generator through a given list of Modifiers operated in series. This allows for simple and fast processing of the structure’s elements while still allowing for a wide range of more complex sounds.

Implementations§

Source§

impl SimpleSound

Source

pub fn new(input_gain: MathT, output_gain: MathT, generator: BlockSP) -> Self

Constructs a new SimpleSound object. The new object is initialized with an empty Vec of Modifiers. Add Modifiers with add_modifier or extend_modifiers.

Source

pub fn add_modifier<M>(&mut self, m: BlockSP)
where M: 'static + Clone,

Adds a single modifier to the internal Vec of Modifiers.

Source

pub fn extend_modifiers(&mut self, m_list: Vec<BlockSP>)

Extends the internal Vec of Modifiers with the given Vec.

Source

pub fn get_input_gain(&self) -> MathT

Returns the linear gain applied to the input during processing.

Source

pub fn get_output_gain(&self) -> MathT

Returns the linear gain applied to the output during processing.

Source

pub fn set_input_gain(&mut self, g: MathT)

Sets the input linear gain that is applied during processing.

Source

pub fn set_output_gain(&mut self, g: MathT)

Sets the output linear gain that is applied during processing.

Trait Implementations§

Source§

impl Clone for SimpleSound

Source§

fn clone(&self) -> SimpleSound

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Sound for SimpleSound

Source§

fn toggle_pause(&mut self)

Toggles the pause state of the sound. If the sound is paused, the internal structures aren’t process during a call to process, instead only Default::default() is returned.
Source§

fn is_paused(&self) -> bool

Returns the pause state of the sound.
Source§

fn toggle_mute(&mut self)

Toggles the mute state of the sound. If the sound is muted, the internal structures are still processed during a call to process, but Default::default() is returned.
Source§

fn is_muted(&self) -> bool

Returns the mute state of the sound.
Source§

fn register(&mut self, id: usize)

Sets itself as registered with the given ID. Read more
Source§

fn unregister(&mut self)

Sets itself as unregistered and clears the saved ID. Read more
Source§

fn process(&mut self, input: SampleT) -> SampleT

Processes the sound and its internal structures, returning the resulting audio sample. Read more
Source§

fn get_id(&self) -> Option<usize>

Returns the ID given to the Sound during registration with a Channel. If the Sound is unregistered, it will return None.

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V