Expand description
Refers to an input paramter or atom of a specific Node referred to by a NodeId.
To obtain a ParamId you use one of these:
To obtain an input and output index for a port use:
use hexodsp::*;
let freq_param = NodeId::Sin(2).inp_param("freq").unwrap();
assert!(!freq_param.is_atom());
// Access the UI min/max and fine/coarse step values of this paramter:
assert_eq!(freq_param.param_min_max().unwrap(), ((-1.0, 0.5647131), (20.0, 100.0)));
// Access the default value:
assert_eq!(freq_param.as_atom_def().f(), 0.0);
// Normalize a value (convert frequency to the 0.0 to 1.0 range)
assert_eq!(freq_param.norm(220.0), -0.1);
// Denormalize a value (convert 0.0 to 1.0 range to frequency)
assert_eq!(freq_param.denorm(-0.1), 220.0);
Fields
name: &'static str
node: NodeId
idx: u8
Implementations
sourceimpl ParamId
impl ParamId
pub fn none() -> Self
pub fn node_id(&self) -> NodeId
pub fn inp(&self) -> u8
pub fn name(&self) -> &'static str
sourcepub fn is_atom(&self) -> bool
pub fn is_atom(&self) -> bool
Returns true if the ParamId has been associated with
the atoms of a Node, and not the paramters. Even if the
Atom is a param()
.
pub fn atom_ui(&self) -> Option<&'static str>
pub fn param_steps(&self) -> Option<(f32, f32)>
pub fn param_min_max(&self) -> Option<((f32, f32), (f32, f32))>
pub fn format(&self, f: &mut dyn Write, v: f32) -> Option<Result<()>>
pub fn setting_min_max(&self) -> Option<(i64, i64)>
pub fn as_atom_def(&self) -> SAtom
pub fn norm_def(&self) -> f32
pub fn round(&self, v: f32, coarse: bool) -> f32
pub fn norm(&self, v: f32) -> f32
pub fn denorm(&self, v: f32) -> f32
Trait Implementations
sourceimpl Ord for ParamId
impl Ord for ParamId
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<ParamId> for ParamId
impl PartialOrd<ParamId> for ParamId
sourcefn partial_cmp(&self, other: &ParamId) -> Option<Ordering>
fn partial_cmp(&self, other: &ParamId) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for ParamId
impl Eq for ParamId
impl StructuralEq for ParamId
impl StructuralPartialEq for ParamId
Auto Trait Implementations
impl RefUnwindSafe for ParamId
impl Send for ParamId
impl Sync for ParamId
impl Unpin for ParamId
impl UnwindSafe for ParamId
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
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.