1
0
Fork 0

Use Mutex instead of RwLock for gain example

Neither makes a lot of sense here, but RwLock makes even less sense.
This commit is contained in:
Robbert van der Helm 2022-11-04 18:08:01 +01:00
parent a0ca80297b
commit 560f97f77d

View file

@ -1,5 +1,5 @@
use nih_plug::prelude::*; use nih_plug::prelude::*;
use parking_lot::RwLock; use parking_lot::Mutex;
use std::sync::Arc; use std::sync::Arc;
struct Gain { struct Gain {
@ -23,7 +23,7 @@ struct GainParams {
/// together with a preset/state file saved for this plugin. This can be useful for storing /// together with a preset/state file saved for this plugin. This can be useful for storing
/// things like sample data. /// things like sample data.
#[persist = "industry_secrets"] #[persist = "industry_secrets"]
pub random_data: RwLock<Vec<f32>>, pub random_data: Mutex<Vec<f32>>,
/// You can also nest parameter structs. These will appear as a separate nested group if your /// You can also nest parameter structs. These will appear as a separate nested group if your
/// DAW displays parameters in a tree structure. /// DAW displays parameters in a tree structure.
@ -86,7 +86,7 @@ impl Default for GainParams {
.with_string_to_value(formatters::s2v_f32_gain_to_db()), .with_string_to_value(formatters::s2v_f32_gain_to_db()),
// Persisted fields can be initialized like any other fields, and they'll keep their // Persisted fields can be initialized like any other fields, and they'll keep their
// values when restoring the plugin's state. // values when restoring the plugin's state.
random_data: RwLock::new(Vec::new()), random_data: Mutex::new(Vec::new()),
sub_params: SubParams { sub_params: SubParams {
nested_parameter: FloatParam::new( nested_parameter: FloatParam::new(
"Unused Nested Parameter", "Unused Nested Parameter",