pub struct OscillatorBlock<S: Sample> {
pub frequency: Parameter<S>,
pub pitch_offset: Parameter<S>,
/* private fields */
}Expand description
A waveform oscillator for generating audio signals.
Supports standard waveforms (sine, square, sawtooth, triangle, pulse, noise). Frequency can be controlled via parameter modulation or MIDI note messages.
Uses PolyBLEP/PolyBLAMP for band-limited output, reducing aliasing artifacts.
Fields§
§frequency: Parameter<S>Base frequency in Hz (can be modulated).
pitch_offset: Parameter<S>Pitch offset in semitones (for pitch bend/modulation).
Implementations§
Source§impl<S: Sample> OscillatorBlock<S>
impl<S: Sample> OscillatorBlock<S>
Sourcepub fn new(frequency: f64, waveform: Waveform, seed: Option<u64>) -> Self
pub fn new(frequency: f64, waveform: Waveform, seed: Option<u64>) -> Self
Create a new oscillator with the given frequency and waveform.
Sourcepub fn set_midi_frequency(&mut self, frequency: S)
pub fn set_midi_frequency(&mut self, frequency: S)
Set the MIDI-controlled frequency (called by voice manager on note-on).
Sourcepub fn clear_midi_frequency(&mut self)
pub fn clear_midi_frequency(&mut self)
Clear the MIDI frequency (called on note-off or when returning to parameter control).
Sourcepub fn set_waveform(&mut self, waveform: Waveform)
pub fn set_waveform(&mut self, waveform: Waveform)
Set the waveform type.
Trait Implementations§
Source§impl<S: Sample> Block<S> for OscillatorBlock<S>
impl<S: Sample> Block<S> for OscillatorBlock<S>
Source§fn process(
&mut self,
_inputs: &[&[S]],
outputs: &mut [&mut [S]],
modulation_values: &[S],
context: &DspContext,
)
fn process( &mut self, _inputs: &[&[S]], outputs: &mut [&mut [S]], modulation_values: &[S], context: &DspContext, )
Process audio through this block. Read more
Source§fn input_count(&self) -> usize
fn input_count(&self) -> usize
Returns the number of input ports this block accepts.
Source§fn output_count(&self) -> usize
fn output_count(&self) -> usize
Returns the number of output ports this block produces.
Source§fn modulation_outputs(&self) -> &[ModulationOutput]
fn modulation_outputs(&self) -> &[ModulationOutput]
Returns the modulation outputs this block provides. Read more
Source§fn channel_config(&self) -> ChannelConfig
fn channel_config(&self) -> ChannelConfig
Returns how this block handles multi-channel audio. Read more
Source§impl<S: Sample> From<OscillatorBlock<S>> for BlockType<S>
impl<S: Sample> From<OscillatorBlock<S>> for BlockType<S>
Source§fn from(block: OscillatorBlock<S>) -> Self
fn from(block: OscillatorBlock<S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S> Freeze for OscillatorBlock<S>where
S: Freeze,
impl<S> RefUnwindSafe for OscillatorBlock<S>where
S: RefUnwindSafe,
impl<S> Send for OscillatorBlock<S>
impl<S> Sync for OscillatorBlock<S>
impl<S> Unpin for OscillatorBlock<S>where
S: Unpin,
impl<S> UnwindSafe for OscillatorBlock<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more