Closed teodly closed 1 year ago
Everything you store in your plugin struct needs to be Sync
. The issue you're running into is that the type you're using contains a boxed trait object which does not have the Send + Sync
trait bounds, thus making it non-Sync. Since you'll have exclusive mutable access in the initialize, reset, and process functions you should be able to do whatever you want with your struct's fields, but you still need to be able to store them in a way that's Send+Sync. There's a proposed and currently nightly-only API for this through the Exclusive
` struct, but outside of reimplementing that yourself or using a crate I don't know if there's another alternative here.
Plugin
and most other traits now long require Send
as of a couple weeks ago (https://github.com/robbert-vdh/nih-plug/commit/f9bdaffc625cbb5cbf56c14b995c4c9d356dff09 for Plugin
). Sync
is no longer needed.
Hi, I'm trying to implement a variable clock delay plugin in the NIH-plug framework. Here's the WIP: https://github.com/teowoz/nih-plug/tree/varispeed-delay
The problem is, it looks like all members of plugin state struct must implement Sync trait, but the library I want to use (rubato) doesn't implement it:
The compiler says that resampler struct cannot be shared between threads safely, but it won't be used in multiple threads at once anyway, so why is the Sync trait required? Is there way around it? Sorry if it's a stupid question, I'm just starting to learn Rust.