commit a98939a3c91a3890526eda148303664f9c1aa845
parent a56446c5f01ffcc15ac784f8a12d583f6b29de48
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Mon, 29 Jul 2024 17:07:52 +0200
support midi packets that use multiple bytes to define one parameter
Diffstat:
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/source/jucePluginLib/midipacket.cpp b/source/jucePluginLib/midipacket.cpp
@@ -17,6 +17,8 @@ namespace pluginLib
std::set<uint32_t> usedParts;
+ std::string lastParam;
+
for(uint32_t i=0; i<m_definitions.size(); ++i)
{
const auto& d = m_definitions[i];
@@ -24,14 +26,22 @@ namespace pluginLib
if(d.paramPart != AnyPart)
usedParts.insert(d.paramPart);
+ bool isNewParam = true;
+
if(d.type == MidiDataType::Parameter)
+ {
+ isNewParam = d.paramName != lastParam;
+ lastParam = d.paramName;
m_hasParameters = true;
+ }
const auto masked = static_cast<uint8_t>((0xff & d.paramMask) << d.paramShift);
- if(usedMask & masked)
+ if((usedMask & masked) || !isNewParam)
{
- // next byte starts if the current mask overlaps with an existing one
+ // next byte starts if the current mask overlaps with an existing one.
+ // next byte starts also if the parameter name is identical. In that case, multiple
+ // bytes form one parameter.
usedMask = 0;
++byteIndex;
}
diff --git a/source/jucePluginLib/parameterdescriptions.cpp b/source/jucePluginLib/parameterdescriptions.cpp
@@ -628,7 +628,7 @@ namespace pluginLib
else if(type == "null") byte.type = MidiDataType::Null;
else
{
- _errors << "Unknown midi packet data type " << type << ", midi packet " << _key << ", index " << i << std::endl;
+ _errors << "Unknown midi packet data type '" << type << "', midi packet " << _key << ", index " << i << std::endl;
return;
}