1
0
Fork 0

Parmaeters are not real, they can't hurt you

This commit is contained in:
Robbert van der Helm 2022-04-24 18:34:40 +02:00
parent 8714310468
commit 9acd312768
16 changed files with 20 additions and 20 deletions

View file

@ -25,7 +25,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
// We only care about fields with `id`, `persist`, and `nested` attributes. For the `id` fields // We only care about fields with `id`, `persist`, and `nested` attributes. For the `id` fields
// we'll build a mapping function that creates a hashmap containing pointers to those // we'll build a mapping function that creates a hashmap containing pointers to those
// parmaeters. For the `persist` function we'll create functions that serialize and deserialize // parameters. For the `persist` function we'll create functions that serialize and deserialize
// those fields individually (so they can be added and removed independently of eachother) using // those fields individually (so they can be added and removed independently of eachother) using
// JSON. The `nested` fields should also implement the `Params` trait and their fields will be // JSON. The `nested` fields should also implement the `Params` trait and their fields will be
// inherited and added to this field's lists. // inherited and added to this field's lists.

View file

@ -22,7 +22,7 @@ pub(crate) struct IcedEditorWrapperApplication<E: IcedEditor> {
parameter_updates_receiver: Arc<channel::Receiver<crate::ParameterUpdate>>, parameter_updates_receiver: Arc<channel::Receiver<crate::ParameterUpdate>>,
} }
/// This wraps around `E::Message` to add a parmaeter update message which can be handled directly /// This wraps around `E::Message` to add a parameter update message which can be handled directly
/// by this wrapper. That parameter update message simply forces a redraw of the GUI whenever there /// by this wrapper. That parameter update message simply forces a redraw of the GUI whenever there
/// is a parameter update. /// is a parameter update.
pub enum Message<E: IcedEditor> { pub enum Message<E: IcedEditor> {

View file

@ -9,7 +9,7 @@ use super::{ParamSlider, ParamSliderExt, ParamSliderStyle};
/// Shows a generic UI for a [`Params`] object. For additional flexibility you can either use the /// Shows a generic UI for a [`Params`] object. For additional flexibility you can either use the
/// [`new()`][`Self::new()`] method to have the generic UI decide which widget to use for your /// [`new()`][`Self::new()`] method to have the generic UI decide which widget to use for your
/// parmaeters, or you can use the [`new_custom()`][`Self::new_custom()`] method to determine this /// parameters, or you can use the [`new_custom()`][`Self::new_custom()`] method to determine this
/// yourself. /// yourself.
pub struct GenericUi; pub struct GenericUi;

View file

@ -37,7 +37,7 @@ mod spectrum;
/// How many all-pass filters we can have in series at most. The filter stages parameter determines /// How many all-pass filters we can have in series at most. The filter stages parameter determines
/// how many filters are actually active. /// how many filters are actually active.
const MAX_NUM_FILTERS: usize = 512; const MAX_NUM_FILTERS: usize = 512;
/// The minimum step size for smoothing the filter parmaeters. /// The minimum step size for smoothing the filter parameters.
const MIN_AUTOMATION_STEP_SIZE: u32 = 1; const MIN_AUTOMATION_STEP_SIZE: u32 = 1;
/// The maximum step size for smoothing the filter parameters. Updating these parameters can be /// The maximum step size for smoothing the filter parameters. Updating these parameters can be
/// expensive, so updating them in larger steps can be useful. /// expensive, so updating them in larger steps can be useful.

View file

@ -9,7 +9,7 @@ struct Gain {
/// The [`Params`] derive macro gathers all of the information needed for the wrapepr to know about /// The [`Params`] derive macro gathers all of the information needed for the wrapepr to know about
/// the plugin's parameters, persistent serializable fields, and nested parameter groups. You can /// the plugin's parameters, persistent serializable fields, and nested parameter groups. You can
/// aslo easily implement [`Params`] by hand if you want to, for instance, have multiple instances /// aslo easily implement [`Params`] by hand if you want to, for instance, have multiple instances
/// of a parmaeters struct for multiple identical oscillators/filters/envelopes. /// of a parameters struct for multiple identical oscillators/filters/envelopes.
#[derive(Params)] #[derive(Params)]
struct GainParams { struct GainParams {
/// The parameter's ID is used to identify the parameter in the wrappred plugin API. As long as /// The parameter's ID is used to identify the parameter in the wrappred plugin API. As long as

View file

@ -99,7 +99,7 @@ impl Plugin for Gain {
"Also gain, but with a lame widget. Can't even render the value correctly!", "Also gain, but with a lame widget. Can't even render the value correctly!",
); );
// This is a simple naieve version of a parameter slider that's not aware of how // This is a simple naieve version of a parameter slider that's not aware of how
// the parmaeters work // the parameters work
ui.add( ui.add(
egui::widgets::Slider::from_get_set(-30.0..=30.0, |new_value| { egui::widgets::Slider::from_get_set(-30.0..=30.0, |new_value| {
match new_value { match new_value {

View file

@ -1,6 +1,6 @@
//! NIH-plug can handle floating point, integer, boolean, and enum parameters. Parameters are //! NIH-plug can handle floating point, integer, boolean, and enum parameters. Parameters are
//! managed by creating a struct deriving the [`Params`][internals::Params] trait containing fields //! managed by creating a struct deriving the [`Params`][internals::Params] trait containing fields
//! for those parmaeter types, and then returning a reference to that object from your //! for those parameter types, and then returning a reference to that object from your
//! [`Plugin::params()`][crate::prelude::Plugin::params()] method. See the `Params` trait for more //! [`Plugin::params()`][crate::prelude::Plugin::params()] method. See the `Params` trait for more
//! information. //! information.

View file

@ -6,7 +6,7 @@ use std::sync::Arc;
use super::internals::ParamPtr; use super::internals::ParamPtr;
use super::{Param, ParamFlags}; use super::{Param, ParamFlags};
/// A simple boolean parmaeter. /// A simple boolean parameter.
#[repr(C, align(4))] #[repr(C, align(4))]
pub struct BoolParam { pub struct BoolParam {
/// The field's current value. Should be initialized with the default value. /// The field's current value. Should be initialized with the default value.
@ -183,7 +183,7 @@ impl BoolParam {
} }
/// Mark this parameter as a bypass parameter. Plugin hosts can integrate this parameter into /// Mark this parameter as a bypass parameter. Plugin hosts can integrate this parameter into
/// their UI. Only a single [`BoolParam`] can be a bypass parmaeter, and NIH-plug will add one /// their UI. Only a single [`BoolParam`] can be a bypass parameter, and NIH-plug will add one
/// if you don't create one yourself. You will need to implement this yourself if your plugin /// if you don't create one yourself. You will need to implement this yourself if your plugin
/// introduces latency. /// introduces latency.
pub fn make_bypass(mut self) -> Self { pub fn make_bypass(mut self) -> Self {

View file

@ -38,7 +38,7 @@ pub struct FloatParam {
/// called multiple times in rapid succession. /// called multiple times in rapid succession.
/// ///
/// To use this, you'll probably want to store an `Arc<Atomic*>` alongside the parmater in the /// To use this, you'll probably want to store an `Arc<Atomic*>` alongside the parmater in the
/// parmaeters struct, move a clone of that `Arc` into this closure, and then modify that. /// parameters struct, move a clone of that `Arc` into this closure, and then modify that.
/// ///
/// TODO: We probably also want to pass the old value to this function. /// TODO: We probably also want to pass the old value to this function.
pub value_changed: Option<Arc<dyn Fn(f32) + Send + Sync>>, pub value_changed: Option<Arc<dyn Fn(f32) + Send + Sync>>,

View file

@ -38,7 +38,7 @@ pub struct IntParam {
/// called multiple times in rapid succession. /// called multiple times in rapid succession.
/// ///
/// To use this, you'll probably want to store an `Arc<Atomic*>` alongside the parmater in the /// To use this, you'll probably want to store an `Arc<Atomic*>` alongside the parmater in the
/// parmaeters struct, move a clone of that `Arc` into this closure, and then modify that. /// parameters struct, move a clone of that `Arc` into this closure, and then modify that.
/// ///
/// TODO: We probably also want to pass the old value to this function. /// TODO: We probably also want to pass the old value to this function.
pub value_changed: Option<Arc<dyn Fn(i32) + Send + Sync>>, pub value_changed: Option<Arc<dyn Fn(i32) + Send + Sync>>,

View file

@ -12,7 +12,7 @@ use crate::param::internals::Params;
/// Basic functionality that needs to be implemented by a plugin. The wrappers will use this to /// Basic functionality that needs to be implemented by a plugin. The wrappers will use this to
/// expose the plugin in a particular plugin format. /// expose the plugin in a particular plugin format.
/// ///
/// The main thing you need to do is define a `[Params]` struct containing all of your parmaeters. /// The main thing you need to do is define a `[Params]` struct containing all of your parameters.
/// See the trait's documentation for more information on how to do that, or check out the examples. /// See the trait's documentation for more information on how to do that, or check out the examples.
/// ///
/// This is super basic, and lots of things I didn't need or want to use yet haven't been /// This is super basic, and lots of things I didn't need or want to use yet haven't been

View file

@ -86,7 +86,7 @@ use crate::wrapper::state::{self, PluginState};
use crate::wrapper::util::{hash_param_id, process_wrapper, strlcpy}; use crate::wrapper::util::{hash_param_id, process_wrapper, strlcpy};
/// How many output parameter changes we can store in our output parameter change queue. Storing /// How many output parameter changes we can store in our output parameter change queue. Storing
/// more than this many parmaeters at a time will cause changes to get lost. /// more than this many parameters at a time will cause changes to get lost.
const OUTPUT_EVENT_QUEUE_CAPACITY: usize = 2048; const OUTPUT_EVENT_QUEUE_CAPACITY: usize = 2048;
#[repr(C)] #[repr(C)]
@ -208,7 +208,7 @@ pub struct Wrapper<P: ClapPlugin> {
/// A queue of parameter changes and gestures that should be output in either the next process /// A queue of parameter changes and gestures that should be output in either the next process
/// call or in the next parameter flush. /// call or in the next parameter flush.
/// ///
/// XXX: There's no guarentee that a single parmaeter doesn't occur twice in this queue, but /// XXX: There's no guarentee that a single parameter doesn't occur twice in this queue, but
/// even if it does then that should still not be a problem because the host also reads it /// even if it does then that should still not be a problem because the host also reads it
/// in the same order, right? /// in the same order, right?
output_parameter_events: ArrayQueue<OutputParamEvent>, output_parameter_events: ArrayQueue<OutputParamEvent>,
@ -260,7 +260,7 @@ pub enum ClapParamUpdate {
pub enum OutputParamEvent { pub enum OutputParamEvent {
/// Begin an automation gesture. This must always be sent before sending [`SetValue`]. /// Begin an automation gesture. This must always be sent before sending [`SetValue`].
BeginGesture { param_hash: u32 }, BeginGesture { param_hash: u32 },
/// Change the value of a parmaeter using a plain CLAP value, aka the normalized value /// Change the value of a parameter using a plain CLAP value, aka the normalized value
/// multiplied by the number of steps. /// multiplied by the number of steps.
SetValue { SetValue {
/// The internal hash for the parameter. /// The internal hash for the parameter.

View file

@ -18,7 +18,7 @@ use crate::param::ParamFlags;
use crate::plugin::{BufferConfig, BusConfig, Editor, ParentWindowHandle, Plugin, ProcessStatus}; use crate::plugin::{BufferConfig, BusConfig, Editor, ParentWindowHandle, Plugin, ProcessStatus};
/// How many parameter changes we can store in our unprocessed parameter change queue. Storing more /// How many parameter changes we can store in our unprocessed parameter change queue. Storing more
/// than this many parmaeters at a time will cause changes to get lost. /// than this many parameters at a time will cause changes to get lost.
const EVENT_QUEUE_CAPACITY: usize = 2048; const EVENT_QUEUE_CAPACITY: usize = 2048;
/// Configuration for a standalone plugin that would normally be provided by the DAW. /// Configuration for a standalone plugin that would normally be provided by the DAW.

View file

@ -27,7 +27,7 @@ pub enum ParamValue {
pub struct PluginState { pub struct PluginState {
/// The plugin's parameter values. These are stored unnormalized. This mean sthe old values will /// The plugin's parameter values. These are stored unnormalized. This mean sthe old values will
/// be recalled when when the parameter's range gets increased. Doing so may still mess with /// be recalled when when the parameter's range gets increased. Doing so may still mess with
/// parmaeter automation though, depending on how the host impelments that. /// parameter automation though, depending on how the host impelments that.
pub params: HashMap<String, ParamValue>, pub params: HashMap<String, ParamValue>,
/// Arbitrary fields that should be persisted together with the plugin's parameters. Any field /// Arbitrary fields that should be persisted together with the plugin's parameters. Any field
/// on the [`Params`][crate::param::internals::Params] struct that's annotated with `#[persist = /// on the [`Params`][crate::param::internals::Params] struct that's annotated with `#[persist =
@ -45,7 +45,7 @@ pub(crate) unsafe fn serialize_object(
param_by_hash: &HashMap<u32, ParamPtr>, param_by_hash: &HashMap<u32, ParamPtr>,
param_id_to_hash: &HashMap<String, u32>, param_id_to_hash: &HashMap<String, u32>,
) -> PluginState { ) -> PluginState {
// We'll serialize parmaeter values as a simple `string_param_id: display_value` map. // We'll serialize parameter values as a simple `string_param_id: display_value` map.
let params: HashMap<_, _> = param_id_to_hash let params: HashMap<_, _> = param_id_to_hash
.iter() .iter()
.filter_map(|(param_id_str, hash)| { .filter_map(|(param_id_str, hash)| {

View file

@ -1,7 +1,7 @@
//! Parameter hierarchies in VST3 requires you to define units, which are linearly indexed logical //! Parameter hierarchies in VST3 requires you to define units, which are linearly indexed logical
//! units that have a name, a parent, and then a whole bunch of other data like note numbers and //! units that have a name, a parent, and then a whole bunch of other data like note numbers and
//! MIDI program state. We'll need to implement some of that to conver our list of slash-separated //! MIDI program state. We'll need to implement some of that to conver our list of slash-separated
//! parmaeter group paths to units. //! parameter group paths to units.
//! //!
//! <https://steinbergmedia.github.io/vst3_doc/vstinterfaces/classSteinberg_1_1Vst_1_1IUnitInfo.html> //! <https://steinbergmedia.github.io/vst3_doc/vstinterfaces/classSteinberg_1_1Vst_1_1IUnitInfo.html>

View file

@ -923,7 +923,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
normalized_value, normalized_value,
} => { } => {
// If this parameter change happens after the start of this block, then // If this parameter change happens after the start of this block, then
// we'll split the block here and handle this parmaeter change after // we'll split the block here and handle this parameter change after
// we've processed this block // we've processed this block
if timing != block_start as u32 { if timing != block_start as u32 {
event_start_idx = event_idx; event_start_idx = event_idx;