Skip to content

Commit

Permalink
use indexed enumerator
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Aug 7, 2023
1 parent 6e89583 commit 624b18e
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:

env:
HVCC_VERSION: 82c5c3971eb77c8b508e3256abe00083662bf538
HVCC_VERSION: 598a412363c46666de53c54650c1995784fd3063

jobs:
linux-x86_64:
Expand Down
44 changes: 18 additions & 26 deletions override/HeavyDPF_WSTD_DLAY_UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@
START_NAMESPACE_DISTRHO

// --------------------------------------------------------------------------------------------------------------------

struct EnumParam {
const char* label;
float value;
};

class ImGuiPluginUI : public UI
{
float fcross = 20.0f;
float ffeedback = 25.0f;
float fmix = 50.0f;
bool fsync = 0.0f != 0.0f;
float ftime = 500.0f;
float ftimesync = 1.0f;
int ftimesync = 6.0;

int default_item_id = 6;
int current_item_id = default_item_id;

int items_len = 13;

ResizeHandle fResizeHandle;
Expand Down Expand Up @@ -153,20 +147,20 @@ class ImGuiPluginUI : public UI
syncstep = 0.03f;
}

EnumParam timesync_list[] = {
{ "×6", 0.16666666666f },
{ "×5", 0.2f },
{ "×4", 0.25f },
{ "×3", 0.33333333333f },
{ "×2", 0.5f },
{ "×1.5", 0.66666666666f },
{ "×1", 1.0f },
{ "÷1.5",1.5f },
{ "÷2", 2.0f },
{ "÷3", 3.0f },
{ "÷4", 4.0f },
{ "÷5", 5.0f },
{ "÷6", 6.0f }
const char* timesync_list[13] = {
"×6",
"×5",
"×4",
"×3",
"×2",
"×1.5",
"×1",
"÷1.5",
"÷2",
"÷3",
"÷4",
"÷5",
"÷6",
};

ImGui::PushFont(titleBarFont);
Expand Down Expand Up @@ -200,19 +194,17 @@ class ImGuiPluginUI : public UI
if (fsync)
{
if (ImGuiKnobs::KnobInt(
"Time", &current_item_id, 0, items_len-1, syncstep, timesync_list[current_item_id].label,
"Time", &ftimesync, 0, items_len-1, syncstep, timesync_list[ftimesync],
ImGuiKnobVariant_SteppedTick, hundred, ImGuiKnob_Flags, items_len))
{
if (ImGui::IsItemActivated())
{
editParameter(5, true);
if (ImGui::IsMouseDoubleClicked(0))
{
ftimesync = timesync_list[default_item_id].value;
current_item_id = default_item_id;
ftimesync = default_item_id;
}
}
ftimesync = timesync_list[current_item_id].value;
setParameterValue(5, ftimesync);
}
}
Expand Down
30 changes: 15 additions & 15 deletions wstd_dlay.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
"midi_input": 0,
"midi_output": 0,
"enumerators": {
"TimeSync": {
"×6": 0.16666666666,
"×5": 0.2,
"×4": 0.25,
"×3": 0.33333333333,
"×2": 0.5,
"×1.5": 0.66666666666,
"×1": 1.0,
"÷1.5": 1.5,
"÷2": 2.0,
"÷3": 3.0,
"÷4": 4.0,
"÷5": 5.0,
"÷6": 6.0
}
"TimeSync": [
"×6",
"×5",
"×4",
"×3",
"×2",
"×1.5",
"×1",
"÷1.5",
"÷2",
"÷3",
"÷4",
"÷5",
"÷6"
]
},
"version": "0, 1, 0",
"license": "GPL-3.0-or-later",
Expand Down
174 changes: 108 additions & 66 deletions wstd_dlay.pd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#N canvas 827 239 527 327 12;
#N canvas 641 183 1121 664 12;
#X declare -path dep/;
#X obj 63 409 adc~;
#X obj 64 550 dac~;
Expand Down Expand Up @@ -26,73 +26,115 @@
#X obj 639 75 r Sync @hv_param 0 1 0 bool;
#X obj 639 106 tgl 25 0 empty empty empty 17 7 0 10 #191919 #ffffff #ffffff 0 1;
#X obj 750 177 min 5000;
#X obj 749 318 spigot;
#X obj 783 214 > 0;
#X obj 750 318 spigot;
#X obj 769 227 > 0;
#X obj 614 249 spigot;
#X obj 639 145 == 0;
#X obj 614 221 f;
#X obj 750 290 f;
#X obj 639 173 t b f;
#X obj 782 249 t b f;
#X obj 749 114 r TimeSync @hv_param 0.166667 6 1;
#N canvas 0 50 450 300 bpm_time_sync 1;
#X obj 519 319 /;
#X obj 481 266 f 60000;
#X obj 529 365 *;
#X obj 557 178 t b f;
#X obj 618 205 t b f;
#X obj 618 133 inlet;
#X obj 529 467 outlet;
#X obj 557 42 r __hv_dpf_bpm;
#X obj 557 320 f 500;
#X obj 529 416 change;
#X obj 557 133 f 120;
#X connect 0 0 2 0 empty;
#X connect 1 0 0 0 empty;
#X connect 2 0 9 0 empty;
#X connect 3 0 1 0 empty;
#X connect 3 0 8 0 empty;
#X connect 3 1 0 1 empty;
#X connect 4 0 1 0 empty;
#X connect 4 1 8 0 empty;
#X connect 5 0 4 0 empty;
#X connect 7 0 10 0 empty;
#X connect 8 0 2 1 empty;
#X connect 9 0 6 0 empty;
#X connect 10 0 3 0 empty;
#X restore 749 144 pd bpm_time_sync;
#X connect 0 0 22 0 empty;
#X connect 0 1 22 1 empty;
#X connect 2 0 7 0 empty;
#X connect 3 0 15 0 empty;
#X connect 4 0 17 0 empty;
#X connect 5 0 6 0 empty;
#X connect 6 0 22 2 empty;
#X connect 7 0 22 2 empty;
#X connect 10 0 11 0 empty;
#X connect 11 0 5 0 empty;
#X connect 12 0 2 0 empty;
#X connect 13 0 4 0 empty;
#X connect 14 0 12 0 empty;
#X connect 15 0 22 2 empty;
#X connect 16 0 13 0 empty;
#X connect 17 0 22 2 empty;
#X connect 19 0 30 0 empty;
#X connect 22 0 1 0 empty;
#X connect 22 1 1 1 empty;
#X connect 23 0 24 0 empty;
#X connect 24 0 29 0 empty;
#X connect 24 0 27 0 empty;
#X connect 25 0 31 0 empty;
#X connect 26 0 3 0 empty;
#X connect 27 0 33 0 empty;
#X connect 28 0 3 0 empty;
#X connect 29 0 32 0 empty;
#X connect 30 0 28 0 empty;
#X connect 31 0 26 0 empty;
#X connect 32 0 30 0 empty;
#X connect 32 1 28 1 empty;
#X connect 33 0 31 0 empty;
#X connect 33 1 26 1 empty;
#X connect 34 0 35 0 empty;
#X connect 35 0 25 0 empty;
#X obj 769 252 t b f;
#N canvas 2231 213 436 527 bpm_time_sync 0;
#X obj 59 323 /;
#X obj 21 270 f 60000;
#X obj 69 369 *;
#X obj 97 161 t b f;
#X obj 158 225 t b f;
#X obj 158 54 inlet;
#X obj 69 471 outlet;
#X obj 97 25 r __hv_dpf_bpm;
#X obj 97 324 f 500;
#X obj 69 420 change;
#X obj 97 116 f 120;
#X msg 158 109 0.166667;
#X msg 176 134 0.2;
#X msg 195 160 0.25;
#X msg 213 185 0.333333;
#X msg 232 134 0.6;
#X msg 251 160 0.666667;
#X msg 269 109 1;
#X msg 288 134 1.5;
#X msg 306 110 2;
#X msg 325 134 3;
#X msg 344 109 4;
#X obj 158 83 select 0 1 2 3 4 5 6 7 8 9 10 11 12;
#X msg 362 135 5;
#X msg 381 110 6;
#X connect 0 0 2 0;
#X connect 1 0 0 0;
#X connect 2 0 9 0;
#X connect 3 0 1 0;
#X connect 3 0 8 0;
#X connect 3 1 0 1;
#X connect 4 0 1 0;
#X connect 4 1 8 0;
#X connect 5 0 22 0;
#X connect 7 0 10 0;
#X connect 8 0 2 1;
#X connect 9 0 6 0;
#X connect 10 0 3 0;
#X connect 11 0 4 0;
#X connect 12 0 4 0;
#X connect 13 0 4 0;
#X connect 14 0 4 0;
#X connect 15 0 4 0;
#X connect 16 0 4 0;
#X connect 17 0 4 0;
#X connect 18 0 4 0;
#X connect 19 0 4 0;
#X connect 20 0 4 0;
#X connect 21 0 4 0;
#X connect 22 0 11 0;
#X connect 22 1 12 0;
#X connect 22 2 13 0;
#X connect 22 3 14 0;
#X connect 22 4 15 0;
#X connect 22 5 16 0;
#X connect 22 6 17 0;
#X connect 22 7 18 0;
#X connect 22 8 19 0;
#X connect 22 9 20 0;
#X connect 22 10 21 0;
#X connect 22 11 23 0;
#X connect 22 12 24 0;
#X connect 23 0 4 0;
#X connect 24 0 4 0;
#X restore 750 147 pd bpm_time_sync;
#X obj 358 438 print;
#X obj 750 116 r TimeSync @hv_param 0 12 6 int;
#X connect 0 0 22 0;
#X connect 0 1 22 1;
#X connect 2 0 7 0;
#X connect 3 0 15 0;
#X connect 4 0 17 0;
#X connect 5 0 6 0;
#X connect 6 0 22 2;
#X connect 7 0 22 2;
#X connect 10 0 11 0;
#X connect 11 0 5 0;
#X connect 12 0 2 0;
#X connect 13 0 4 0;
#X connect 14 0 12 0;
#X connect 15 0 22 2;
#X connect 15 0 35 0;
#X connect 16 0 13 0;
#X connect 17 0 22 2;
#X connect 19 0 30 0;
#X connect 22 0 1 0;
#X connect 22 1 1 1;
#X connect 23 0 24 0;
#X connect 24 0 29 0;
#X connect 24 0 27 0;
#X connect 25 0 31 0;
#X connect 26 0 3 0;
#X connect 27 0 33 0;
#X connect 28 0 3 0;
#X connect 29 0 32 0;
#X connect 30 0 28 0;
#X connect 31 0 26 0;
#X connect 32 0 30 0;
#X connect 32 1 28 1;
#X connect 33 0 31 0;
#X connect 33 1 26 1;
#X connect 34 0 25 0;
#X connect 36 0 34 0;

0 comments on commit 624b18e

Please sign in to comment.