1
0
Fork 0

Rename the params module to param

It's a heterogeneous module, and splitting the ranges to their own
module will be a bit weird otherwise.
This commit is contained in:
Robbert van der Helm 2022-02-01 20:50:52 +01:00
parent 31481c406b
commit 6bb83061dd
7 changed files with 11 additions and 11 deletions

View file

@ -104,9 +104,9 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
// function we get type erasure for free since we only need to worry about byte // function we get type erasure for free since we only need to worry about byte
// vectors // vectors
field_serialize_tokens.push(quote! { field_serialize_tokens.push(quote! {
match ::nih_plug::params::PersistentField::map( match ::nih_plug::param::PersistentField::map(
&self.#field_name, &self.#field_name,
::nih_plug::params::serialize_field, ::nih_plug::param::serialize_field,
) { ) {
Ok(data) => { Ok(data) => {
serialized.insert(String::from(#stable_name), data); serialized.insert(String::from(#stable_name), data);
@ -118,9 +118,9 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
}); });
field_deserialize_tokens.push(quote! { field_deserialize_tokens.push(quote! {
#stable_name => { #stable_name => {
match ::nih_plug::params::deserialize_field(&data) { match ::nih_plug::param::deserialize_field(&data) {
Ok(deserialized) => { Ok(deserialized) => {
::nih_plug::params::PersistentField::set( ::nih_plug::param::PersistentField::set(
&self.#field_name, &self.#field_name,
deserialized, deserialized,
); );
@ -152,7 +152,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
impl Params for #struct_name { impl Params for #struct_name {
fn param_map( fn param_map(
self: std::pin::Pin<&Self>, self: std::pin::Pin<&Self>,
) -> std::collections::HashMap<&'static str, nih_plug::params::ParamPtr> { ) -> std::collections::HashMap<&'static str, nih_plug::param::ParamPtr> {
let mut param_map = std::collections::HashMap::new(); let mut param_map = std::collections::HashMap::new();
#(#param_mapping_insert_tokens)* #(#param_mapping_insert_tokens)*

View file

@ -20,7 +20,7 @@ extern crate nih_plug;
use nih_plug::{ use nih_plug::{
context::ProcessContext, context::ProcessContext,
formatters, formatters,
params::{BoolParam, FloatParam, Param, Params, Range}, param::{BoolParam, FloatParam, Param, Params, Range},
plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}, plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin},
util, util,
}; };

View file

@ -20,7 +20,7 @@ extern crate nih_plug;
use nih_plug::{ use nih_plug::{
context::ProcessContext, context::ProcessContext,
formatters, formatters,
params::{FloatParam, Param, Params, Range}, param::{FloatParam, Param, Params, Range},
plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}, plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin},
util, util,
}; };

View file

@ -20,7 +20,7 @@ pub mod context;
#[macro_use] #[macro_use]
pub mod debug; pub mod debug;
pub mod formatters; pub mod formatters;
pub mod params; pub mod param;
pub mod plugin; pub mod plugin;
pub mod util; pub mod util;
pub mod wrapper; pub mod wrapper;

View file

@ -17,7 +17,7 @@
use std::pin::Pin; use std::pin::Pin;
use crate::context::ProcessContext; use crate::context::ProcessContext;
use crate::params::Params; use crate::param::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.

View file

@ -41,7 +41,7 @@ use vst3_sys::VST3;
use widestring::U16CStr; use widestring::U16CStr;
use crate::context::{EventLoop, MainThreadExecutor, OsEventLoop, ProcessContext}; use crate::context::{EventLoop, MainThreadExecutor, OsEventLoop, ProcessContext};
use crate::params::{Param, ParamPtr}; use crate::param::{Param, ParamPtr};
use crate::plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}; use crate::plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin};
use crate::wrapper::state::{ParamValue, State}; use crate::wrapper::state::{ParamValue, State};
use crate::wrapper::util::{hash_param_id, strlcpy, u16strlcpy}; use crate::wrapper::util::{hash_param_id, strlcpy, u16strlcpy};
@ -634,7 +634,7 @@ impl<P: Plugin> IEditController for Wrapper<'_, P> {
info.step_count = match param_ptr { info.step_count = match param_ptr {
ParamPtr::FloatParam(_) => 0, ParamPtr::FloatParam(_) => 0,
ParamPtr::IntParam(p) => match (**p).range { ParamPtr::IntParam(p) => match (**p).range {
crate::params::Range::Linear { min, max } => max - min, crate::param::Range::Linear { min, max } => max - min,
}, },
ParamPtr::BoolParam(_) => 1, ParamPtr::BoolParam(_) => 1,
}; };