Skip to main content

WavetableOscillator

Struct WavetableOscillator 

Source
pub struct WavetableOscillator<T: Transcendental, const SIZE: usize> { /* private fields */ }
Expand description

Wavetable oscillator built on InterpolatedReader.

The compile-time constant SIZE determines table resolution but the underlying storage is heap-allocated, sharing the same interpolation engine with SamplePlayer.

Implementations§

Source§

impl<T: Transcendental, const SIZE: usize> WavetableOscillator<T, SIZE>

Source

pub fn new(table: [T; SIZE], frequency: f32) -> Self

Create from an explicit table.

Source

pub fn sine(frequency: f32) -> Self

Create a sine wavetable.

Source

pub fn saw(frequency: f32) -> Self

Create a sawtooth wavetable.

Source

pub fn set_table(&mut self, table: [T; SIZE])

Replace the wavetable data.

Trait Implementations§

Source§

impl<T: Transcendental, const SIZE: usize> Algorithm<T> for WavetableOscillator<T, SIZE>

Source§

fn init(&mut self, sample_rate: f32)

Initialise the algorithm with a sample rate. Read more
Source§

fn reset(&mut self)

Reset the algorithm to its initial state. Read more
Source§

fn process( &mut self, _input: Option<&[T]>, output: &mut [T], _ctx: &ActionContext<'_>, ) -> ProcessResult<()>

Process one block of audio. Read more
Source§

fn metadata(&self) -> AlgorithmMetadata

Descriptive metadata (defaults to empty).
Source§

fn apply_command(&mut self, _value: T)

Receive a real-time command value from the control path. Read more
Source§

impl<T: Transcendental, const SIZE: usize> Generator<T> for WavetableOscillator<T, SIZE>

Source§

fn phase(&self) -> T

Получить текущую фазу (0.0 - 1.0)
Source§

fn set_phase(&mut self, phase: T)

Установить фазу
Source§

fn reset_phase(&mut self)

Сбросить фазу в 0
Source§

fn frequency(&self) -> f32

Получить частоту в Hz
Source§

fn set_frequency(&mut self, freq: f32)

Установить частоту
Source§

fn amplitude(&self) -> T

Получить амплитуду
Source§

fn set_amplitude(&mut self, amp: T)

Установить амплитуду

Auto Trait Implementations§

§

impl<T, const SIZE: usize> Freeze for WavetableOscillator<T, SIZE>
where T: Freeze,

§

impl<T, const SIZE: usize> RefUnwindSafe for WavetableOscillator<T, SIZE>
where T: RefUnwindSafe,

§

impl<T, const SIZE: usize> Send for WavetableOscillator<T, SIZE>

§

impl<T, const SIZE: usize> Sync for WavetableOscillator<T, SIZE>

§

impl<T, const SIZE: usize> Unpin for WavetableOscillator<T, SIZE>
where T: Unpin,

§

impl<T, const SIZE: usize> UnsafeUnpin for WavetableOscillator<T, SIZE>
where T: UnsafeUnpin,

§

impl<T, const SIZE: usize> UnwindSafe for WavetableOscillator<T, SIZE>
where T: UnwindSafe,

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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
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, 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> 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.