1
0
Fork 0
Commit graph

101 commits

Author SHA1 Message Date
Robbert van der Helm
28c7ea4843 Rename ExponentialIIR -> Exponential
The suffix was added to denote that this could do some funny things
because of the snapping to the target value, but in practice that
snapping distance will likely be so tiny that it is likely not
noticeable.
2022-05-12 02:22:12 +02:00
Robbert van der Helm
222036b335 Get rid of unnecessary loop in ExponentialIIR 2022-05-12 01:56:16 +02:00
Robbert van der Helm
116d245149 Add an exponential smoothing style
Based on a one-pole IIR low pass filter that reaches 99.97% of the
target value in the designated time before snapping to that value. This
will be less efficient than the linear FIR smoothing style.
2022-05-12 01:35:01 +02:00
Robbert van der Helm
06c5e4b04a Make parameter modulation stick after automation
This is how it's supposed to be implemented in CLAP.
2022-05-02 15:46:57 +02:00
Robbert van der Helm
ddbaffc0bb Add ParamMut method for setting modulation offset
This will be used in the CLAP wrapper to handle `CLAP_EVENT_PARAM_MOD`.
2022-05-01 19:03:04 +02:00
Robbert van der Helm
1d3ac1b2af Move param setting functions to new ParamMut trait
This makes things slightly less confusing because these functions should
never be called from user code.
2022-05-01 18:45:35 +02:00
Robbert van der Helm
a17c63bf71 Add parameter getters for unmodulated values
This is needed to be able to support modulation events in CLAP. There an
offset gets applied to the parameter's actual current value. That way
GUIs don't have to move around when parameters are being modulated and
save states cannot get influenced by modulation.
2022-05-01 18:30:30 +02:00
Robbert van der Helm
6451555f85 Add missing #[inline] attribute 2022-05-01 17:56:20 +02:00
Robbert van der Helm
2026257561 Get rid of Default implementations on ranges
These also don't make any sense anymore and will likely lead to more
problems than they solve.
2022-05-01 17:40:53 +02:00
Robbert van der Helm
d6bdfd7391 Get rid of Default implementations for params
These don't make any sense anymore with the builder API.
2022-05-01 17:40:26 +02:00
Robbert van der Helm
cd628e80ee Store normalized values on the param structs
This will be necessary to implement CLAP modulation later.
2022-05-01 17:34:59 +02:00
Robbert van der Helm
54d2a4cd2c Hide param fields other than value and smoothed
Direct initialization was no longer recommended anyways since now you
need to keep the default value in sync. The next couple of commits will
add a normalized value field and two more fields to help with
modulation.
2022-05-01 17:08:08 +02:00
Robbert van der Helm
48d0f87e4c Mark param value getters as inline 2022-05-01 16:40:16 +02:00
Robbert van der Helm
b89b4dfbb2 Add a .previous_value() method to the smoothers 2022-04-27 17:43:40 +02:00
Robbert van der Helm
9acd312768 Parmaeters are not real, they can't hurt you 2022-04-24 19:46:07 +02:00
Robbert van der Helm
7b24dea719 Clarify param_map() docstring 2022-04-13 20:20:27 +02:00
Robbert van der Helm
3c69fb72cf Make parameter names owned
That way you can generate parameters with custom `Params`
implementations.
2022-04-11 23:27:36 +02:00
Robbert van der Helm
083885a40c Rework Params trait API with Arc instead of Pin
This is a breaking change requiring a small change to plugin
implementations.

The reason why `Pin<&dyn Params>` was used was more as a hint to
indicate that the object must last for the plugin's lifetime, but `Pin`
doesn't enforce that. It also makes the APIs a lot more awkward.
Requiring the use of `Arc` fixes the following problems:

- When storing the params object in the wrapper, the `ParamPtr`s are
  guaranteed to be stable.
- This makes it possible to access the `Params` object without acquiring
  a lock on the plugin, this is very important for implementing
  plugin-side preset management.
- It enforces immutability on the `Params` object.
- And of course the API is much nicer without a bunch of unsafe code to
  work around Pin's limitations.
2022-04-07 15:31:46 +02:00
Robbert van der Helm
98d725d24f Add an Iterator implementation for smoothers 2022-04-04 17:58:25 +02:00
Robbert van der Helm
6f01097b03 Add mapped next_block() functions for smoothers 2022-04-04 17:44:49 +02:00
Robbert van der Helm
8d71369b2e Rename .is_bypass() to .make_bypass()
Because just like `.bypass()` sounds like a getter, so does
`.is_bypass()`.
2022-03-27 03:45:06 +02:00
Robbert van der Helm
8090d0ae41 Add explicit bypass parameter handling
Plugins can mark a `BoolParam` with `.is_bypass()`. Hosts can then link
use that parameter directly in their own UI.
2022-03-23 17:42:48 +01:00
Robbert van der Helm
3d7a23c812 Expose steps_left on the smoothers 2022-03-23 16:50:09 +01:00
Robbert van der Helm
a1be942d6d Add flags to control parameter visibility
For the host and in generic UIs. These aren't wired up to anything yet.
2022-03-23 13:04:14 +01:00
Robbert van der Helm
30b913e159 Don't use direct Param initialization in exmaples
Since you now also need to specify the default field you probably
shouldn't use this anymore.
2022-03-21 13:29:03 +01:00
Robbert van der Helm
40d99a5cb3 Automatically implement Param::set_normalized_value() 2022-03-21 13:28:59 +01:00
Robbert van der Helm
021d175264 Use a default implementation for Param::normalized_value() 2022-03-21 13:28:59 +01:00
Robbert van der Helm
a844051054 Store defaults on Param objects
And add methods for querying them.
2022-03-21 12:49:59 +01:00
Robbert van der Helm
c22e522629 Greatly simplify Params trait
This now is a single vector with all of the information in the correct
order instead of the hashmaps and a vector. This avoids deduplication,
and it especially makes manual `Params` implementations a lot more
convenient since you can't mess up with mismatching IDs between the
methods.

To accommodate exactly this, the persistent fields methods also have a
default implementation and the trait has been marked as `unsafe` since
it's the programmer's responsibility to make sure these `ParamPtr`s will
remain valid.
2022-03-20 13:05:02 +01:00
Robbert van der Helm
a6f4202ac5 Add a todo for combining the Params methods 2022-03-20 02:44:13 +01:00
Robbert van der Helm
b9d79771cc Use String instead of &'static str in Params
This may hurt performance in generic UIs a bit, but it will allow you to
programatically generate custom Params implementations for repeated
Parameters structs.
2022-03-20 02:14:18 +01:00
Robbert van der Helm
4c5d61057e Fix typos 2022-03-19 19:24:08 +01:00
Robbert van der Helm
a6e35cfaa9 Add methods for normalized parameter stepping
This is mostly useful for GUIs.
2022-03-19 16:12:56 +01:00
Robbert van der Helm
95370667d7 Rearrange the Param methods 2022-03-19 16:09:31 +01:00
Robbert van der Helm
d9330628c0 Add stepping functions to Param
This can be useful for GUI widgets.
2022-03-19 16:06:20 +01:00
Robbert van der Helm
f43d209a60 Add a .plain_value() to ParamPtr
Useful for snapping when you don't have access to the concrete parameter
type.
2022-03-18 18:10:22 +01:00
Robbert van der Helm
fb60f3a28b Remove unused Param::set_from_string
This method is a bit more efficient than converting the string to a
normalized value and then setting the parameter using that but it's not
used right now and it adds a form of redundancy.
2022-03-18 17:53:38 +01:00
Robbert van der Helm
581e5911fc Add parameter groups with #[nested = "Group Name"] 2022-03-16 17:04:38 +01:00
Robbert van der Helm
6628baf47e Split up the nih_plug_derive crate into modules 2022-03-16 15:53:35 +01:00
Robbert van der Helm
1a7ad0a7a0 Trim whitespace and units when parsing parameters 2022-03-08 18:53:35 +01:00
Robbert van der Helm
c3767831cd Mention unit handing in value to string 2022-03-08 18:47:28 +01:00
Robbert van der Helm
329da782b5 Fix with_string_to_value() after param refactor 2022-03-07 21:00:39 +01:00
Robbert van der Helm
963696cbff Warn on invalid ranges with logarithmic smoothing 2022-03-06 12:27:52 +01:00
Robbert van der Helm
03eef2c832 Require PartialEq on plain parameter types
So you can compare them in parameter widgets.
2022-03-05 19:50:12 +01:00
Robbert van der Helm
e491ff6319 Fix clippy lints 2022-03-04 15:07:34 +01:00
Robbert van der Helm
80457ac0f9 Fix doc links after prelude migration 2022-03-03 23:30:29 +01:00
Robbert van der Helm
f581294d7b Update rustdoc formatting for links
Apparently it showed this text verbatim, and not in monospace.
2022-03-03 23:05:12 +01:00
Robbert van der Helm
8acebadac0 Fix EnumParam step count after refactor 2022-03-03 21:34:04 +01:00
Robbert van der Helm
02a6b99308 Fix broken links in docs 2022-03-03 21:22:20 +01:00
Robbert van der Helm
4160970571 Implement PersistentField for AtomicRefCell 2022-03-03 21:21:08 +01:00