commit 42177454c77704740169fd5da75da8e509a86c7f
parent f8c6974f197436644ac01442c60927933ac9bfa7
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sat, 1 Jun 2024 12:49:31 +0200
[XT/mQ] fix excessive parameter updates sent to host when loading a preset
Diffstat:
5 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/source/jucePluginLib/controller.h b/source/jucePluginLib/controller.h
@@ -85,6 +85,9 @@ namespace pluginLib
const auto it = m_softKnobs.find(_parameter);
return it->second.get();
}
+
+ Processor& getProcessor() const { return m_processor; }
+
protected:
virtual Parameter* createParameter(Controller& _controller, const Description& _desc, uint8_t _part, int _uid);
void registerParams(juce::AudioProcessor& _processor);
diff --git a/source/mqJucePlugin/mqController.cpp b/source/mqJucePlugin/mqController.cpp
@@ -190,16 +190,18 @@ bool Controller::setCategory(pluginLib::MidiPacket::AnyPartParamValues& _values,
return setString(_values, "Category", 4, _value);
}
-void Controller::applyPatchParameters(const pluginLib::MidiPacket::ParamValues& _params, const uint8_t _part)
+void Controller::applyPatchParameters(const pluginLib::MidiPacket::ParamValues& _params, const uint8_t _part) const
{
for (const auto& it : _params)
{
auto* p = getParameter(it.first.second, _part);
- p->setValueFromSynth(it.second, true, pluginLib::Parameter::ChangedBy::PresetChange);
+ p->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
for (const auto& derivedParam : p->getDerivedParameters())
- derivedParam->setValueFromSynth(it.second, true, pluginLib::Parameter::ChangedBy::PresetChange);
+ derivedParam->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
}
+
+ getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
}
void Controller::parseSingle(const pluginLib::SysEx& _msg, const pluginLib::MidiPacket::Data& _data, const pluginLib::MidiPacket::ParamValues& _params)
diff --git a/source/mqJucePlugin/mqController.h b/source/mqJucePlugin/mqController.h
@@ -86,7 +86,7 @@ private:
void timerCallback() override;
void onStateLoaded() override;
- void applyPatchParameters(const pluginLib::MidiPacket::ParamValues& _params, uint8_t _part);
+ void applyPatchParameters(const pluginLib::MidiPacket::ParamValues& _params, uint8_t _part) const;
void parseSingle(const pluginLib::SysEx& _msg, const pluginLib::MidiPacket::Data& _data, const pluginLib::MidiPacket::ParamValues& _params);
void parseMulti(const pluginLib::SysEx& _msg, const pluginLib::MidiPacket::Data& _data, const pluginLib::MidiPacket::ParamValues& _params);
bool parseMidiPacket(MidiPacketType _type, pluginLib::MidiPacket::Data& _data, pluginLib::MidiPacket::AnyPartParamValues& _params, const pluginLib::SysEx& _sysex) const;
diff --git a/source/virusJucePlugin/VirusController.cpp b/source/virusJucePlugin/VirusController.cpp
@@ -457,7 +457,7 @@ namespace Virus
p->setValueFromSynth(it->second, false, pluginLib::Parameter::ChangedBy::PresetChange);
}
- m_processor.updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
+ getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
if(m_currentPresetSource[ch] != PresetSource::Browser)
{
@@ -538,7 +538,7 @@ namespace Virus
param->setValueFromSynth(value, false, pluginLib::Parameter::ChangedBy::PresetChange);
}
- m_processor.updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
+ getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
}
}
diff --git a/source/xtJucePlugin/xtController.cpp b/source/xtJucePlugin/xtController.cpp
@@ -253,11 +253,13 @@ void Controller::applyPatchParameters(const pluginLib::MidiPacket::ParamValues&
for (const auto& it : _params)
{
auto* p = getParameter(it.first.second, _part);
- p->setValueFromSynth(it.second, true, pluginLib::Parameter::ChangedBy::PresetChange);
+ p->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
for (const auto& derivedParam : p->getDerivedParameters())
- derivedParam->setValueFromSynth(it.second, true, pluginLib::Parameter::ChangedBy::PresetChange);
+ derivedParam->setValueFromSynth(it.second, false, pluginLib::Parameter::ChangedBy::PresetChange);
}
+
+ getProcessor().updateHostDisplay(juce::AudioProcessorListener::ChangeDetails().withProgramChanged(true));
}
void Controller::parseSingle(const pluginLib::SysEx& _msg, const pluginLib::MidiPacket::Data& _data, const pluginLib::MidiPacket::ParamValues& _params)