commit 9d1b7ad881324132b798d5de08c0d3dedd92e840
parent 579ad7ea27ac0a19bbf052bbbff97ca6588b6e87
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sat, 1 Jun 2024 13:00:56 +0200
rename ControlChange to Midi and ChangedBy to Origin
Diffstat:
15 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/source/jucePluginEditorLib/focusedParameter.cpp b/source/jucePluginEditorLib/focusedParameter.cpp
@@ -29,8 +29,8 @@ namespace jucePluginEditorLib
{
m_boundParameters.insert({param, pluginLib::ParameterListener(param, [this](const pluginLib::Parameter* _param)
{
- if (_param->getChangeOrigin() == pluginLib::Parameter::ChangedBy::PresetChange ||
- _param->getChangeOrigin() == pluginLib::Parameter::ChangedBy::Derived)
+ if (_param->getChangeOrigin() == pluginLib::Parameter::Origin::PresetChange ||
+ _param->getChangeOrigin() == pluginLib::Parameter::Origin::Derived)
return;
if(auto* comp = m_parameterBinding.getBoundComponent(_param))
updateControlLabel(comp);
diff --git a/source/jucePluginEditorLib/pluginEditor.cpp b/source/jucePluginEditorLib/pluginEditor.cpp
@@ -442,7 +442,7 @@ namespace jucePluginEditorLib
if(_paramValues.empty())
return false;
- return getProcessor().getController().setParameters(_paramValues, m_processor.getController().getCurrentPart(), pluginLib::Parameter::ChangedBy::Ui);
+ return getProcessor().getController().setParameters(_paramValues, m_processor.getController().getCurrentPart(), pluginLib::Parameter::Origin::Ui);
}
bool Editor::keyPressed(const juce::KeyPress& _key)
diff --git a/source/jucePluginLib/controller.cpp b/source/jucePluginLib/controller.cpp
@@ -313,7 +313,7 @@ namespace pluginLib
return m_descriptions.getIndexByName(index, _name) ? index : InvalidParameterIndex;
}
- bool Controller::setParameters(const std::map<std::string, uint8_t>& _values, const uint8_t _part, const Parameter::ChangedBy _changedBy) const
+ bool Controller::setParameters(const std::map<std::string, uint8_t>& _values, const uint8_t _part, const Parameter::Origin _changedBy) const
{
bool res = false;
diff --git a/source/jucePluginLib/controller.h b/source/jucePluginLib/controller.h
@@ -39,7 +39,7 @@ namespace pluginLib
uint32_t getParameterIndexByName(const std::string& _name) const;
- bool setParameters(const std::map<std::string, uint8_t>& _values, uint8_t _part, Parameter::ChangedBy _changedBy) const;
+ bool setParameters(const std::map<std::string, uint8_t>& _values, uint8_t _part, Parameter::Origin _changedBy) const;
const MidiPacket* getMidiPacket(const std::string& _name) const;
diff --git a/source/jucePluginLib/parameter.cpp b/source/jucePluginLib/parameter.cpp
@@ -24,7 +24,7 @@ namespace pluginLib
onValueChanged(this);
}
- void Parameter::setDerivedValue(const int _value, const ChangedBy _origin, const bool _notifyHost)
+ void Parameter::setDerivedValue(const int _value, const Origin _origin, const bool _notifyHost)
{
const int newValue = clampValue(_value);
@@ -32,7 +32,7 @@ namespace pluginLib
return;
m_lastValue = newValue;
- m_lastValueOrigin = ChangedBy::Derived;
+ m_lastValueOrigin = Origin::Derived;
if(_notifyHost && getDescription().isPublic)
{
@@ -40,14 +40,14 @@ namespace pluginLib
switch (_origin)
{
- case ChangedBy::ControlChange:
- case ChangedBy::HostAutomation:
- case ChangedBy::Derived:
- setValue(v, ChangedBy::Derived);
+ case Origin::Midi:
+ case Origin::HostAutomation:
+ case Origin::Derived:
+ setValue(v, Origin::Derived);
break;
default:
beginChangeGesture();
- setValueNotifyingHost(v, ChangedBy::Derived);
+ setValueNotifyingHost(v, Origin::Derived);
endChangeGesture();
break;
}
@@ -119,7 +119,7 @@ namespace pluginLib
return juce::roundToInt(m_range.getRange().clipValue(static_cast<float>(_value)));
}
- void Parameter::setValueNotifyingHost(const float _value, const ChangedBy _origin)
+ void Parameter::setValueNotifyingHost(const float _value, const Origin _origin)
{
setValue(_value, _origin);
sendValueChangedMessageToListeners(_value);
@@ -153,10 +153,10 @@ namespace pluginLib
void Parameter::setValue(const float _newValue)
{
- setValue(_newValue, ChangedBy::HostAutomation);
+ setValue(_newValue, Origin::HostAutomation);
}
- void Parameter::setValue(const float _newValue, const ChangedBy _origin)
+ void Parameter::setValue(const float _newValue, const Origin _origin)
{
if (m_changingDerivedValues)
return;
@@ -170,13 +170,13 @@ namespace pluginLib
forwardToDerived(m_value.getValue(), _origin, true);
}
- void Parameter::setUnnormalizedValue(const int _newValue, const ChangedBy _origin)
+ void Parameter::setUnnormalizedValue(const int _newValue, const Origin _origin)
{
const auto v = convertTo0to1(static_cast<float>(_newValue));
setValue(v, _origin);
}
- void Parameter::forwardToDerived(const int _newValue, ChangedBy _origin, const bool _notifyHost)
+ void Parameter::forwardToDerived(const int _newValue, Origin _origin, const bool _notifyHost)
{
if (m_changingDerivedValues)
return;
@@ -189,7 +189,7 @@ namespace pluginLib
m_changingDerivedValues = false;
}
- void Parameter::setValueFromSynth(const int _newValue, const bool _notifyHost, const ChangedBy _origin)
+ void Parameter::setValueFromSynth(const int _newValue, const bool _notifyHost, const Origin _origin)
{
const auto clampedValue = clampValue(_newValue);
diff --git a/source/jucePluginLib/parameter.h b/source/jucePluginLib/parameter.h
@@ -16,11 +16,11 @@ namespace pluginLib
class Parameter : juce::Value::Listener, public juce::RangedAudioParameter
{
public:
- enum class ChangedBy
+ enum class Origin
{
Unknown,
PresetChange,
- ControlChange,
+ Midi,
HostAutomation,
Ui,
Derived
@@ -46,9 +46,9 @@ namespace pluginLib
float getValue() const override { return convertTo0to1(m_value.getValue()); }
int getUnnormalizedValue() const { return juce::roundToInt(m_value.getValue()); }
void setValue(float _newValue) override;
- void setValue(float _newValue, ChangedBy _origin);
- void setUnnormalizedValue(int _newValue, ChangedBy _origin);
- void setValueFromSynth(int _newValue, bool _notifyHost, ChangedBy _origin);
+ void setValue(float _newValue, Origin _origin);
+ void setUnnormalizedValue(int _newValue, Origin _origin);
+ void setValueFromSynth(int _newValue, bool _notifyHost, Origin _origin);
bool isDiscrete() const override { return m_desc.isDiscrete; }
bool isBoolean() const override { return m_desc.isBool; }
@@ -82,9 +82,9 @@ namespace pluginLib
const std::set<Parameter*>& getDerivedParameters() { return m_derivedParameters; }
- ChangedBy getChangeOrigin() const { return m_lastValueOrigin; }
+ Origin getChangeOrigin() const { return m_lastValueOrigin; }
- void setValueNotifyingHost(float _value, ChangedBy _origin);
+ void setValueNotifyingHost(float _value, Origin _origin);
void setRateLimitMilliseconds(uint32_t _ms);
@@ -96,11 +96,11 @@ namespace pluginLib
private:
static juce::String genId(const Description &d, int part, int uniqueId);
void valueChanged(juce::Value &) override;
- void setDerivedValue(int _value, ChangedBy _origin, bool _notifyHost);
+ void setDerivedValue(int _value, Origin _origin, bool _notifyHost);
void sendToSynth();
static uint64_t milliseconds();
void sendParameterChangeDelayed(uint8_t, uint32_t _uniqueId);
- void forwardToDerived(int _newValue, ChangedBy _origin, bool _notifyHost);
+ void forwardToDerived(int _newValue, Origin _origin, bool _notifyHost);
int clampValue(int _value) const;
@@ -111,7 +111,7 @@ namespace pluginLib
const int m_uniqueId; // 0 for all unique parameters, > 0 if multiple Parameter instances reference a single synth parameter
int m_lastValue{-1};
- ChangedBy m_lastValueOrigin = ChangedBy::Unknown;
+ Origin m_lastValueOrigin = Origin::Unknown;
juce::Value m_value;
std::set<Parameter*> m_derivedParameters;
bool m_changingDerivedValues = false;
diff --git a/source/jucePluginLib/parameterbinding.cpp b/source/jucePluginLib/parameterbinding.cpp
@@ -24,17 +24,17 @@ namespace pluginLib
void ParameterBinding::MouseListener::mouseDrag(const juce::MouseEvent& event)
{
- m_param->setValueNotifyingHost(m_param->convertTo0to1(static_cast<float>(m_slider->getValue())), Parameter::ChangedBy::Ui);
+ m_param->setValueNotifyingHost(m_param->convertTo0to1(static_cast<float>(m_slider->getValue())), Parameter::Origin::Ui);
}
void ParameterBinding::MouseListener::mouseWheelMove(const juce::MouseEvent& event, const juce::MouseWheelDetails& wheel)
{
- m_param->setValueNotifyingHost(m_param->convertTo0to1(static_cast<float>(m_slider->getValue())), Parameter::ChangedBy::Ui);
+ m_param->setValueNotifyingHost(m_param->convertTo0to1(static_cast<float>(m_slider->getValue())), Parameter::Origin::Ui);
}
void ParameterBinding::MouseListener::mouseDoubleClick(const juce::MouseEvent& event)
{
- m_param->setValueNotifyingHost(m_param->getDefaultValue(), Parameter::ChangedBy::Ui);
+ m_param->setValueNotifyingHost(m_param->getDefaultValue(), Parameter::Origin::Ui);
}
ParameterBinding::~ParameterBinding()
@@ -165,7 +165,7 @@ namespace pluginLib
if(v->getDescription().isPublic)
{
v->beginChangeGesture();
- v->setValueNotifyingHost(v->convertTo0to1(static_cast<float>(id - 1)), Parameter::ChangedBy::Ui);
+ v->setValueNotifyingHost(v->convertTo0to1(static_cast<float>(id - 1)), Parameter::Origin::Ui);
v->endChangeGesture();
}
v->getValueObject().setValue(id - 1);
diff --git a/source/jucePluginLib/parameterlink.cpp b/source/jucePluginLib/parameterlink.cpp
@@ -32,7 +32,7 @@ namespace pluginLib
if(!m_targets.insert(_target).second)
return false;
- _target->setUnnormalizedValue(m_sourceValue, Parameter::ChangedBy::Ui);
+ _target->setUnnormalizedValue(m_sourceValue, Parameter::Origin::Ui);
return true;
}
diff --git a/source/jucePluginLib/softknob.cpp b/source/jucePluginLib/softknob.cpp
@@ -55,14 +55,14 @@ namespace pluginLib
return;
const auto v = m_sourceParam->getValue();
- m_targetParam->setValue(v, Parameter::ChangedBy::Derived);
+ m_targetParam->setValue(v, Parameter::Origin::Derived);
}
void SoftKnob::onTargetValueChanged()
{
assert(m_targetParam);
const auto v = m_targetParam->getValue();
- m_sourceParam->setValue(v, Parameter::ChangedBy::Derived);
+ m_sourceParam->setValue(v, Parameter::Origin::Derived);
}
void SoftKnob::bind()
diff --git a/source/mqJucePlugin/mqController.cpp b/source/mqJucePlugin/mqController.cpp
@@ -195,10 +195,10 @@ void Controller::applyPatchParameters(const pluginLib::MidiPacket::ParamValues&
for (const auto& it : _params)
{
auto* p = getParameter(it.first.second, _part);
- p->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
+ p->setValueFromSynth(it.second, false, pluginLib::Parameter::Origin::PresetChange);
for (const auto& derivedParam : p->getDerivedParameters())
- derivedParam->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
+ derivedParam->setValueFromSynth(it.second, false, pluginLib::Parameter::Origin::PresetChange);
}
getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
@@ -307,7 +307,7 @@ bool Controller::parseSysexMessage(const pluginLib::SysEx& _msg, synthLib::MidiE
auto& params = findSynthParam(part, page, index);
for (auto& param : params)
- param->setValueFromSynth(value, true, pluginLib::Parameter::ChangedBy::ControlChange);
+ param->setValueFromSynth(value, true, pluginLib::Parameter::Origin::Midi);
LOG("Single parameter " << static_cast<int>(index) << ", page " << static_cast<int>(page) << " for part " << static_cast<int>(part) << " changed to value " << static_cast<int>(value));
}
diff --git a/source/virusJucePlugin/Parts.cpp b/source/virusJucePlugin/Parts.cpp
@@ -116,7 +116,7 @@ namespace genericVirusUI
{
menu.addItem(name + ' ' + std::to_string(i + 1), true, v->getUnnormalizedValue() == i, [v, i]
{
- v->setValue(v->convertTo0to1(i), pluginLib::Parameter::ChangedBy::Ui);
+ v->setValue(v->convertTo0to1(i), pluginLib::Parameter::Origin::Ui);
});
}
diff --git a/source/virusJucePlugin/VirusController.cpp b/source/virusJucePlugin/VirusController.cpp
@@ -166,10 +166,10 @@ namespace Virus
}
}
for (const auto& param : globalParams)
- param->setValueFromSynth(value, true, pluginLib::Parameter::ChangedBy::ControlChange);
+ param->setValueFromSynth(value, true, pluginLib::Parameter::Origin::Midi);
}
for (const auto& param : partParams)
- param->setValueFromSynth(value, true, pluginLib::Parameter::ChangedBy::ControlChange);
+ param->setValueFromSynth(value, true, pluginLib::Parameter::Origin::Midi);
// TODO:
/**
If a
@@ -454,7 +454,7 @@ namespace Virus
auto* p = getParameter(it->first.second, ch);
if(locked.find(p->getDescription().name) == locked.end())
- p->setValueFromSynth(it->second, false, pluginLib::Parameter::ChangedBy::PresetChange);
+ p->setValueFromSynth(it->second, false, pluginLib::Parameter::Origin::PresetChange);
}
getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
@@ -535,7 +535,7 @@ namespace Virus
if(desc.page != virusLib::PAGE_C)
continue;
- param->setValueFromSynth(value, false, pluginLib::Parameter::ChangedBy::PresetChange);
+ param->setValueFromSynth(value, false, pluginLib::Parameter::Origin::PresetChange);
}
getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
@@ -563,7 +563,7 @@ namespace Virus
const auto& params = findSynthParam(part, page, m.b);
for (const auto & p : params)
- p->setValueFromSynth(m.c, true, pluginLib::Parameter::ChangedBy::ControlChange);
+ p->setValueFromSynth(m.c, true, pluginLib::Parameter::Origin::Midi);
return true;
}
diff --git a/source/virusJucePlugin/VirusEditor.cpp b/source/virusJucePlugin/VirusEditor.cpp
@@ -396,7 +396,7 @@ namespace genericVirusUI
const auto playMode = getController().getParameterIndexByName(Virus::g_paramPlayMode);
auto* param = getController().getParameter(playMode);
- param->setValue(param->convertTo0to1(_playMode), pluginLib::Parameter::ChangedBy::Ui);
+ param->setValue(param->convertTo0to1(_playMode), pluginLib::Parameter::Origin::Ui);
// we send this directly here as we request a new arrangement below, we don't want to wait on juce to inform the knob to have changed
getController().sendParameterChange(*param, _playMode);
diff --git a/source/xtJucePlugin/xtController.cpp b/source/xtJucePlugin/xtController.cpp
@@ -253,10 +253,10 @@ void Controller::applyPatchParameters(const pluginLib::MidiPacket::ParamValues&
for (const auto& it : _params)
{
auto* p = getParameter(it.first.second, _part);
- p->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
+ p->setValueFromSynth(it.second, false, pluginLib::Parameter::Origin::PresetChange);
for (const auto& derivedParam : p->getDerivedParameters())
- derivedParam->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
+ derivedParam->setValueFromSynth(it.second, false, pluginLib::Parameter::Origin::PresetChange);
}
getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
@@ -376,7 +376,7 @@ bool Controller::parseSysexMessage(const pluginLib::SysEx& _msg, synthLib::MidiE
auto& params = findSynthParam(part, page, index);
for (auto& param : params)
- param->setValueFromSynth(value, true, pluginLib::Parameter::ChangedBy::ControlChange);
+ param->setValueFromSynth(value, true, pluginLib::Parameter::Origin::Midi);
LOG("Single parameter " << static_cast<int>(index) << ", page " << static_cast<int>(page) << " for part " << static_cast<int>(part) << " changed to value " << static_cast<int>(value));
}
diff --git a/source/xtJucePlugin/xtEditor.cpp b/source/xtJucePlugin/xtEditor.cpp
@@ -199,7 +199,7 @@ namespace xtJucePlugin
if(newText.empty())
continue;
- p->setValue(p->convertTo0to1(static_cast<float>(v)), pluginLib::Parameter::ChangedBy::Ui);
+ p->setValue(p->convertTo0to1(static_cast<float>(v)), pluginLib::Parameter::Origin::Ui);
break;
}
}