1
0
Fork 0
Commit graph

27 commits

Author SHA1 Message Date
Robbert van der Helm 2ae5aa429a Use nih_debug_assert_failure!() in derive macros
Instead of nih_log!(). These messages won't appear in release builds.
2022-04-11 17:47:32 +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 9e3149b931 Move ParamPtr to the prelude 2022-03-23 12:46:46 +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 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 7460a12d98 Consider generic Params structs in derive macro 2022-03-18 14:09:17 +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 943149aaee Qualify the nih_log!() in the proc macro 2022-03-04 12:01:35 +01:00
Robbert van der Helm 4c0b07c578 💥 Move re-exports to a prelude module
So you can import everything at once, because you're likely going to
need at least 90% of it anyways.
2022-03-03 23:23:51 +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 e4ca8ba75a Fix typo in proc macro 2022-03-03 20:48:40 +01:00
Robbert van der Helm be4bbd4400 Allow nested parameter structs
See the Parameters docstring for the caveats.
2022-03-03 20:38:28 +01:00
Robbert van der Helm ecd1be8965 Add a derive macro for Enum parameters 2022-02-14 16:16:05 +01:00
Robbert van der Helm d6b358f8ca Don't require importing Param for derive macro 2022-02-12 19:55:39 +01:00
Robbert van der Helm befe02cbc1 Error out when fields have duplicate names 2022-02-12 19:36:31 +01:00
Robbert van der Helm 4aa85b43b4 Move parameter implementation details to a module 2022-02-01 21:01:28 +01:00
Robbert van der Helm 6bb83061dd 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.
2022-02-01 20:51:22 +01:00
Robbert van der Helm fe8f1d27d6 Use a stable ordering for the parameters
As the fields are specified on the parameters struct.
2022-01-31 22:20:09 +01:00
Robbert van der Helm 6494d1ed5f Store persistent fields as plain JSON strings
On second thought, this is much better. The resulting file size will be
much smaller because only double quotes need to be escaped. It's also
easier to read at a glance.
2022-01-30 18:23:13 +01:00
Robbert van der Helm 221e424f78 Use thread safe interior mutability for persist
Sadly there's not really a safe way to do this otherwise, but if you
really want to have persistence this way and absolutely need it to be
lock-free (because you're going to use it from the GUI thread), then you
can implement your own PersistentField.
2022-01-30 17:07:50 +01:00
Robbert van der Helm 8ac036f6cc Add an API for persisting arbitrary fields 2022-01-30 16:14:52 +01:00
Robbert van der Helm 6fc4d80483 Change the id attribute to be a key value pair 2022-01-29 20:40:14 +01:00
Robbert van der Helm a9185dff21 Split finding and processing proc macro attributes
We're going to add another attribute that can't be combined with this
one.
2022-01-28 13:00:36 +01:00
Robbert van der Helm 5cc9931de6 Not all structs are called Foo 2022-01-25 20:02:58 +01:00
Robbert van der Helm 571dd1f2d4 Implement the Params derive proc macro 2022-01-25 19:55:01 +01:00
Robbert van der Helm 4cd9c6d3d3 Rename packages to snake case
I much prefer kebab case, but snake case is better here since Rust would
convert it to snake case when used as an identifier anyways and you also
can't use snake case modules without explicit module path attributes.
2022-01-25 12:35:13 +01:00