Browse Source

Add initializer list constructor to ParameterRanges class

Signed-off-by: falkTX <falktx@falktx.com>
pull/232/head
falkTX 2 years ago
parent
commit
3fa7482577
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      distrho/DistrhoPlugin.hpp

+ 15
- 1
distrho/DistrhoPlugin.hpp View File

@@ -189,7 +189,7 @@ struct ParameterRanges {
float max;

/**
Default constructor, using 0.0 as minimum, 1.0 as maximum and 0.0 as default.
Default constructor, using 0.0 as default, 0.0 as minimum, 1.0 as maximum.
*/
ParameterRanges() noexcept
: def(0.0f),
@@ -204,6 +204,20 @@ struct ParameterRanges {
min(mn),
max(mx) {}

#ifdef DISTRHO_PROPER_CPP11_SUPPORT
/**
Constructor using an initializer list, like `{ 0.0f, 0.0f, 1.0f }`.
@note You MUST use 3 variables in the list!
*/
ParameterRanges(const std::initializer_list<float>& il)
{
std::initializer_list<float>::iterator ilit = il.begin();
def = *(ilit++);
min = *(ilit++);
max = *(ilit++);
}
#endif

/**
Fix the default value within range.
*/


Loading…
Cancel
Save