Browse Source

Update meters example to use enumeration

master
falkTX 4 years ago
parent
commit
e38527d2f6
4 changed files with 21 additions and 7 deletions
  1. +1
    -1
      dpf
  2. +4
    -1
      plugins/Meters/DistrhoPluginInfo.h
  3. +12
    -1
      plugins/Meters/ExamplePluginMeters.cpp
  4. +4
    -4
      plugins/Meters/ExampleUIMeters.cpp

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit d6d1d3b55c2737a9a0c13f69ee76238917ad62e3
Subproject commit c2b9c40333a7b5e066dcb8d60fa023373b639324

+ 4
- 1
plugins/Meters/DistrhoPluginInfo.h View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -28,4 +28,7 @@
#define DISTRHO_PLUGIN_WANT_STATE 1
#define DISTRHO_UI_USE_NANOVG 1

#define METER_COLOR_GREEN 0
#define METER_COLOR_BLUE 1

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 12
- 1
plugins/Meters/ExamplePluginMeters.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -123,6 +123,17 @@ protected:
parameter.hints = kParameterIsAutomable|kParameterIsInteger;
parameter.name = "color";
parameter.symbol = "color";
parameter.enumValues.count = 2;
parameter.enumValues.restrictedMode = true;
{
ParameterEnumerationValue* const values = new ParameterEnumerationValue[2];
parameter.enumValues.values = values;
values[0].label = "Green";
values[0].value = METER_COLOR_GREEN;
values[1].label = "Blue";
values[1].value = METER_COLOR_BLUE;
}
break;
case 1:
parameter.hints = kParameterIsAutomable|kParameterIsOutput;


+ 4
- 4
plugins/Meters/ExampleUIMeters.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -58,7 +58,7 @@ protected:
switch (index)
{
case 0: // color
updateColor(value);
updateColor(std::round(value));
break;

case 1: // out-left
@@ -224,10 +224,10 @@ private:

switch (color)
{
case 0: // green
case METER_COLOR_GREEN:
fColor = Color(93, 231, 61);
break;
case 1: // blue
case METER_COLOR_BLUE:
fColor = Color(82, 238, 248);
break;
}


Loading…
Cancel
Save