From 4f62ebd2ea9d5845fc29427c03cc097dadd574e6 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 23 Jul 2022 18:24:02 +0200 Subject: [PATCH] Wrap nested Params structs in Arcs So we can use the generic UIs. Vizia needs these to be 'static. --- plugins/spectral_compressor/src/compressor_bank.rs | 12 ++++++------ plugins/spectral_compressor/src/lib.rs | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/spectral_compressor/src/compressor_bank.rs b/plugins/spectral_compressor/src/compressor_bank.rs index 2f0a71ed..49f1af65 100644 --- a/plugins/spectral_compressor/src/compressor_bank.rs +++ b/plugins/spectral_compressor/src/compressor_bank.rs @@ -93,9 +93,9 @@ pub struct ThresholdParams { #[derive(Params)] pub struct CompressorBankParams { #[nested = "downwards"] - pub downwards: CompressorParams, + pub downwards: Arc, #[nested = "upwards"] - pub upwards: CompressorParams, + pub upwards: Arc, } /// This struct contains the parameters for either the upward or downward compressors. The `Params` @@ -217,18 +217,18 @@ impl CompressorBankParams { /// recompute its values on the next processing cycle. pub fn new(compressor: &CompressorBank) -> Self { CompressorBankParams { - downwards: CompressorParams::new( + downwards: Arc::new(CompressorParams::new( "downwards_", "Downwards", compressor.should_update_downwards_thresholds.clone(), compressor.should_update_downwards_ratios.clone(), - ), - upwards: CompressorParams::new( + )), + upwards: Arc::new(CompressorParams::new( "upwards_", "Upwards", compressor.should_update_upwards_thresholds.clone(), compressor.should_update_upwards_ratios.clone(), - ), + )), } } } diff --git a/plugins/spectral_compressor/src/lib.rs b/plugins/spectral_compressor/src/lib.rs index 8d7ee83c..0de09f07 100644 --- a/plugins/spectral_compressor/src/lib.rs +++ b/plugins/spectral_compressor/src/lib.rs @@ -79,14 +79,16 @@ struct Plan { #[derive(Params)] pub struct SpectralCompressorParams { + // NOTE: These `Arc`s are only here temporarily to work around Vizia's Lens requirements so we + // can use the generic UIs /// Global parameters. These could just live in this struct but I wanted a separate generic UI /// just for these. #[nested = "global"] - global: GlobalParams, + global: Arc, /// Parameters controlling the compressor thresholds and curves. #[nested = "threshold"] - threshold: compressor_bank::ThresholdParams, + threshold: Arc, /// Parameters for the upwards and downwards compressors. #[nested = "compressors"] compressors: compressor_bank::CompressorBankParams, @@ -241,9 +243,9 @@ impl SpectralCompressorParams { SpectralCompressorParams { // TODO: Do still enable per-block smoothing for these settings, because why not. This // will require updating the compressor bank. - global: GlobalParams::default(), + global: Arc::new(GlobalParams::default()), - threshold: compressor_bank::ThresholdParams::new(compressor_bank), + threshold: Arc::new(compressor_bank::ThresholdParams::new(compressor_bank)), compressors: compressor_bank::CompressorBankParams::new(compressor_bank), } }