Add ID renaming superpowers to #[nested(...)]

This can now be used for most common use cases where you previously had
to do a manual `Params` implementation, like arrays of parameter objects
and duplicate parameter objects.
This commit is contained in:
Robbert van der Helm
2022-10-13 01:20:56 +02:00
parent d57003a0e9
commit 727d88c4d7
9 changed files with 484 additions and 225 deletions

View File

@@ -154,9 +154,9 @@ pub enum ThresholdMode {
/// Contains the compressor parameters for both the upwards and downwards compressor banks.
#[derive(Params)]
pub struct CompressorBankParams {
#[nested = "upwards"]
#[nested(group = "upwards")]
pub upwards: Arc<CompressorParams>,
#[nested = "downwards"]
#[nested(group = "downwards")]
pub downwards: Arc<CompressorParams>,
}

View File

@@ -83,14 +83,14 @@ pub struct SpectralCompressorParams {
// 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"]
#[nested(group = "global")]
pub global: Arc<GlobalParams>,
/// Parameters controlling the compressor thresholds and curves.
#[nested = "threshold"]
#[nested(group = "threshold")]
pub threshold: Arc<compressor_bank::ThresholdParams>,
/// Parameters for the upwards and downwards compressors.
#[nested = "compressors"]
#[nested(group = "compressors")]
pub compressors: compressor_bank::CompressorBankParams,
}