diff options
author | falkTX <falktx@gmail.com> | 2017-02-01 12:01:25 +0100 |
---|---|---|
committer | falkTX <falktx@gmail.com> | 2017-02-01 12:01:51 +0100 |
commit | aa6288df7c9ef5108e1ef2cb85548cb6922cba9b (patch) | |
tree | adb36d4064d7c23b66954238ba2299b1029d93f8 | |
parent | 9b69b9da63eeef62c47a170b94b28923aa9420f1 (diff) |
Add parameter designation API (unused for now)
-rw-r--r-- | distrho/DistrhoPlugin.hpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp index b31c3756..44c2b023 100644 --- a/distrho/DistrhoPlugin.hpp +++ b/distrho/DistrhoPlugin.hpp @@ -134,6 +134,29 @@ struct AudioPort { }; /** + Parameter designation.@n + Allows a parameter to be specially designated for a task, like bypass. + + Each designation is unique, there must be only one parameter that uses it.@n + The use of designated parameters is completely optional. + + @note Designated parameters have strict ranges. + @see ParameterRanges::adjustForDesignation() + */ +enum ParameterDesignation { + /** + Null or unset designation. + */ + kParameterDesignationNull = 0, + + /** + Bypass designation.@n + When on (> 0.5f), it means the plugin must run in a bypassed state. + */ + kParameterDesignationBypass = 1 +}; + +/** Parameter ranges.@n This is used to set the default, minimum and maximum values of a parameter. @@ -173,6 +196,23 @@ struct ParameterRanges { max(mx) {} /** + Adjust ranges for a specific parameter designation. + */ + void adjustForDesignation(ParameterDesignation d) noexcept + { + switch (d) + { + case kParameterDesignationNull: + break; + case kParameterDesignationBypass: + def = 0.0f; + min = 0.0f; + max = 1.0f; + break; + } + } + + /** Fix the default value within range. */ void fixDefault() noexcept @@ -290,6 +330,11 @@ struct Parameter { ParameterRanges ranges; /** + Designation for this parameter. + */ + ParameterDesignation designation; + + /** MIDI CC to use by default on this parameter.@n A value of 0 or 32 (bank change) is considered invalid.@n Must also be less or equal to 120. @@ -306,6 +351,7 @@ struct Parameter { symbol(), unit(), ranges(), + designation(kParameterDesignationNull), midiCC(0) {} /** @@ -317,6 +363,7 @@ struct Parameter { symbol(s), unit(u), ranges(def, min, max), + designation(kParameterDesignationNull), midiCC(0) {} }; |