Skip to main content

LowPass

Struct LowPass 

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

An effect that suppresses high frequencies.

LowPass reduces the volume of frequencies above the given cutoff. This can create the impression of sound coming from far away or in another room.

§Examples

let sin = SineWave::new(1.0, 440.0);
let low_pass = LowPass::new(sin.into_shared(), 200.0);

Implementations§

Source§

impl LowPass

Source

pub fn new(source: SharedAudioSource, cutoff: f32) -> Self

Construct a low-pass filter.

§Arguments
  • source – The source of audio for this effect.
  • cutoff – The frequency above which volume will be reduced.
Source

pub fn set_cutoff(&mut self, cutoff: f32)

Source

pub fn cutoff(&self) -> f32

Trait Implementations§

Source§

impl AudioSource for LowPass

Source§

fn read(&mut self, buffer: &mut AudioBuffer<'_>) -> ReadResult

Consume audio data and attempt to fill the given buffer. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoShared for T
where T: AudioSource + Send + 'static,

Source§

fn into_shared(self) -> Arc<Mutex<dyn AudioSource + Send>>

Move this audio source into an Arc<Mutex<...>> so that it can be shared between threads.
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.