commit 12472ed42c4da08941f6f3024c1490187af67bbb
parent a3fa8a259bcea1b915f481016ea5df3c36664c28
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sun, 19 May 2024 17:55:23 +0200
ignore edits via poly pressure in editor if poly pressure is not enabled
Diffstat:
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/source/virusJucePlugin/VirusController.cpp b/source/virusJucePlugin/VirusController.cpp
@@ -551,7 +551,12 @@ namespace Virus
if (status == synthLib::M_CONTROLCHANGE)
page = virusLib::PAGE_A;
else if (status == synthLib::M_POLYPRESSURE)
+ {
+ // device decides if PP is enabled and will echo any parameter change to us. Reject any other source
+ if(m.source != synthLib::MidiEventSource::Plugin)
+ return false;
page = virusLib::PAGE_B;
+ }
else
return false;
diff --git a/source/virusLib/microcontroller.cpp b/source/virusLib/microcontroller.cpp
@@ -443,7 +443,12 @@ bool Microcontroller::sendMIDI(const SMidiEvent& _ev, FrontpanelState* _fpState/
break;
case M_POLYPRESSURE:
if(isPolyPressureForPageBEnabled())
+ {
applyToSingleEditBuffer(PAGE_B, singleMode ? SINGLE : channel, _ev.b, _ev.c);
+ auto e = _ev;
+ e.source = MidiEventSource::Plugin;
+ m_midiOutput.push_back(e);
+ }
break;
default:
break;
@@ -1170,24 +1175,30 @@ void Microcontroller::readMidiOut(std::vector<synthLib::SMidiEvent>& _midiOut)
std::lock_guard lock(m_mutex);
processHdi08Tx(_midiOut);
- if (m_pendingSysexInput.empty())
- return;
+ if (!m_pendingSysexInput.empty())
+ {
+ uint32_t eraseCount = 0;
- uint32_t eraseCount = 0;
+ for (const auto& input : m_pendingSysexInput)
+ {
+ if(!m_pendingPresetWrites.empty() || waitingForPresetReceiveConfirmation())
+ break;
- for (const auto& input : m_pendingSysexInput)
- {
- if(!m_pendingPresetWrites.empty() || waitingForPresetReceiveConfirmation())
- break;
+ sendSysex(input.second, _midiOut, input.first);
+ ++eraseCount;
+ }
- sendSysex(input.second, _midiOut, input.first);
- ++eraseCount;
+ if(eraseCount == m_pendingSysexInput.size())
+ m_pendingSysexInput.clear();
+ else if(eraseCount > 0)
+ m_pendingSysexInput.erase(m_pendingSysexInput.begin(), m_pendingSysexInput.begin() + eraseCount);
}
- if(eraseCount == m_pendingSysexInput.size())
- m_pendingSysexInput.clear();
- else if(eraseCount > 0)
- m_pendingSysexInput.erase(m_pendingSysexInput.begin(), m_pendingSysexInput.begin() + eraseCount);
+ if(!m_midiOutput.empty())
+ {
+ _midiOut.insert(_midiOut.end(), m_midiOutput.begin(), m_midiOutput.end());
+ m_midiOutput.clear();
+ }
}
void Microcontroller::sendPendingMidiEvents(const uint32_t _maxOffset)