Skip to content

Commit

Permalink
Forbid readonly automatable/modulatable parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
robbert-vdh committed Sep 30, 2023
1 parent c40919a commit f1d444e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).

### Changed

- Having both the `CLAP_PARAM_IS_READONLY` flag and any of the
`CLAP_PARAM_IS_AUTOMATABLE` or `CLAP_PARAM_IS_MODULATABLE` flags set now
results in an error.
- The logic for which parameters can be randomized has changed. Previously all
parameters marked as automatable could be changed. Now parameters marked as
hidden or readonly are ignored instead, as non-automatable parameters can
Expand Down
11 changes: 11 additions & 0 deletions src/plugin/ext/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,17 @@ impl Params<'_> {
info.id
)
}
if ((info.flags & CLAP_PARAM_IS_READONLY) != 0)
&& ((info.flags & CLAP_PARAM_IS_AUTOMATABLE) != 0
|| (info.flags & CLAP_PARAM_IS_MODULATABLE) != 0)
{
anyhow::bail!(
"Parameter '{}' (stable ID {}) has the CLAP_PARAM_IS_READONLY flag set, but \
it is also marked as automatable or modulatable. This is likely a bug.",
&name,
info.id
)
}

let processed_info = Param {
name,
Expand Down

0 comments on commit f1d444e

Please sign in to comment.