Fix references in docs
This commit is contained in:
parent
ee38566d74
commit
e1269d07b1
|
@ -32,8 +32,8 @@ pub fn register_theme(cx: &mut Context) {
|
||||||
/// with parameter values with VIZIA works a little different from updating any other state. These
|
/// with parameter values with VIZIA works a little different from updating any other state. These
|
||||||
/// events are automatically handled by `nih_plug_vizia`.
|
/// events are automatically handled by `nih_plug_vizia`.
|
||||||
///
|
///
|
||||||
/// Call the [`upcast()`][Self::upcast()] method to be able to emit this event through a
|
/// Call the [`upcast()`][Self::upcast()] method to be able to emit this event through an
|
||||||
/// [`Context`][vizia::Context].
|
/// [`EventContext`][EventContext].
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum ParamEvent<'a, P: Param> {
|
pub enum ParamEvent<'a, P: Param> {
|
||||||
/// Begin an automation gesture for a parameter.
|
/// Begin an automation gesture for a parameter.
|
||||||
|
@ -144,7 +144,7 @@ impl<P: Param> From<ParamEvent<'_, P>> for RawParamEvent {
|
||||||
|
|
||||||
impl<P: Param> ParamEvent<'_, P> {
|
impl<P: Param> ParamEvent<'_, P> {
|
||||||
/// Convert this event into a type erased version of itself that can be emitted through
|
/// Convert this event into a type erased version of itself that can be emitted through
|
||||||
/// [`Context::emit()`][vizia::Context::emit()].
|
/// [`EventContext::emit()`][EventContext::emit()].
|
||||||
///
|
///
|
||||||
/// TODO: Think of a better, clearer term for this
|
/// TODO: Think of a better, clearer term for this
|
||||||
pub fn upcast(self) -> RawParamEvent {
|
pub fn upcast(self) -> RawParamEvent {
|
||||||
|
|
32
src/param.rs
32
src/param.rs
|
@ -71,15 +71,15 @@ pub trait Param: Display {
|
||||||
/// Get this parameter's polyphonic modulation ID. If this is set for a parameter in a CLAP
|
/// Get this parameter's polyphonic modulation ID. If this is set for a parameter in a CLAP
|
||||||
/// plugin, then polyphonic modulation will be enabled for that parameter. Polyphonic modulation
|
/// plugin, then polyphonic modulation will be enabled for that parameter. Polyphonic modulation
|
||||||
/// is communicated to the plugin through
|
/// is communicated to the plugin through
|
||||||
/// [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] and
|
/// [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation] and
|
||||||
/// [`NoteEvent::MonoAutomation][crate::prelude::NoteEvent::MonoAutomation`] events. See the
|
/// [`NoteEvent::MonoAutomation`][crate::prelude::NoteEvent::MonoAutomation] events. See the
|
||||||
/// documentation on those events for more information.
|
/// documentation on those events for more information.
|
||||||
///
|
///
|
||||||
/// # Important
|
/// # Important
|
||||||
///
|
///
|
||||||
/// After enabling polyphonic modulation, the plugin **must** start sending
|
/// After enabling polyphonic modulation, the plugin **must** start sending
|
||||||
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceEnd] events to the host when a voice
|
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceTerminated] events to the
|
||||||
/// has fully ended. This allows the host to reuse its modulation resources.
|
/// host when a voice has fully ended. This allows the host to reuse its modulation resources.
|
||||||
fn poly_modulation_id(&self) -> Option<u32>;
|
fn poly_modulation_id(&self) -> Option<u32>;
|
||||||
|
|
||||||
/// Get the unnormalized value for this parameter.
|
/// Get the unnormalized value for this parameter.
|
||||||
|
@ -207,18 +207,18 @@ pub(crate) trait ParamMut: Param {
|
||||||
///
|
///
|
||||||
/// # Deriving `Params` and `#[id = "stable"]`
|
/// # Deriving `Params` and `#[id = "stable"]`
|
||||||
///
|
///
|
||||||
/// This trait can be derived on a struct containing [`FloatParam`][super::FloatParam] and other
|
/// This trait can be derived on a struct containing [`FloatParam`] and other parameter fields by
|
||||||
/// parameter fields by adding `#[derive(Params)]`. When deriving this trait, any of those parameter
|
/// adding `#[derive(Params)]`. When deriving this trait, any of those parameter fields should have
|
||||||
/// fields should have the `#[id = "stable"]` attribute, where `stable` is an up to 6 character long
|
/// the `#[id = "stable"]` attribute, where `stable` is an up to 6 character long string (to avoid
|
||||||
/// string (to avoid collisions) that will be used to identify the parameter internally so you can
|
/// collisions) that will be used to identify the parameter internally so you can safely move it
|
||||||
/// safely move it around and rename the field without breaking compatibility with old presets.
|
/// around and rename the field without breaking compatibility with old presets.
|
||||||
///
|
///
|
||||||
/// ## `#[persist = "key"]`
|
/// ## `#[persist = "key"]`
|
||||||
///
|
///
|
||||||
/// The struct can also contain other fields that should be persisted along with the rest of the
|
/// The struct can also contain other fields that should be persisted along with the rest of the
|
||||||
/// preset data. These fields should be [`PersistentField`]s annotated with the `#[persist = "key"]`
|
/// preset data. These fields should be [`PersistentField`][persist::PersistentField]s annotated
|
||||||
/// attribute containing types that can be serialized and deserialized with
|
/// with the `#[persist = "key"]` attribute containing types that can be serialized and deserialized
|
||||||
/// [Serde](https://serde.rs/).
|
/// with [Serde](https://serde.rs/).
|
||||||
///
|
///
|
||||||
/// ## `#[nested]`, `#[nested(group_name = "group name")]`
|
/// ## `#[nested]`, `#[nested(group_name = "group name")]`
|
||||||
///
|
///
|
||||||
|
@ -276,16 +276,16 @@ pub unsafe trait Params: 'static + Send + Sync {
|
||||||
|
|
||||||
/// Serialize all fields marked with `#[persist = "stable_name"]` into a hash map containing
|
/// Serialize all fields marked with `#[persist = "stable_name"]` into a hash map containing
|
||||||
/// JSON-representations of those fields so they can be written to the plugin's state and
|
/// JSON-representations of those fields so they can be written to the plugin's state and
|
||||||
/// recalled later. This uses [`serialize_field()`] under the hood.
|
/// recalled later. This uses [`persist::serialize_field()`] under the hood.
|
||||||
fn serialize_fields(&self) -> BTreeMap<String, String> {
|
fn serialize_fields(&self) -> BTreeMap<String, String> {
|
||||||
BTreeMap::new()
|
BTreeMap::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Restore all fields marked with `#[persist = "stable_name"]` from a hashmap created by
|
/// Restore all fields marked with `#[persist = "stable_name"]` from a hashmap created by
|
||||||
/// [`serialize_fields()`][Self::serialize_fields()]. All of these fields should be wrapped in a
|
/// [`serialize_fields()`][Self::serialize_fields()]. All of these fields should be wrapped in a
|
||||||
/// [`PersistentField`] with thread safe interior mutability, like an `RwLock` or a `Mutex`.
|
/// [`persist::PersistentField`] with thread safe interior mutability, like an `RwLock` or a
|
||||||
/// This gets called when the plugin's state is being restored. This uses [deserialize_field()]
|
/// `Mutex`. This gets called when the plugin's state is being restored. This uses
|
||||||
/// under the hood.
|
/// [`persist::deserialize_field()`] under the hood.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn deserialize_fields(&self, serialized: &BTreeMap<String, String>) {}
|
fn deserialize_fields(&self, serialized: &BTreeMap<String, String>) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub struct BoolParam {
|
||||||
/// If this parameter has been marked as polyphonically modulatable, then this will be a unique
|
/// If this parameter has been marked as polyphonically modulatable, then this will be a unique
|
||||||
/// integer identifying the parameter. Because this value is determined by the plugin itself,
|
/// integer identifying the parameter. Because this value is determined by the plugin itself,
|
||||||
/// the plugin can easily map
|
/// the plugin can easily map
|
||||||
/// [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] events to the
|
/// [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation] events to the
|
||||||
/// correct parameter by pattern matching on a constant.
|
/// correct parameter by pattern matching on a constant.
|
||||||
poly_modulation_id: Option<u32>,
|
poly_modulation_id: Option<u32>,
|
||||||
/// Optional custom conversion function from a boolean value to a string.
|
/// Optional custom conversion function from a boolean value to a string.
|
||||||
|
@ -232,7 +232,7 @@ impl BoolParam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
||||||
/// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`]
|
/// parameter in [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation]
|
||||||
/// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the
|
/// 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
|
/// event's documentation on how to use polyphonic modulation. Also consider configuring the
|
||||||
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
||||||
|
@ -241,8 +241,8 @@ impl BoolParam {
|
||||||
/// # Important
|
/// # Important
|
||||||
///
|
///
|
||||||
/// After enabling polyphonic modulation, the plugin **must** start sending
|
/// After enabling polyphonic modulation, the plugin **must** start sending
|
||||||
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceEnd] events to the host when
|
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceTerminated] events to the
|
||||||
/// a voice has fully ended. This allows the host to reuse its modulation resources.
|
/// host when a voice has fully ended. This allows the host to reuse its modulation resources.
|
||||||
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
||||||
self.poly_modulation_id = Some(id);
|
self.poly_modulation_id = Some(id);
|
||||||
self
|
self
|
||||||
|
|
|
@ -333,7 +333,7 @@ impl<T: Enum + PartialEq + 'static> EnumParam<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
||||||
/// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`]
|
/// parameter in [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation]
|
||||||
/// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the
|
/// 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
|
/// event's documentation on how to use polyphonic modulation. Also consider configuring the
|
||||||
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
||||||
|
@ -342,8 +342,8 @@ impl<T: Enum + PartialEq + 'static> EnumParam<T> {
|
||||||
/// # Important
|
/// # Important
|
||||||
///
|
///
|
||||||
/// After enabling polyphonic modulation, the plugin **must** start sending
|
/// After enabling polyphonic modulation, the plugin **must** start sending
|
||||||
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceEnd] events to the host when
|
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceTerminated] events to the
|
||||||
/// a voice has fully ended. This allows the host to reuse its modulation resources.
|
/// host when a voice has fully ended. This allows the host to reuse its modulation resources.
|
||||||
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
||||||
self.inner.inner = self.inner.inner.with_poly_modulation_id(id);
|
self.inner.inner = self.inner.inner.with_poly_modulation_id(id);
|
||||||
self
|
self
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub struct FloatParam {
|
||||||
/// If this parameter has been marked as polyphonically modulatable, then this will be a unique
|
/// If this parameter has been marked as polyphonically modulatable, then this will be a unique
|
||||||
/// integer identifying the parameter. Because this value is determined by the plugin itself,
|
/// integer identifying the parameter. Because this value is determined by the plugin itself,
|
||||||
/// the plugin can easily map
|
/// the plugin can easily map
|
||||||
/// [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] events to the
|
/// [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation] events to the
|
||||||
/// correct parameter by pattern matching on a constant.
|
/// correct parameter by pattern matching on a constant.
|
||||||
poly_modulation_id: Option<u32>,
|
poly_modulation_id: Option<u32>,
|
||||||
/// Optional custom conversion function from a plain **unnormalized** value to a string.
|
/// Optional custom conversion function from a plain **unnormalized** value to a string.
|
||||||
|
@ -274,7 +274,7 @@ impl FloatParam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
||||||
/// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`]
|
/// parameter in [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation]
|
||||||
/// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the
|
/// 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
|
/// event's documentation on how to use polyphonic modulation. Also consider configuring the
|
||||||
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
||||||
|
@ -283,8 +283,8 @@ impl FloatParam {
|
||||||
/// # Important
|
/// # Important
|
||||||
///
|
///
|
||||||
/// After enabling polyphonic modulation, the plugin **must** start sending
|
/// After enabling polyphonic modulation, the plugin **must** start sending
|
||||||
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceEnd] events to the host when
|
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceTerminated] events to the
|
||||||
/// a voice has fully ended. This allows the host to reuse its modulation resources.
|
/// host when a voice has fully ended. This allows the host to reuse its modulation resources.
|
||||||
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
||||||
self.poly_modulation_id = Some(id);
|
self.poly_modulation_id = Some(id);
|
||||||
self
|
self
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub struct IntParam {
|
||||||
/// If this parameter has been marked as polyphonically modulatable, then this will be a unique
|
/// If this parameter has been marked as polyphonically modulatable, then this will be a unique
|
||||||
/// integer identifying the parameter. Because this value is determined by the plugin itself,
|
/// integer identifying the parameter. Because this value is determined by the plugin itself,
|
||||||
/// the plugin can easily map
|
/// the plugin can easily map
|
||||||
/// [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] events to the
|
/// [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation] events to the
|
||||||
/// correct parameter by pattern matching on a constant.
|
/// correct parameter by pattern matching on a constant.
|
||||||
poly_modulation_id: Option<u32>,
|
poly_modulation_id: Option<u32>,
|
||||||
/// Optional custom conversion function from a plain **unnormalized** value to a string.
|
/// Optional custom conversion function from a plain **unnormalized** value to a string.
|
||||||
|
@ -253,7 +253,7 @@ impl IntParam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
/// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this
|
||||||
/// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`]
|
/// parameter in [`NoteEvent::PolyModulation`][crate::prelude::NoteEvent::PolyModulation]
|
||||||
/// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the
|
/// 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
|
/// event's documentation on how to use polyphonic modulation. Also consider configuring the
|
||||||
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
/// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG]
|
||||||
|
@ -262,8 +262,8 @@ impl IntParam {
|
||||||
/// # Important
|
/// # Important
|
||||||
///
|
///
|
||||||
/// After enabling polyphonic modulation, the plugin **must** start sending
|
/// After enabling polyphonic modulation, the plugin **must** start sending
|
||||||
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceEnd] events to the host when
|
/// [`NoteEvent::VoiceTerminated`][crate::prelude::NoteEvent::VoiceTerminated] events to the
|
||||||
/// a voice has fully ended. This allows the host to reuse its modulation resources.
|
/// host when a voice has fully ended. This allows the host to reuse its modulation resources.
|
||||||
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
pub fn with_poly_modulation_id(mut self, id: u32) -> Self {
|
||||||
self.poly_modulation_id = Some(id);
|
self.poly_modulation_id = Some(id);
|
||||||
self
|
self
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
//! Traits and helpers for persistent fields. See the [`Params`][super::Params] trait for more
|
//! Traits and helpers for persistent fields. See the [`Params`][super::Params] trait for more
|
||||||
//! information.
|
//! information.
|
||||||
|
|
||||||
/// Re-export for use in the [`Params`] proc-macro.
|
/// Re-export for use in the [`Params`][super::Params] proc-macro.
|
||||||
pub use serde_json::from_str as deserialize_field;
|
pub use serde_json::from_str as deserialize_field;
|
||||||
/// Re-export for use in the [`Params`] proc-macro.
|
/// Re-export for use in the [`Params`][super::Params] proc-macro.
|
||||||
pub use serde_json::to_string as serialize_field;
|
pub use serde_json::to_string as serialize_field;
|
||||||
|
|
||||||
/// Handles the functionality needed for persisting a non-parameter fields in a plugin's state.
|
/// Handles the functionality needed for persisting a non-parameter fields in a plugin's state.
|
||||||
/// These types can be used with [`Params`]' `#[persist = "..."]` attributes.
|
/// These types can be used with [`Params`][super::Params]' `#[persist = "..."]` attributes.
|
||||||
///
|
///
|
||||||
/// This should be implemented for some type with interior mutability containing a `T`.
|
/// This should be implemented for some type with interior mutability containing a `T`.
|
||||||
//
|
//
|
||||||
|
|
|
@ -393,8 +393,8 @@ pub enum ProcessStatus {
|
||||||
KeepAlive,
|
KeepAlive,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The plugin's current processing mode. Can be queried through [`ProcessContext::process_mode()`].
|
/// The plugin's current processing mode. Exposed through [`BufferConfig::process_mode`]. The host
|
||||||
/// The host will reinitialize the plugin whenever this changes.
|
/// will reinitialize the plugin whenever this changes.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum ProcessMode {
|
pub enum ProcessMode {
|
||||||
/// The plugin is processing audio in real time at a fixed rate.
|
/// The plugin is processing audio in real time at a fixed rate.
|
||||||
|
|
Loading…
Reference in a new issue