From 7c15a259ef3f4fa696406e52a6c79369ff6352ed Mon Sep 17 00:00:00 2001 From: Gergo Koteles Date: Sun, 22 Dec 2024 20:14:15 +0100 Subject: [PATCH] add hold mode --- src/mididevice.cpp | 5 +++++ src/minidexed.cpp | 9 +++++++++ src/minidexed.h | 1 + 3 files changed, 15 insertions(+) diff --git a/src/mididevice.cpp b/src/mididevice.cpp index b33fd728..d6ffc755 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -47,6 +47,7 @@ LOGMODULE ("mididevice"); #define MIDI_CC_BANK_SUSTAIN 64 #define MIDI_CC_PORTAMENTO 65 #define MIDI_CC_SOSTENUTO 66 + #define MIDI_CC_HOLD2 69 #define MIDI_CC_RESONANCE 71 #define MIDI_CC_FREQUENCY_CUTOFF 74 #define MIDI_CC_REVERB_LEVEL 91 @@ -425,6 +426,10 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign m_pSynthesizer->setPortamentoMode (pMessage[2] >= 64, nTG); break; + case MIDI_CC_HOLD2: + m_pSynthesizer->setHoldMode (pMessage[2] >= 64, nTG); + break; + case MIDI_CC_RESONANCE: m_pSynthesizer->SetResonance (maplong (pMessage[2], 0, 127, 0, 99), nTG); break; diff --git a/src/minidexed.cpp b/src/minidexed.cpp index fc07aa24..679f0e5d 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -839,6 +839,15 @@ void CMiniDexed::setSostenuto(bool sostenuto, unsigned nTG) m_pTG[nTG]->setSostenuto (sostenuto); } +void CMiniDexed::setHoldMode(bool holdmode, unsigned nTG) +{ + assert (nTG < CConfig::AllToneGenerators); + if (nTG >= m_nToneGenerators) return; // Not an active TG + + assert (m_pTG[nTG]); + m_pTG[nTG]->setHold (holdmode); +} + void CMiniDexed::panic(uint8_t value, unsigned nTG) { assert (nTG < CConfig::AllToneGenerators); diff --git a/src/minidexed.h b/src/minidexed.h index 199adfc4..5845d3b9 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -85,6 +85,7 @@ class CMiniDexed void setSustain (bool sustain, unsigned nTG); void setSostenuto (bool sostenuto, unsigned nTG); + void setHoldMode(bool holdmode, unsigned nTG); void panic (uint8_t value, unsigned nTG); void notesOff (uint8_t value, unsigned nTG); void setModWheel (uint8_t value, unsigned nTG);