gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 7cbb636d0a3a714b94249ac8dd825528756b4fad
parent 7488e833abacbdc38b264bf3d7ff63d3a8e4f168
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu,  9 May 2024 12:45:20 +0200

show message box if parameter description parsing fails

Diffstat:
Msource/jucePluginLib/controller.cpp | 9+++++++++
Msource/jucePluginLib/controller.h | 2+-
Msource/jucePluginLib/parameterdescriptions.cpp | 3+--
Msource/jucePluginLib/parameterdescriptions.h | 5+++++
4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/source/jucePluginLib/controller.cpp b/source/jucePluginLib/controller.cpp @@ -6,6 +6,8 @@ #include "processor.h" #include "dsp56kEmu/logging.h" +#include "juce_gui_basics/juce_gui_basics.h" // juce::NativeMessageBox + namespace pluginLib { uint8_t getParameterValue(Parameter* _p) @@ -15,6 +17,13 @@ namespace pluginLib Controller::Controller(pluginLib::Processor& _processor, const std::string& _parameterDescJson) : m_processor(_processor), m_descriptions(_parameterDescJson) { + if(!m_descriptions.isValid()) + { + juce::NativeMessageBox::showMessageBoxAsync(juce::MessageBoxIconType::WarningIcon, + _processor.getProperties().name + " - Failed to parse Parameter Descriptions json", + "Encountered errors while parsing parameter descriptions:\n\n" + m_descriptions.getErrors(), + nullptr, juce::ModalCallbackFunction::create([](int){})); + } } Controller::~Controller() diff --git a/source/jucePluginLib/controller.h b/source/jucePluginLib/controller.h @@ -25,7 +25,7 @@ namespace pluginLib public: static constexpr uint32_t InvalidParameterIndex = 0xffffffff; - explicit Controller(pluginLib::Processor& _processor, const std::string& _parameterDescJson); + explicit Controller(Processor& _processor, const std::string& _parameterDescJson); virtual ~Controller(); virtual void sendParameterChange(const Parameter& _parameter, uint8_t _value) = 0; diff --git a/source/jucePluginLib/parameterdescriptions.cpp b/source/jucePluginLib/parameterdescriptions.cpp @@ -10,8 +10,7 @@ namespace pluginLib { ParameterDescriptions::ParameterDescriptions(const std::string& _jsonString) { - const auto err = loadJson(_jsonString); - LOG(err); + m_errors = loadJson(_jsonString); } const MidiPacket* ParameterDescriptions::getMidiPacket(const std::string& _name) const diff --git a/source/jucePluginLib/parameterdescriptions.h b/source/jucePluginLib/parameterdescriptions.h @@ -46,6 +46,9 @@ namespace pluginLib const std::vector<uint32_t>& getControlledParameters(const synthLib::SMidiEvent& _ev); + const std::string& getErrors() const { return m_errors; } + bool isValid() const { return getErrors().empty(); } + private: std::string loadJson(const std::string& _jsonString); void parseMidiPackets(std::stringstream& _errors, juce::DynamicObject* _packets); @@ -67,5 +70,7 @@ namespace pluginLib std::vector<ParameterLink> m_parameterLinks; std::unordered_map<std::string, ParameterRegion> m_regions; std::unordered_map<uint8_t, std::unordered_map<uint8_t, std::vector<uint32_t>>> m_controllerMap; // type (control change, poly pressure) => index (modwheel, main vol, ...) => parameter index + + std::string m_errors; }; }