pub struct EnumParam<T: Enum + PartialEq> { /* private fields */ }
Expand description
Implementations§
source§impl<T: Enum + PartialEq + 'static> EnumParam<T>
impl<T: Enum + PartialEq + 'static> EnumParam<T>
sourcepub fn new(name: impl Into<String>, default: T) -> Self
pub fn new(name: impl Into<String>, default: T) -> Self
Build a new Self. Use the other associated functions to modify the behavior of the parameter.
sourcepub fn with_poly_modulation_id(self, id: u32) -> Self
pub fn with_poly_modulation_id(self, id: u32) -> Self
Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
parameter in NoteEvent::PolyModulation
events, and must thus be unique between all polyphonically modulatable parameters. See the
event’s documentation on how to use polyphonic modulation. Also consider configuring the
ClapPlugin::CLAP_POLY_MODULATION_CONFIG
constant when enabling this.
Important
After enabling polyphonic modulation, the plugin must start sending
NoteEvent::VoiceTerminated
events to the
host when a voice has fully ended. This allows the host to reuse its modulation resources.
sourcepub fn with_callback(self, callback: Arc<dyn Fn(T) + Send + Sync>) -> Self
pub fn with_callback(self, callback: Arc<dyn Fn(T) + Send + Sync>) -> Self
Run a callback whenever this parameter’s value changes. The argument passed to this function is the parameter’s new value. This should not do anything expensive as it may be called multiple times in rapid succession, and it can be run from both the GUI and the audio thread.
sourcepub fn non_automatable(self) -> Self
pub fn non_automatable(self) -> Self
Mark the parameter as non-automatable. This means that the parameter cannot be changed from an automation lane. The parameter can however still be manually changed by the user from either the plugin’s own GUI or from the host’s generic UI.
sourcepub fn hide(self) -> Self
pub fn hide(self) -> Self
Hide the parameter in the host’s generic UI for this plugin. This also implies
NON_AUTOMATABLE
. Setting this does not prevent you from changing the parameter in the
plugin’s editor GUI.
sourcepub fn hide_in_generic_ui(self) -> Self
pub fn hide_in_generic_ui(self) -> Self
Don’t show this parameter when generating a generic UI for the plugin using one of NIH-plug’s generic UI widgets.
Trait Implementations§
source§impl<T: Enum + PartialEq> Param for EnumParam<T>
impl<T: Enum + PartialEq> Param for EnumParam<T>
source§fn poly_modulation_id(&self) -> Option<u32>
fn poly_modulation_id(&self) -> Option<u32>
NoteEvent::PolyModulation
and
NoteEvent::MonoAutomation
events. See the
documentation on those events for more information. Read moresource§fn modulated_plain_value(&self) -> Self::Plain
fn modulated_plain_value(&self) -> Self::Plain
source§fn modulated_normalized_value(&self) -> f32
fn modulated_normalized_value(&self) -> f32
[0, 1]
value for this parameter.source§fn unmodulated_plain_value(&self) -> Self::Plain
fn unmodulated_plain_value(&self) -> Self::Plain
modulated_plain_value()
. This may be
useful for displaying modulation differently in plugin GUIs. Right now only CLAP plugins in
Bitwig Studio use modulation.source§fn unmodulated_normalized_value(&self) -> f32
fn unmodulated_normalized_value(&self) -> f32
[0, 1]
value for this parameter before any (monophonic) modulation
coming from the host has been applied. If the host is not currently modulating this
parameter than this will be the same as
modulated_normalized_value()
. This may be useful for
displaying modulation differently in plugin GUIs. Right now only CLAP plugins in Bitwig
Studio use modulation.source§fn default_plain_value(&self) -> Self::Plain
fn default_plain_value(&self) -> Self::Plain
source§fn step_count(&self) -> Option<usize>
fn step_count(&self) -> Option<usize>
source§fn previous_step(&self, from: Self::Plain, finer: bool) -> Self::Plain
fn previous_step(&self, from: Self::Plain, finer: bool) -> Self::Plain
from
if the value is at the start of its range. This is mainly used for scroll wheel
interaction in plugin GUIs. When the parameter is not discrete then a step should cover one
hundredth of the normalized range instead. Read moresource§fn next_step(&self, from: Self::Plain, finer: bool) -> Self::Plain
fn next_step(&self, from: Self::Plain, finer: bool) -> Self::Plain
from
if the value is at the end of its range. This is mainly used for scroll wheel
interaction in plugin GUIs. When the parameter is not discrete then a step should cover one
hundredth of the normalized range instead. Read moresource§fn normalized_value_to_string(
&self,
normalized: f32,
include_unit: bool
) -> String
fn normalized_value_to_string( &self, normalized: f32, include_unit: bool ) -> String
source§fn string_to_normalized_value(&self, string: &str) -> Option<f32>
fn string_to_normalized_value(&self, string: &str) -> Option<f32>
source§fn preview_normalized(&self, plain: Self::Plain) -> f32
fn preview_normalized(&self, plain: Self::Plain) -> f32
source§fn preview_plain(&self, normalized: f32) -> Self::Plain
fn preview_plain(&self, normalized: f32) -> Self::Plain
FloatParam
).source§fn flags(&self) -> ParamFlags
fn flags(&self) -> ParamFlags
ParamFlags
.source§fn as_ptr(&self) -> ParamPtr
fn as_ptr(&self) -> ParamPtr
Params
. This should
not be used directly.source§fn default_normalized_value(&self) -> f32
fn default_normalized_value(&self) -> f32
[0, 1]
default value for this parameter.source§fn previous_normalized_step(&self, from: f32, finer: bool) -> f32
fn previous_normalized_step(&self, from: f32, finer: bool) -> f32
previous_step()
, but for normalized values. This is
mostly useful for GUI widgets.source§fn next_normalized_step(&self, from: f32, finer: bool) -> f32
fn next_normalized_step(&self, from: f32, finer: bool) -> f32
next_step()
, but for normalized values. This is mostly
useful for GUI widgets.source§fn preview_modulated(&self, normalized_offset: f32) -> Self::Plain
fn preview_modulated(&self, normalized_offset: f32) -> Self::Plain
preview_plain()
with unmodulated_normalized_value() + normalized_offset
.`