Skip to content

Commit

Permalink
Make json processor parsing more robust and add lifted delay
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Sep 16, 2024
1 parent 6877457 commit a1a17ca
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 7 deletions.
39 changes: 32 additions & 7 deletions src-ui/app/edit-screen/components/ProcessorPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ void ProcessorPane::rebuildControlsFromDescription()
layoutControlsRingMod();
break;

case dsp::processor::proct_lifted_delay:
layoutControlsFromJSONOrDefault("processors/lifteddelay.json");
break;

case dsp::processor::proct_fx_bitcrusher:
layoutControlsFromJSONOrDefault("processors/bitcrusher.json");
break;
Expand Down Expand Up @@ -548,20 +552,34 @@ bool ProcessorPane::layoutControlsFromJSON(const std::string &jsonpath,
auto ei = ictag("display-if", -1);
if (ei >= 0)
{
auto eiv = intAttachments[ei]->getValue();
if (!eiv)
if (!intAttachments[ei])
{
SCLOG("display-if attached to unknown int param " << ei);
}
else
{
continue;
auto eiv = intAttachments[ei]->getValue();
if (!eiv)
{
continue;
}
}
}

ei = ictag("display-unless", -1);
if (ei >= 0)
{
auto eiv = intAttachments[ei]->getValue();
if (eiv)
if (!intAttachments[ei])
{
SCLOG("display-unless attached to unknown int param " << ei);
}
else
{
continue;
auto eiv = intAttachments[ei]->getValue();
if (eiv)
{
continue;
}
}
}

Expand Down Expand Up @@ -605,7 +623,14 @@ bool ProcessorPane::layoutControlsFromJSON(const std::string &jsonpath,
auto ei = ictag("enable-if", -1);
if (ei >= 0)
{
floatEditors[c.index]->item->setEnabled(intAttachments[ei]->getValue());
if (intAttachments[ei])
{
floatEditors[c.index]->item->setEnabled(intAttachments[ei]->getValue());
}
else
{
SCLOG("enable-if attached to unknown int param " << ei);
}
}
}
else if (tp == "int" && c.index >= 0)
Expand Down
119 changes: 119 additions & 0 deletions src-ui/json-assets/processors/lifteddelay.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"defaults": {
"coordinate-system": "absolute",
"component": "knob",
"type": "float"
},
"components": [
{
"index": 0,
"coordinates": [
5,
2,
50,
50
],
"label": "Left"
},
{
"index": 1,
"coordinates": [
60,
2,
50,
50
],
"label": "Right"
},
{
"index": 2,
"coordinates": [
5,
92,
40,
40
],
"label": "F/B"
},
{
"index": 3,
"coordinates": [
45,
92,
40,
40
],
"label": "Cross"
},
{
"component": "subheader",
"coordinates": [
7,
75,
86,
15
],
"label": "Feedback"
},
{
"index": 4,
"coordinates": [
95,
92,
40,
40
],
"label": "LoCut"
},
{
"index": 5,
"coordinates": [
140,
92,
40,
40
],
"label": "HiCut"
},
{
"component": "subheader",
"coordinates": [
97,
75,
86,
15
],
"label": "Filter"
},
{
"index": 6,
"coordinates": [
122,
20,
30,
30
],
"label": "Rate"
},
{
"index": 7,
"coordinates": [
155,
20,
30,
30
],
"label": "Amt"
},
{
"component": "subheader",
"coordinates": [
122,
4,
65,
15
],
"label": "Mod"
}
]
}

0 comments on commit a1a17ca

Please sign in to comment.