pub struct Sine { /* private fields */ }Expand description
A continuous sine oscillator.
Implementations§
Source§impl Sine
impl Sine
Sourcepub fn new(freq_hz: f32, sample_rate: u32, amplitude: f32) -> Self
pub fn new(freq_hz: f32, sample_rate: u32, amplitude: f32) -> Self
A tone of freq_hz at sample_rate, with amplitude in
0.0..=1.0 of full scale.
Sourcepub fn set_frequency(&mut self, freq_hz: f32, sample_rate: u32)
pub fn set_frequency(&mut self, freq_hz: f32, sample_rate: u32)
Changes the frequency without resetting the phase, so the waveform stays continuous (no click).
Sourcepub fn next_sample(&mut self) -> i16
pub fn next_sample(&mut self) -> i16
Next sample.
Trait Implementations§
impl Copy for Sine
Auto Trait Implementations§
impl Freeze for Sine
impl RefUnwindSafe for Sine
impl Send for Sine
impl Sync for Sine
impl Unpin for Sine
impl UnsafeUnpin for Sine
impl UnwindSafe for Sine
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)