commit 193b780bfb63409ee9a6078113c2be42aa25f1a2
parent eeeedff1475020d4c3000ec08b5348cd98f63f37
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Wed, 9 Mar 2022 22:40:40 +0100
split delay depth / reverb room type & delay lfo shape / reverb damping to fix combo boxes displaying too many entries
Diffstat:
6 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/source/jucePlugin/VirusController.cpp b/source/jucePlugin/VirusController.cpp
@@ -60,6 +60,8 @@ namespace Virus
// TODO: not register internal/unused params?
auto globalParams = std::make_unique<juce::AudioProcessorParameterGroup>("global", "Global", "|");
+ std::map<ParamIndex, int> knownParameterIndices;
+
for (uint8_t part = 0; part < 16; part++)
{
m_paramsByParamType[part].reserve(m_descriptions.getDescriptions().size());
@@ -76,7 +78,16 @@ namespace Virus
const ParamIndex idx = {static_cast<uint8_t>(desc.page), part, desc.index};
- auto p = std::make_unique<Parameter>(*this, desc, part);
+ int uid = 0;
+
+ auto itKnownParamIdx = knownParameterIndices.find(idx);
+
+ if(itKnownParamIdx == knownParameterIndices.end())
+ knownParameterIndices.insert(std::make_pair(idx, 0));
+ else
+ uid = ++itKnownParamIdx->second;
+
+ auto p = std::make_unique<Parameter>(*this, desc, part, uid);
m_paramsByParamType[part].push_back(p.get());
diff --git a/source/jucePlugin/VirusParameter.cpp b/source/jucePlugin/VirusParameter.cpp
@@ -4,8 +4,8 @@
namespace Virus
{
- Parameter::Parameter(Controller &ctrl, const Description& desc, const uint8_t partNum) :
- juce::RangedAudioParameter(genId(desc, partNum), "Ch " + juce::String(partNum + 1) + " " + desc.name), m_ctrl(ctrl),
+ Parameter::Parameter(Controller &ctrl, const Description& desc, const uint8_t partNum, const int uniqueId) :
+ RangedAudioParameter(genId(desc, partNum, uniqueId), "Ch " + juce::String(partNum + 1) + " " + desc.name), m_ctrl(ctrl),
m_desc(desc), m_partNum(partNum)
{
m_range.start = static_cast<float>(m_desc.range.getStart());
@@ -47,9 +47,11 @@ namespace Virus
}
}
- juce::String Parameter::genId(const Description &d, const int part)
+ juce::String Parameter::genId(const Description &d, const int part, const int uniqueId)
{
- return juce::String::formatted("%d_%d_%d", (int)d.page, part, d.index);
+ if(uniqueId > 0)
+ return juce::String::formatted("%d_%d_%d_%d", static_cast<int>(d.page), part, d.index, uniqueId);
+ return juce::String::formatted("%d_%d_%d", static_cast<int>(d.page), part, d.index);
}
} // namespace Virus
diff --git a/source/jucePlugin/VirusParameter.h b/source/jucePlugin/VirusParameter.h
@@ -25,7 +25,7 @@ namespace Virus
VIRUS_C = 0x100,
};
- Parameter(Controller &, const Description& desc, uint8_t partNum = 0x40);
+ Parameter(Controller &, const Description& desc, uint8_t partNum, int uniqueId);
juce::Value &getValueObject() { return m_value; };
const juce::Value &getValueObject() const { return m_value; };
@@ -72,7 +72,7 @@ namespace Virus
std::function<void()> onValueChanged = {};
private:
- static juce::String genId(const Description &d, int part);
+ static juce::String genId(const Description &d, int part, int uniqueId);
void valueChanged(juce::Value &) override;
Controller &m_ctrl;
diff --git a/source/jucePlugin/VirusParameterDescription.h b/source/jucePlugin/VirusParameterDescription.h
@@ -121,8 +121,10 @@ namespace Virus
Param_DelayTime,
Param_DelayFeedback,
Param_DelayRateReverbDecayTime,
- Param_DelayDepthReverbRoomSize,
+ Param_DelayDepth,
+ Param_ReverbRoomSize,
Param_DelayLfoShape,
+ Param_ReverbDamping,
Param_DelayColor,
Param_KeybLocal,
Param_AllNotesOff,
diff --git a/source/jucePlugin/parameterDescriptions_C.json b/source/jucePlugin/parameterDescriptions_C.json
@@ -121,9 +121,10 @@
{"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":114, "name":"Delay Time", "min":0, "max":127, "isPublic":true, "isDiscrete":false, "isBool":false},
{"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":115, "name":"Delay Feedback", "min":0, "max":127, "isPublic":true, "isDiscrete":false, "isBool":false},
{"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":116, "name":"Dly Rate / Rev Decay", "min":0, "max":127, "isPublic":true, "isDiscrete":false, "isBool":false},
- {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":117, "name":"Dly Depth / Rev Size", "min":0, "max":127, "toText":"reverbRoomSize", "isPublic":true, "isDiscrete":true, "isBool":false},
- {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":118, "name":"Delay Lfo Shape", "min":0, "max":127, "toText":"delayLfoShape", "isPublic":true, "isDiscrete":true, "isBool":false},
- // {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":118, "name":"Reverb Damping", "min":0, "max":127, "isPublic":true, "isDiscrete":false, "isBool":false},
+ {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":117, "name":"Dly Depth ", "min":0, "max":127, "isPublic":true, "isDiscrete":false, "isBool":false},
+ {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":117, "name":"Rev Size", "min":0, "max":3, "toText":"reverbRoomSize", "isPublic":true, "isDiscrete":true, "isBool":false},
+ {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":118, "name":"Delay Lfo Shape", "min":0, "max":5, "toText":"delayLfoShape", "isPublic":true, "isDiscrete":true, "isBool":false},
+ {"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":118, "name":"Reverb Damping", "min":0, "max":127, "isPublic":true, "isDiscrete":false, "isBool":false},
{"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":119, "name":"Delay Color", "min":0, "max":127, "toText":"signed", "isPublic":true, "isDiscrete":false, "isBool":false, "isBipolar":true},
{"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":122, "name":"Keyb Local", "min":0, "max":1, "isPublic":false, "isDiscrete":false, "isBool":true},
{"page":"A", "class":"SoundbankA|MultiOrSingle|NonPartSensitive", "index":123, "name":"All Notes Off", "min":0, "max":127, "isPublic":false, "isDiscrete":false, "isBool":false},
diff --git a/source/jucePlugin/ui/Virus_FxEditor.cpp b/source/jucePlugin/ui/Virus_FxEditor.cpp
@@ -221,7 +221,7 @@ FxEditor::Delay::Delay(VirusParameterBinding &_parameterBinding)
_parameterBinding.bind(m_time, Virus::Param_DelayTime, 0);
_parameterBinding.bind(m_rate, Virus::Param_DelayRateReverbDecayTime, 0);
- _parameterBinding.bind(m_depth, Virus::Param_DelayDepthReverbRoomSize, 0);
+ _parameterBinding.bind(m_depth, Virus::Param_DelayDepth, 0);
_parameterBinding.bind(m_color, Virus::Param_DelayColor, 0);
_parameterBinding.bind(m_feedback, Virus::Param_DelayFeedback, 0);
}
@@ -240,10 +240,10 @@ FxEditor::Reverb::Reverb(VirusParameterBinding &_parameterBinding)
m_reverbMode.setBounds(18, 116+2+22, comboBoxWidth, comboBoxHeight);
addAndMakeVisible(m_reverbMode);
- _parameterBinding.bind(m_reverbMode, Virus::Param_DelayDepthReverbRoomSize, 0);
+ _parameterBinding.bind(m_reverbMode, Virus::Param_ReverbRoomSize, 0);
_parameterBinding.bind(m_time, Virus::Param_DelayTime, 0);
_parameterBinding.bind(m_rate, Virus::Param_DelayRateReverbDecayTime, 0);
- _parameterBinding.bind(m_damping, Virus::Param_DelayLfoShape, 0);
+ _parameterBinding.bind(m_damping, Virus::Param_ReverbDamping, 0);
_parameterBinding.bind(m_color, Virus::Param_DelayColor, 0);
_parameterBinding.bind(m_feedback, Virus::Param_DelayFeedback, 0);
}