commit 337b2016f3ae49a7f4338a72035d3a72fd6e1b29
parent 3bba8d8a2a35a382d2470b07f39a0f186ae47f68
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Wed, 31 Jul 2024 21:30:30 +0200
implement proper derived parameter detection to prevent Sync and RingMod overlap
Diffstat:
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/source/nord/n2x/n2xJucePlugin/n2xController.cpp b/source/nord/n2x/n2xJucePlugin/n2xController.cpp
@@ -197,4 +197,30 @@ namespace n2xJucePlugin
return true;
}
+
+ bool Controller::isDerivedParameter(pluginLib::Parameter& _derived, pluginLib::Parameter& _base) const
+ {
+ if(_base.getDescription().isNonPartSensitive() || _derived.getDescription().isNonPartSensitive())
+ return false;
+
+ if(_derived.getParameterIndex() != _base.getParameterIndex())
+ return false;
+
+ const auto& packetName = midiPacketName(MidiPacketType::SingleDump);
+ const auto* packet = getMidiPacket(packetName);
+
+ if (!packet)
+ {
+ LOG("Failed to find midi packet " << packetName);
+ return true;
+ }
+
+ const auto* defA = packet->getDefinitionByParameterName(_derived.getDescription().name);
+ const auto* defB = packet->getDefinitionByParameterName(_base.getDescription().name);
+
+ if (!defA || !defB)
+ return true;
+
+ return defA->doMasksOverlap(*defB);
+ }
}
diff --git a/source/nord/n2x/n2xJucePlugin/n2xController.h b/source/nord/n2x/n2xJucePlugin/n2xController.h
@@ -44,5 +44,7 @@ namespace n2xJucePlugin
std::vector<uint8_t> createSingleDump(uint8_t _bank, uint8_t _program, uint8_t _part) const;
bool activatePatch(const std::vector<uint8_t>& _sysex, uint32_t _part);
+
+ bool isDerivedParameter(pluginLib::Parameter& _derived, pluginLib::Parameter& _base) const override;
};
}
\ No newline at end of file