free-audio / clap

Audio Plugin API
https://cleveraudio.org/
MIT License
1.78k stars 100 forks source link

Add flag for enum parameters #358

Closed messmerd closed 11 months ago

messmerd commented 11 months ago

See the proposal here: https://github.com/free-audio/clap/discussions/357

This PR adds a CLAP_PARAM_IS_ENUM flag to clap_param_info_flags to denote an enum parameter.

This flag tells the host when a parameter represents a set of named options mapped to integers, which can help the host decide how to present the parameter to users in its UI.

CLAassistant commented 11 months ago

CLA assistant check
All committers have signed the CLA.

defiantnerd commented 11 months ago

I think this is really useful PR.

abique commented 11 months ago

Maybe it needs a comment to say that the enum isn't allowed to have "holes" between min and max?

defiantnerd commented 11 months ago

Maybe it needs a comment to say that the enum isn't allowed to have "holes" between min and max?

Maybe, although it should be totally clear. You can't have holes in a normal parameter, too.

messmerd commented 11 months ago

Maybe I could add this wording?

_These named options should be available via value_totext() for each integer value within the parameter's [min, max] range.

abique commented 11 months ago

Maybe I'd put the comment like this.

// Indicates that this parameter represents an enumerated value.
// If you set this flag, then you must set CLAP_PARAM_IS_STEPPED too.
// All values from min to max must have a non blank value_to_text().
abique commented 11 months ago

Thank you :+1:

baconpaul commented 11 months ago

Oh this is great and I'll use it all the time!