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 705e25cfa3b63e3452b3045410f32443ced1f642
parent 01bac3c2da514dafba3b45ef323033313c820fe2
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Tue, 30 Apr 2024 00:14:50 +0200

add tool func to query target parameters from midi event

Diffstat:
Msource/jucePluginLib/parameterdescriptions.cpp | 19+++++++++++++++++++
Msource/jucePluginLib/parameterdescriptions.h | 7+++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/source/jucePluginLib/parameterdescriptions.cpp b/source/jucePluginLib/parameterdescriptions.cpp @@ -4,6 +4,8 @@ #include "../dsp56300/source/dsp56kEmu/logging.h" +#include "../synthLib/midiTypes.h" + namespace pluginLib { ParameterDescriptions::ParameterDescriptions(const std::string& _jsonString) @@ -61,6 +63,23 @@ namespace pluginLib return &it->second; } + const std::vector<uint32_t>& ParameterDescriptions::getControlledParameters(const synthLib::SMidiEvent& _ev) + { + static std::vector<uint32_t> empty; + + const uint8_t type = _ev.a & 0xf0; + + const auto itType = m_controllerMap.find(type); + if(itType == m_controllerMap.end()) + return empty; + + const auto itValue = itType->second.find(_ev.b); + if(itValue == itType->second.end()) + return empty; + + return itValue->second; + } + std::string ParameterDescriptions::loadJson(const std::string& _jsonString) { // juce' JSON parser doesn't like JSON5-style comments diff --git a/source/jucePluginLib/parameterdescriptions.h b/source/jucePluginLib/parameterdescriptions.h @@ -9,6 +9,11 @@ #include "parameterlink.h" #include "parameterregion.h" +namespace synthLib +{ + struct SMidiEvent; +} + namespace juce { class var; @@ -39,6 +44,8 @@ namespace pluginLib const ValueList* getValueList(const std::string& _key) const; + const std::vector<uint32_t>& getControlledParameters(const synthLib::SMidiEvent& _ev); + private: std::string loadJson(const std::string& _jsonString); void parseMidiPackets(std::stringstream& _errors, juce::DynamicObject* _packets);