commit 8ec4355df21cb1f1304013c43325e1b31f28015c
parent 574bf0e1923403f8745684b8d1f43c00f9466948
Author: Tal Aviram <me@talaviram.com>
Date: Thu, 26 Aug 2021 09:09:55 +0300
controller - add hook to detect when single/multi change request arrangment to update first channel param.
Diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/source/jucePlugin/VirusController.cpp b/source/jucePlugin/VirusController.cpp
@@ -14,7 +14,12 @@ namespace Virus
Controller::Controller(AudioPluginAudioProcessor &p, unsigned char deviceId) : m_processor(p), m_deviceId(deviceId)
{
registerParams();
- sendSysEx(constructMessage({MessageType::REQUEST_TOTAL}));
+ // add lambda to enforce updating patches when virus switch from/to multi/single.
+ (findSynthParam(0, 0x72, 0x7a))->onValueChanged = [this] {
+ const uint8_t prg = isMultiMode() ? 0x0 : 0x40;
+ sendSysEx(constructMessage({MessageType::REQUEST_SINGLE, 0x0, prg}));
+ };
+ sendSysEx(constructMessage({MessageType::REQUEST_TOTAL}));
sendSysEx(constructMessage({MessageType::REQUEST_ARRANGEMENT}));
startTimer(5);
}
@@ -238,6 +243,14 @@ namespace Virus
}
if (patch.bankNumber == 0)
{
+ // virus sends also the single buffer not matter what's the mode.
+ // instead of keeping both, we 'encapsulate' this into first channel.
+ // the logic to maintain this is done by listening the global single/multi param.
+ if (isMultiMode() && patch.progNumber == 0x40)
+ return;
+ else if (!isMultiMode() && patch.progNumber == 0x0)
+ return;
+
constexpr auto bankSize = kDataSizeInBytes / 2;
const auto ch = patch.progNumber == 0x40 ? 0 : patch.progNumber;
for (auto i = 0; i < kDataSizeInBytes; i++)