1
0
Fork 0

Wrap nested Params structs in Arcs

So we can use the generic UIs. Vizia needs these to be 'static.
This commit is contained in:
Robbert van der Helm 2022-07-23 18:24:02 +02:00
parent 2fbf4ca00d
commit 4f62ebd2ea
2 changed files with 12 additions and 10 deletions

View file

@ -93,9 +93,9 @@ pub struct ThresholdParams {
#[derive(Params)] #[derive(Params)]
pub struct CompressorBankParams { pub struct CompressorBankParams {
#[nested = "downwards"] #[nested = "downwards"]
pub downwards: CompressorParams, pub downwards: Arc<CompressorParams>,
#[nested = "upwards"] #[nested = "upwards"]
pub upwards: CompressorParams, pub upwards: Arc<CompressorParams>,
} }
/// This struct contains the parameters for either the upward or downward compressors. The `Params` /// 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. /// recompute its values on the next processing cycle.
pub fn new(compressor: &CompressorBank) -> Self { pub fn new(compressor: &CompressorBank) -> Self {
CompressorBankParams { CompressorBankParams {
downwards: CompressorParams::new( downwards: Arc::new(CompressorParams::new(
"downwards_", "downwards_",
"Downwards", "Downwards",
compressor.should_update_downwards_thresholds.clone(), compressor.should_update_downwards_thresholds.clone(),
compressor.should_update_downwards_ratios.clone(), compressor.should_update_downwards_ratios.clone(),
), )),
upwards: CompressorParams::new( upwards: Arc::new(CompressorParams::new(
"upwards_", "upwards_",
"Upwards", "Upwards",
compressor.should_update_upwards_thresholds.clone(), compressor.should_update_upwards_thresholds.clone(),
compressor.should_update_upwards_ratios.clone(), compressor.should_update_upwards_ratios.clone(),
), )),
} }
} }
} }

View file

@ -79,14 +79,16 @@ struct Plan {
#[derive(Params)] #[derive(Params)]
pub struct SpectralCompressorParams { 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 /// Global parameters. These could just live in this struct but I wanted a separate generic UI
/// just for these. /// just for these.
#[nested = "global"] #[nested = "global"]
global: GlobalParams, global: Arc<GlobalParams>,
/// Parameters controlling the compressor thresholds and curves. /// Parameters controlling the compressor thresholds and curves.
#[nested = "threshold"] #[nested = "threshold"]
threshold: compressor_bank::ThresholdParams, threshold: Arc<compressor_bank::ThresholdParams>,
/// Parameters for the upwards and downwards compressors. /// Parameters for the upwards and downwards compressors.
#[nested = "compressors"] #[nested = "compressors"]
compressors: compressor_bank::CompressorBankParams, compressors: compressor_bank::CompressorBankParams,
@ -241,9 +243,9 @@ impl SpectralCompressorParams {
SpectralCompressorParams { SpectralCompressorParams {
// TODO: Do still enable per-block smoothing for these settings, because why not. This // TODO: Do still enable per-block smoothing for these settings, because why not. This
// will require updating the compressor bank. // 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), compressors: compressor_bank::CompressorBankParams::new(compressor_bank),
} }
} }