Skip to main content

Tuning

Struct Tuning 

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

Equal-tempered phase increments and sample period for a device’s clock. One table can be shared by all voices running at the same rate.

Implementations§

Source§

impl Tuning

Source

pub const fn new(numerator: u32, denominator: u32) -> Option<Tuning>

Construct a table for numerator / denominator frames per second, with MIDI note 69 at 440 Hz. Returns None for a zero clock component. Pitches at or above Nyquist are silent.

Source

pub const fn phase_step(&self, note: u8) -> u32

Phase advance per output frame in units of 2⁻³² turns. Returns zero for notes outside the MIDI range or at or above the output Nyquist limit.

Source

pub const fn sample_period(&self) -> f32

Duration of one output frame in seconds.

Trait Implementations§

Source§

impl Debug for Tuning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Tuning

§

impl Freeze for Tuning

§

impl Move for Tuning

§

impl RefUnwindSafe for Tuning

§

impl Send for Tuning

§

impl Sync for Tuning

§

impl Unpin for Tuning

§

impl UnsafeUnpin for Tuning

§

impl UnwindSafe for Tuning

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.