From aa6288df7c9ef5108e1ef2cb85548cb6922cba9b Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 1 Feb 2017 12:01:25 +0100 Subject: Add parameter designation API (unused for now) --- distrho/DistrhoPlugin.hpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp index b31c3756..44c2b023 100644 --- a/distrho/DistrhoPlugin.hpp +++ b/distrho/DistrhoPlugin.hpp @@ -133,6 +133,29 @@ struct AudioPort { symbol() {} }; +/** + 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. @@ -172,6 +195,23 @@ struct ParameterRanges { min(mn), 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. */ @@ -289,6 +329,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 @@ -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) {} }; -- cgit v1.2.3