1
0
Fork 0
Commit graph

309 commits

Author SHA1 Message Date
Robbert van der Helm 27bef6fbbc Move the param trait up in the module 2022-02-01 21:02:58 +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 bc60dc35b6 Fix rustdoc references 2022-02-01 20:53:20 +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 15e0f6f21a Remove unnecessary import
I was going to add that set_parameter function in the next commit, but
that will need to wait a bit.
2022-02-01 19:54:35 +01:00
Robbert van der Helm 473447179f Handle idempotent latency changes 2022-02-01 17:17:10 +01:00
Robbert van der Helm e2e2c59d34 Pass the process context to the plugin 2022-02-01 17:09:23 +01:00
Robbert van der Helm 3a1fbed4c3 Mark MainThreadExecutor::execute as unsafe
This should only be called from the main thread. Otherwise the API's
threading guarantees will not be upheld.
2022-02-01 17:01:05 +01:00
Robbert van der Helm 459175b470 Call the component handler for restarts 2022-02-01 16:59:11 +01:00
Robbert van der Helm 223d0c3a90 Take a reference to the component handler 2022-02-01 16:52:55 +01:00
Robbert van der Helm d47aac25a1 Rearrange WrapperInner parameters 2022-02-01 16:40:51 +01:00
Robbert van der Helm 565d9259c3 Use weak references to the executor
So this cyclic reference can't keep it alive.
2022-02-01 15:31:16 +01:00
Robbert van der Helm 98076ff792 Use a custom .spawn_unchecked without nightly req
Courtesy of Yandros on the Rust Discord.
2022-02-01 15:04:36 +01:00
Robbert van der Helm 8a0e083168 Add a TODO and stub for parameter smoothing 2022-02-01 00:14:33 +01:00
Robbert van der Helm b15991a495 Add a todo and stub for setting parameter values 2022-02-01 00:01:52 +01:00
Robbert van der Helm 735cec4fba Update context docs 2022-02-01 00:01:43 +01:00
Robbert van der Helm f009384c2f Don't require Arcs for ProcessContext
It makes more sense to pass this as a reference, so the plugin cannot do
weird things with it.
2022-01-31 23:47:54 +01:00
Robbert van der Helm 22995df7ea Actually only calculate hashes once 2022-01-31 22:42:36 +01:00
Robbert van der Helm 7c57ac6737 Fix typo in hash overflow warning 2022-01-31 22:39:11 +01:00
Robbert van der Helm 5aec636f9f Format boolean parameters as On/Off by default 2022-01-31 22:36:58 +01:00
Robbert van der Helm 0aad790fd7 Fix deserializing boolean parameters 2022-01-31 22:32:20 +01:00
Robbert van der Helm 85db4d82df Fix param_id_to_hash name
These were swapped for some reason.
2022-01-31 22:24:07 +01:00
Robbert van der Helm 880ee92a47 Drop param_id_to_hash
As it turns out, it's redundant (and also had the opposite name).
2022-01-31 22:23:29 +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 260d38580b Warn on parameter hash overflow 2022-01-31 21:34:36 +01:00
Robbert van der Helm 54bcf52912 Add Default implementations for parameter types 2022-01-31 21:19:40 +01:00
Robbert van der Helm 6fc733e029 Add callbacks for parameter changes 2022-01-31 21:02:47 +01:00
Robbert van der Helm 44172da94f Use Arcs for the callbacks
So it becomes possible to reuse one callback for multiple parameters.
This will be important for value change notifications.
2022-01-31 20:44:10 +01:00
Robbert van der Helm c883e0000d Move the PersistentField implementations 2022-01-31 20:41:46 +01:00
Robbert van der Helm 4734a51440 Move wrapper data to an inner struct
This fixes the soundness issue with the use of Arc. Moving a `Box` to an
`Arc` frees the old boxed data, and the internal reference counting
would also try to free that. As an added benefit, we no longer need the
unsafe Send+Sync implementation for the event loop.
2022-01-31 20:18:12 +01:00
Robbert van der Helm 6c518fad9d Add stubs for using the event loop in VST3 wrapper 2022-01-31 19:47:16 +01:00
Robbert van der Helm 2380768bad Add a Linux-specific event loop
Implementations for Windows and macOS should be fairly similar, but
using the OS' message loop instad of a thread.
2022-01-31 19:45:11 +01:00
Robbert van der Helm 4495064558 Redesign the wrapper's interiors for thread safety
There are a lot of locks needed now here, but none of them should be
contended. This is much better than potentially having RefCell's blow up
due to simultaneous mutable borrows, and the Arc is needed for the event
loop.
2022-01-31 19:44:02 +01:00
Robbert van der Helm b65158283a Support parking_lot mutexes and rwlocks 2022-01-31 19:42:35 +01:00
Robbert van der Helm 1a2c90fdfd Set the VST3 parameter step counts 2022-01-31 13:33:30 +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 3111d75b29 Serialize custom persistent fields as base64
This still takes up more space than plain JSON would, but I don't know
if serde_json would allow inlining that JSON. Presumably not. It would
get hairy quickly as a regular embedded JSON string due to the encoding.
2022-01-30 18:15:01 +01:00
Robbert van der Helm 29a0f83163 Add a TODO on packing stored state 2022-01-30 17:29:25 +01:00
Robbert van der Helm f0ea9e9451 Fix broken rustdoc links 2022-01-30 17:17:34 +01:00
Robbert van der Helm a4606f41cd Add more TODOs for parameters and persistence 2022-01-30 17:16:12 +01:00
Robbert van der Helm 64cf04a77d Add a todo about parking_lot 2022-01-30 17:10:42 +01:00
Robbert van der Helm 486fc67a4b Serialize persistent fields for VST3 plugins 2022-01-30 17:09:18 +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 c286958c63 Swap around trait bound order 2022-01-30 13:15:42 +01:00
Robbert van der Helm b76b6e4a9b Add boolean parameters 2022-01-30 02:17:40 +01:00
Robbert van der Helm 7feb8006ef Persist the bypass parameter 2022-01-30 02:04:35 +01:00
Robbert van der Helm 16238f1e00 Support VST3 parameter flushes 2022-01-30 01:50:22 +01:00
Robbert van der Helm 6ddae6a506 Handle the output channel map
I apparently committed this a bit too early.
2022-01-30 01:43:40 +01:00
Robbert van der Helm 0c24398234 Target vst3-sys fork with better pointer semantics 2022-01-30 01:37:10 +01:00
Robbert van der Helm 902c3b2bf6 Upgrade vst3-sys dependency 2022-01-29 20:54:52 +01:00
Robbert van der Helm 3019f7aea6 Add a way to create VST3 bundles after building 2022-01-29 18:38:09 +01:00
Robbert van der Helm edab467538 Mention all channel lengths being equal 2022-01-29 16:45:33 +01:00
Robbert van der Helm 47d102f2ba Implement restoring parameter values 2022-01-29 16:42:20 +01:00
Robbert van der Helm dabd2beca8 Add functions for interacting with plain values 2022-01-29 14:59:59 +01:00
Robbert van der Helm ebb74a737c Use plain instead of unnormalized in the APIs
It takes more effort than what should be needed to tell normalized and
unnormalized apart at a glance.
2022-01-29 14:54:48 +01:00
Robbert van der Helm 97a88e0db2 Implement saving parameter state
Restoring is next.
2022-01-29 14:20:14 +01:00
Robbert van der Helm ef021915e5 Move the PlainParam functions to a trait
We can use this for setting parameter values, as a &Param can be turned
into a pointer which can then later be mapped to a parameter ID to
handle outputting parameter values.
2022-01-29 13:39:01 +01:00
Robbert van der Helm 5697183918 Rename from_string to set_from_string
To make it a bit more obvious at a glance that this mutates the
parameter.
2022-01-29 13:32:31 +01:00
Robbert van der Helm f5f143b4f0 Read updated parmater values from the process data 2022-01-29 01:01:14 +01:00
Robbert van der Helm 59b1132d3b Mark hyperlinks in doc comments 2022-01-28 18:10:28 +01:00
Robbert van der Helm 6b7acb7cb5 Add TODO for wrapping parameter access in a mutex 2022-01-28 17:58:40 +01:00
Robbert van der Helm e393b3e268 Add a todo for handling incoming parameter changes 2022-01-28 17:58:40 +01:00
Robbert van der Helm 7d0fce2f84 Implement audio processing 2022-01-28 17:58:40 +01:00
Robbert van der Helm 61d7905148 Add a todo for transport information in process 2022-01-28 15:18:55 +01:00
Robbert van der Helm 38bcf33a50 Use the precalculated bypass parameter hash 2022-01-28 14:52:04 +01:00
Robbert van der Helm 3064132821 Improve and simplify token handling in macros
The standard library macros also use a `$($foo:tt)*` for this, so we
should probably too. Since eprinln!() already handles trailing commas we
don't need to do any special handling, and this fixes parsing with
complex expressions as arguments.
2022-01-28 14:47:26 +01:00
Robbert van der Helm 71dc144c73 Add a simple formatters library
We can add common formats here so you don't need to repeat them all the
time.
2022-01-28 14:33:29 +01:00
Robbert van der Helm 6439acad84 Use the correct vendor name 2022-01-28 14:20:16 +01:00
Robbert van der Helm b14dc7eae9 Avoid duplicate units in VST3 parameter strings 2022-01-28 14:06:51 +01:00
Robbert van der Helm 47f84081dd Use a macro for the null pointer checks 2022-01-28 13:45:17 +01:00
Robbert van der Helm b9d38f5c39 Implement most of IAudioProcessor
Except for the process function itself.
2022-01-28 13:40:47 +01:00
Robbert van der Helm a34293fbb4 Silence too_many_arguments Clippy lint in wrapper
Aside from wrapping everything in another struct we can't really do
anything about this since this is all generated by the VST3 macro.
2022-01-28 13:39:44 +01:00
Robbert van der Helm fa13371c5f Allow trailing commas in debug macros 2022-01-28 13:32:37 +01:00
Robbert van der Helm b91a02baa6 Add a todo and idea for non-parameter persistence 2022-01-28 01:34:36 +01:00
Robbert van der Helm 5e17b2190a Add null pointer checks to the VST3 wrapper 2022-01-27 22:51:49 +01:00
Robbert van der Helm 91e20f1230 Don't internally use param string IDs in wrapper
This avoids a layer of indirection for every parameter lookup using a
hash.
2022-01-27 22:36:46 +01:00
Robbert van der Helm 217b28fdca Move VST3 categories and class ID to a new trait
Makes more sense than having this in either the general plugin trait or
as part of the macro.
2022-01-27 22:13:13 +01:00
Robbert van der Helm c11abdc77d Add a processing status for handling reverb tails 2022-01-27 21:03:49 +01:00
Robbert van der Helm b5636ef556 Implement the rest of IEditController 2022-01-27 19:55:24 +01:00
Robbert van der Helm 9ff881b355 Add functions for previewing parameter conversions 2022-01-27 19:43:19 +01:00
Robbert van der Helm 1f0dbdbbec Clean up parameter access conditionals
I forgot this works as an else if
2022-01-27 19:36:36 +01:00
Robbert van der Helm 338abf7367 Implement IEditController::getParamValueByString() 2022-01-27 19:30:42 +01:00
Robbert van der Helm d357add75a Implement most of the VST3 parameter handling 2022-01-27 00:19:50 +01:00
Robbert van der Helm ad94b44b93 Add lookup functions between strings and values
For parameters.
2022-01-27 00:15:11 +01:00
Robbert van der Helm dfbfc657a8 Add a getter for parameter units from poitners 2022-01-26 23:37:41 +01:00
Robbert van der Helm 186a924104 Implement a JUCE-compatible Rabin fingerprint 2022-01-26 23:35:01 +01:00
Robbert van der Helm 22be850d9e Implement IPluginFactory2 and IPluginFactory3 2022-01-26 22:23:44 +01:00
Robbert van der Helm 9046cfbe3a Add a version string constant 2022-01-26 22:20:15 +01:00
Robbert van der Helm 0a67c8e5f4 Correct the VST3 categories string length 2022-01-26 21:40:49 +01:00
Robbert van der Helm 35cf7ffc1d Implement IComponent 2022-01-26 21:12:13 +01:00
Robbert van der Helm 4014d83a9b Allow creating VST3 plugin instances 2022-01-26 21:12:02 +01:00
Robbert van der Helm a959f7a2ad Add an UTF-16 equivalent for strlcpy() 2022-01-26 21:02:52 +01:00
Robbert van der Helm 2614be26ab Add an unconditional debug assertion failure macro 2022-01-26 20:55:01 +01:00
Robbert van der Helm 19b51df357 Implement IPluginFactory up to creating instances 2022-01-26 20:05:51 +01:00
Robbert van der Helm a13263051a Add a VST3 categories constant for plugins 2022-01-26 19:49:22 +01:00
Robbert van der Helm dc6db232ed Pass a CID to the VST3 export macro
Seems much less prone to breakage than generating them, since this way
the programmer has full control.
2022-01-26 19:20:39 +01:00
Robbert van der Helm bd2e0eca0c Add a strlcpy implementation 2022-01-26 19:18:31 +01:00
Robbert van der Helm fa782ff938 Add a stub plugin factory implementation 2022-01-26 18:14:54 +01:00
Robbert van der Helm 031407754b Add name, vendor, and other constants to plugins 2022-01-26 18:14:13 +01:00
Robbert van der Helm 070e68c084 Move nih_plug to the repo's root
Makes more sense to have this be on the same level as the workspace
since technically this crate can be used separately.
2022-01-26 12:52:57 +01:00
Robbert van der Helm 736468a510 Move nih-plug to a workspace 2022-01-25 12:23:19 +01:00
Robbert van der Helm 2df0d7453d Fix library name in copyright headers 2022-01-25 02:19:53 +01:00
Robbert van der Helm 2598e97494 Add the basic plugin API 2022-01-25 02:19:31 +01:00
Robbert van der Helm e8697d9a74 Redo the parameters without atomics
These atomics make things more difficult and they don't solve the main
problem: storing the parameter objects in an easy to use struct while
still allowing hash based access to them from the plugin wrapper. Going
through this new Params trait makes a lot more sense, and with pinning
this should be safe.
2022-01-25 02:17:30 +01:00
Robbert van der Helm 4f501f539e Implement the rest of the basic parameter UI 2022-01-24 21:12:02 +01:00
Robbert van der Helm edf9e96975 Rename Normalize to NormalizebleRange
To hopefully make the use of trait a bit clearer. This is where higher
kinded types would have been nice.
2022-01-24 21:00:37 +01:00
Robbert van der Helm 64f7dc8148 Add some of the building blocks for param handling 2022-01-24 21:00:37 +01:00
Robbert van der Helm d748bd62ff Initial commit 2022-01-24 21:00:37 +01:00