From c8cc6bd26b06a4e9525cedb6127ae0004ccce94d Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 2 Feb 2022 15:12:33 +0100 Subject: [PATCH] Re-export all user facing includes --- plugins/gain/src/lib.rs | 9 +++------ plugins/sine/src/lib.rs | 9 +++------ src/lib.rs | 21 ++++++++++++++++----- src/param.rs | 5 +---- src/plugin.rs | 2 +- src/wrapper/vst3.rs | 7 ++++--- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/plugins/gain/src/lib.rs b/plugins/gain/src/lib.rs index 558f59cf..e18a52ca 100644 --- a/plugins/gain/src/lib.rs +++ b/plugins/gain/src/lib.rs @@ -18,13 +18,10 @@ extern crate nih_plug; use nih_plug::{ - buffer::Buffer, - context::ProcessContext, - formatters, - param::{BoolParam, FloatParam, Param, Params, Range}, - plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}, - util, + formatters, util, Buffer, BufferConfig, BusConfig, Plugin, ProcessContext, ProcessStatus, + Vst3Plugin, }; +use nih_plug::{BoolParam, FloatParam, Param, Params, Range}; use parking_lot::RwLock; use std::pin::Pin; diff --git a/plugins/sine/src/lib.rs b/plugins/sine/src/lib.rs index dab5bf1d..116b190c 100644 --- a/plugins/sine/src/lib.rs +++ b/plugins/sine/src/lib.rs @@ -18,13 +18,10 @@ extern crate nih_plug; use nih_plug::{ - buffer::Buffer, - context::ProcessContext, - formatters, - param::{FloatParam, Param, Params, Range}, - plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}, - util, + formatters, util, Buffer, BufferConfig, BusConfig, Plugin, ProcessContext, ProcessStatus, + Vst3Plugin, }; +use nih_plug::{FloatParam, Param, Params, Range}; use std::f32::consts; use std::pin::Pin; diff --git a/src/lib.rs b/src/lib.rs index 1534d424..efa63dd8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,15 +16,26 @@ // TODO: Once everything is more fleshed out, document the basic usage of this library -pub mod buffer; -pub mod context; #[macro_use] pub mod debug; + pub mod formatters; -pub mod param; -pub mod plugin; pub mod util; -pub mod wrapper; // Re-export our derive macros to make this a bit easier to use pub use nih_plug_derive::Params; + +// And also re-export anything you'd need to build a plugin +pub use buffer::Buffer; +pub use context::ProcessContext; +pub use param::internals::Params; +pub use param::range::Range; +pub use param::{BoolParam, FloatParam, IntParam, Param}; +pub use plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}; + +// The rest is either internal or already re-exported +mod buffer; +mod context; +pub mod param; +pub mod plugin; +pub mod wrapper; diff --git a/src/param.rs b/src/param.rs index d6d22232..5da14e75 100644 --- a/src/param.rs +++ b/src/param.rs @@ -19,7 +19,7 @@ use std::fmt::Display; use std::sync::Arc; -use self::range::NormalizebleRange; +use self::range::{NormalizebleRange, Range}; pub mod internals; pub mod range; @@ -27,9 +27,6 @@ pub mod range; pub type FloatParam = PlainParam; pub type IntParam = PlainParam; -pub use internals::Params; -pub use range::Range; - /// Describes a single parmaetre of any type. pub trait Param { /// The plain parameter type. diff --git a/src/plugin.rs b/src/plugin.rs index aed4d227..2c8e4295 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -18,7 +18,7 @@ use std::pin::Pin; use crate::buffer::Buffer; use crate::context::ProcessContext; -use crate::param::Params; +use crate::param::internals::Params; /// Basic functionality that needs to be implemented by a plugin. The wrappers will use this to /// expose the plugin in a particular plugin format. diff --git a/src/wrapper/vst3.rs b/src/wrapper/vst3.rs index 41f49994..273561dc 100644 --- a/src/wrapper/vst3.rs +++ b/src/wrapper/vst3.rs @@ -43,6 +43,7 @@ use widestring::U16CStr; use crate::buffer::Buffer; use crate::context::{EventLoop, MainThreadExecutor, OsEventLoop, ProcessContext}; use crate::param::internals::ParamPtr; +use crate::param::range::Range; use crate::param::Param; use crate::plugin::{BufferConfig, BusConfig, Plugin, ProcessStatus, Vst3Plugin}; use crate::wrapper::state::{ParamValue, State}; @@ -637,9 +638,9 @@ impl IEditController for Wrapper<'_, P> { info.step_count = match param_ptr { ParamPtr::FloatParam(_) => 0, ParamPtr::IntParam(p) => match (**p).range { - crate::param::Range::Linear { min, max } => max - min, - crate::param::Range::Skewed { min, max, .. } => max - min, - crate::param::Range::SymmetricalSkewed { min, max, .. } => max - min, + Range::Linear { min, max } => max - min, + Range::Skewed { min, max, .. } => max - min, + Range::SymmetricalSkewed { min, max, .. } => max - min, }, ParamPtr::BoolParam(_) => 1, };