Skip to main content

ScratchGate

Struct ScratchGate 

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

Audio-rate, travel-based scratch crossfader gate.

intent_rate should be the filtered/target hand rate and rendered_rate should be the rate actually used to advance audible PCM. Direction changes use intent for responsiveness and rendered motion as a fallback, while pattern phase follows audible travel in the confirmed stroke direction.

Implementations§

Source§

impl ScratchGate

Source

pub fn new(preset: ScratchPreset) -> Self

Source

pub fn preset(&self) -> ScratchPreset

Source

pub fn set_preset(&mut self, preset: ScratchPreset)

Source

pub fn clicks(&self) -> u8

Source

pub fn set_clicks(&mut self, clicks: u8)

Source

pub fn algorithm_version(&self) -> u32

Source

pub fn set_algorithm_version(&mut self, _version: u32)

Retains source compatibility while legacy consumers migrate.

The canonical gate does not emulate replaced algorithms.

Source

pub fn reset_for_replay(&mut self)

Starts a recorded performance from one defined gate state while retaining its selected technique and click count.

Source

pub fn gate(&self) -> f64

Source

pub fn target(&self) -> f64

Source

pub fn direction(&self) -> i8

Source

pub fn moving(&self) -> bool

Source

pub fn phase(&self) -> f64

Source

pub fn stroke_progress(&self) -> f64

Source

pub fn learned_span(&self) -> f64

Returns the estimate for the active direction.

Before motion starts, this method returns the forward seed.

Source

pub fn learned_span_for_direction(&self, direction: i8) -> f64

Returns one direction’s learned source-travel span.

Source

pub fn span_prediction_confidence(&self) -> f64

Returns confidence for the active direction.

Before motion starts, this method returns forward confidence.

Source

pub fn span_prediction_confidence_for_direction(&self, direction: i8) -> f64

Returns zero before the first direction-specific observation.

Confidence reaches one after four observations in that direction.

Source

pub fn snapshot(&self) -> ScratchGateSnapshot

Source

pub fn restore( &mut self, snapshot: &ScratchGateSnapshot, ) -> Result<(), ScratchPerformanceError>

Restores only after the complete gate state passes validation.

Source

pub fn release(&mut self)

Marks the record as released immediately. The target opens at once; the returned gain still reaches it through the de-click envelope.

Source

pub fn process( &mut self, delta_seconds: f64, hand_contact: bool, intent_rate: f64, rendered_rate: f64, ) -> f64

Advances the gate by one audio frame and returns its de-clicked gain.

Trait Implementations§

Source§

impl Clone for ScratchGate

Source§

fn clone(&self) -> ScratchGate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ScratchGate

Source§

impl Debug for ScratchGate

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ScratchGate

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ScratchGate

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ScratchGate

Source§

fn eq(&self, other: &ScratchGate) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ScratchGate

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ScratchGate

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more