AudioBus

Struct AudioBus 

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

A class that represents an audio bus.

Implementations§

Source§

impl AudioBus

Source

pub fn set_volume(&mut self, val: f32)

Sets The volume of the audio bus. The value is between 0.0 and 1.0.

Source

pub fn get_volume(&self) -> f32

Gets The volume of the audio bus. The value is between 0.0 and 1.0.

Source

pub fn set_pan(&mut self, val: f32)

Sets The pan of the audio bus. The value is between -1.0 and 1.0.

Source

pub fn get_pan(&self) -> f32

Gets The pan of the audio bus. The value is between -1.0 and 1.0.

Source

pub fn set_play_speed(&mut self, val: f32)

Sets The play speed of the audio bus. The value 1.0 is the normal speed. 0.5 is half speed. 2.0 is double speed.

Source

pub fn get_play_speed(&self) -> f32

Gets The play speed of the audio bus. The value 1.0 is the normal speed. 0.5 is half speed. 2.0 is double speed.

Source

pub fn fade_volume(&mut self, time: f64, to_volume: f32)

Fades the volume of the audio bus to the given value over the given time.

§Arguments
  • time - The time to fade the volume.
  • toVolume - The target volume.
Source

pub fn fade_pan(&mut self, time: f64, to_pan: f32)

Fades the pan of the audio bus to the given value over the given time.

§Arguments
  • time - The time to fade the pan.
  • toPan - The target pan. The value is between -1.0 and 1.0.
Source

pub fn fade_play_speed(&mut self, time: f64, to_play_speed: f32)

Fades the play speed of the audio bus to the given value over the given time.

§Arguments
  • time - The time to fade the play speed.
  • toPlaySpeed - The target play speed.
Source

pub fn set_filter(&mut self, index: i32, name: &str)

Sets the filter of the audio bus.

§Arguments
  • index - The index of the filter.
  • name - The name of the filter.
    • “”: No filter.
    • “BassBoost”: The bass boost filter.
    • “BiquadResonant”: The biquad resonant filter.
    • “DCRemoval”: The DC removal filter.
    • “Echo”: The echo filter.
    • “Eq”: The equalizer filter.
    • “FFT”: The FFT filter.
    • “Flanger”: The flanger filter.
    • “FreeVerb”: The freeverb filter.
    • “Lofi”: The lofi filter.
    • “Robotize”: The robotize filter.
    • “WaveShaper”: The wave shaper filter.
Source

pub fn set_filter_parameter(&mut self, index: i32, attr_id: i32, value: f32)

Sets the filter parameter of the audio bus.

§Arguments
  • index - The index of the filter.
  • attrId - The attribute ID of the filter.
  • value - The value of the filter parameter.
    • “BassBoost”: The bass boost filter.
      • param0: WET, float, min: 0, max: 1
      • param1: BOOST, float, min: 0, max: 10
    • “BiquadResonant”: The biquad resonant filter.
      • param0: WET, float, min: 0, max: 1
      • param1: TYPE, int, values: 0 - LOWPASS, 1 - HIGHPASS, 2 - BANDPASS
      • param2: FREQUENCY, float, min: 10, max: 8000
      • param3: RESONANCE, float, min: 0.1, max: 20
    • “DCRemoval”: The DC removal filter.
      • param0: WET, float, min: 0, max: 1
    • “Echo”: The echo filter.
      • param0: WET, float, min: 0, max: 1
      • param1: DELAY, float, min: 0, max: 1
      • param2: DECAY, float, min: 0, max: 1
      • param3: FILTER, float, min: 0, max: 1
    • “Eq”: The equalizer filter.
      • param0: WET, float, min: 0, max: 1
      • param1: BAND0, float, min: 0, max: 4
      • param2: BAND1, float, min: 0, max: 4
      • param3: BAND2, float, min: 0, max: 4
      • param4: BAND3, float, min: 0, max: 4
      • param5: BAND4, float, min: 0, max: 4
      • param6: BAND5, float, min: 0, max: 4
      • param7: BAND6, float, min: 0, max: 4
      • param8: BAND7, float, min: 0, max: 4
    • “FFT”: The FFT filter.
      • param0: WET, float, min: 0, max: 1
    • “Flanger”: The flanger filter.
      • param0: WET, float, min: 0, max: 1
      • param1: DELAY, float, min: 0.001, max: 0.1
      • param2: FREQ, float, min: 0.001, max: 100
    • “FreeVerb”: The freeverb filter.
      • param0: WET, float, min: 0, max: 1
      • param1: FREEZE, float, min: 0, max: 1
      • param2: ROOMSIZE, float, min: 0, max: 1
      • param3: DAMP, float, min: 0, max: 1
      • param4: WIDTH, float, min: 0, max: 1
    • “Lofi”: The lofi filter.
      • param0: WET, float, min: 0, max: 1
      • param1: SAMPLE_RATE, float, min: 100, max: 22000
      • param2: BITDEPTH, float, min: 0.5, max: 16
    • “Robotize”: The robotize filter.
      • param0: WET, float, min: 0, max: 1
      • param1: FREQ, float, min: 0.1, max: 100
      • param2: WAVE, float, min: 0, max: 6
    • “WaveShaper”: The wave shaper filter.
      • param0: WET, float, min: 0, max: 1
      • param1: AMOUNT, float, min: -1, max: 1
Source

pub fn get_filter_parameter(&mut self, index: i32, attr_id: i32) -> f32

Gets the filter parameter of the audio bus.

§Arguments
  • index - The index of the filter.
  • attrId - The attribute ID of the filter.
§Returns
  • float - The value of the filter parameter.
Source

pub fn fade_filter_parameter( &mut self, index: i32, attr_id: i32, to: f32, time: f64, )

Fades the filter parameter of the audio bus to the given value over the given time.

§Arguments
  • index - The index of the filter.
  • attrId - The attribute ID of the filter.
  • to - The target value of the filter parameter.
  • time - The time to fade the filter parameter.
Source

pub fn new() -> AudioBus

Creates a new audio bus.

§Returns
  • AudioBus - The created audio bus.

Trait Implementations§

Source§

impl Clone for AudioBus

Source§

fn clone(&self) -> AudioBus

Returns a duplicate 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 Drop for AudioBus

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl IObject for AudioBus

Source§

fn raw(&self) -> i64

Source§

fn obj(&self) -> &dyn IObject

Source§

fn as_any(&self) -> &dyn Any

Source§

fn get_id(&self) -> i32

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.