pub struct Sampl {
phase: f64,
srate: f64,
trig: Trigger,
is_playing: bool,
last_sample: f32,
decaying: f32,
}
Expand description
A simple amplifier
Fields
phase: f64
srate: f64
trig: Trigger
is_playing: bool
last_sample: f32
decaying: f32
Implementations
sourceimpl Sampl
impl Sampl
pub fn new(_nid: &NodeId, _node_global: &NodeGlobalRef) -> Self
pub const freq: &'static str = "Pitch input for the sampler, giving the playback speed of the \ sample."
pub const trig: &'static str = "The trigger input causes a resync of the playback phase \ and triggers the playback if the ~~pmode~~ is **OneShot**"
pub const offs: &'static str = "Start position offset."
pub const len: &'static str = "Adjusts the playback length of the sample in relation \ to the original length of the sample."
pub const dcms: &'static str = "Declick fade time in milliseconds.\nNot audio rate!"
pub const det: &'static str = "Detune the oscillator in semitones and cents. \ the input of this value is rounded to semitones on coarse input. \ Fine input lets you detune in cents (rounded). \ A signal sent to this port is not rounded.\n\ Note: The signal input allows detune +-10 octaves.\ "
pub const sample: &'static str = "The audio sample that is played back."
pub const pmode: &'static str = "The playback mode of the sampler.\n\ - **Loop** constantly plays back the sample. You can reset/sync the phase \ using the ~~trig~~ input in this case.\n\ - **OneShot** plays back the sample if a trigger is received on ~~trig~~ input.\n"
pub const dclick: &'static str = "If this is enabled it will enable short fade in and out ramps.\n\ This if useful if you don't want to add an envelope just for \ getting rid of the clicks if spos and epos are modulated."
pub const dir: &'static str = "Sets the direction of the playhead, plays the sample \ forwards or backwards."
pub const sig: &'static str = "Sampler audio output"
pub const DESC: &'static str = "Sample Player\n\ Provides a simple sample player that you can load a single audio \ sample from a WAV file into."
pub const HELP: &'static str = r#"Sample Player Provides a simple sample player for playing back one loaded audio sample. It can be used for purposes like: * Adding ambient samples to your patches. * Using drum samples (set ~~pmode~~) to **OneShot** * Having an oscillator with a custom waveform (set ~~pmode~~) to **Loop** * As custom control signal source for very long or very custom envelopes. Only a single audio sample can be loaded into this player. You can adjust the playback speed of the sample either by the ~~freq~~ parameter or the ~~det~~ parameter. You can offset into the sample using the ~~offs~~ parameter and modify the playback length relative to the original sample length using the ~~len~~ parameter. Even though you are advised to use an envelope for controlling the playback volume of the sample to prevent clicks a simple in and out ramp is provided using by the ~~dclick~~ setting. The length of these ramps can be controlled using the ~~dcms~~ parameter. When ~~pmode~~ is set to **Loop** the sample will restart playing immediately after it has finished. This is useful when you just want to load a waveform into the sample player to use it as oscillator. To start samples when ~~pmode~~ is set to **OneShot** a trigger input needs to be provided on the ~~trig~~ input port. The ~~trig~~ input also works in **Loop** mode to retrigger the sample. "#
pub fn graph_fun() -> Option<GraphFun>
Trait Implementations
sourceimpl DspNode for Sampl
impl DspNode for Sampl
sourcefn set_sample_rate(&mut self, srate: f32)
fn set_sample_rate(&mut self, srate: f32)
Updates the sample rate for the node.
sourcefn process(
&mut self,
ctx: &mut dyn NodeAudioContext,
_ectx: &mut NodeExecContext,
_nctx: &NodeContext<'_>,
atoms: &[SAtom],
inputs: &[ProcBuf],
outputs: &mut [ProcBuf],
ctx_vals: LedPhaseVals<'_>
)
fn process(
&mut self,
ctx: &mut dyn NodeAudioContext,
_ectx: &mut NodeExecContext,
_nctx: &NodeContext<'_>,
atoms: &[SAtom],
inputs: &[ProcBuf],
outputs: &mut [ProcBuf],
ctx_vals: LedPhaseVals<'_>
)
The code DSP function. Read more
Auto Trait Implementations
impl RefUnwindSafe for Sampl
impl Send for Sampl
impl Sync for Sampl
impl Unpin for Sampl
impl UnwindSafe for Sampl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more