From fe39d8dc016aeebe97a28595b7166c3d12a1eb95 Mon Sep 17 00:00:00 2001 From: probonopd Date: Wed, 20 Apr 2022 20:48:51 +0200 Subject: [PATCH] Support more MIDI CCs (#122) Add support for MIDI CCs 10 = Pan 71 = Resonance 74 = Frequency Cutoff 91 = Reverb Send 94 = Detune Level Closes #121 --- src/mididevice.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/mididevice.cpp b/src/mididevice.cpp index 33032ac..888c59d 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -31,10 +31,15 @@ #define MIDI_AFTERTOUCH 0b1010 // TODO #define MIDI_CONTROL_CHANGE 0b1011 #define MIDI_CC_BANK_SELECT_MSB 0 // TODO - #define MIDI_CC_MODULATION 1 - #define MIDI_CC_VOLUME 7 + #define MIDI_CC_MODULATION 1 + #define MIDI_CC_VOLUME 7 + #define MIDI_CC_PAN_POSITION 10 #define MIDI_CC_BANK_SELECT_LSB 32 #define MIDI_CC_BANK_SUSTAIN 64 + #define MIDI_CC_RESONANCE 71 + #define MIDI_CC_FREQUENCY_CUTOFF 74 + #define MIDI_CC_REVERB_LEVEL 91 + #define MIDI_CC_DETUNE_LEVEL 94 #define MIDI_PROGRAM_CHANGE 0b1100 #define MIDI_PITCH_BEND 0b1110 @@ -162,6 +167,10 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign m_pSynthesizer->SetVolume (pMessage[2], nTG); break; + case MIDI_CC_PAN_POSITION: + m_pSynthesizer->SetPan (pMessage[2], nTG); + break; + case MIDI_CC_BANK_SELECT_LSB: m_pSynthesizer->BankSelectLSB (pMessage[2], nTG); break; @@ -169,6 +178,22 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign case MIDI_CC_BANK_SUSTAIN: m_pSynthesizer->setSustain (pMessage[2] >= 64, nTG); break; + + case MIDI_CC_RESONANCE: + m_pSynthesizer->SetResonance (pMessage[2], nTG); + break; + + case MIDI_CC_FREQUENCY_CUTOFF: + m_pSynthesizer->SetCutoff (pMessage[2], nTG); + break; + + case MIDI_CC_REVERB_LEVEL: + m_pSynthesizer->SetReverbSend (pMessage[2], nTG); + break; + + case MIDI_CC_DETUNE_LEVEL: + m_pSynthesizer->SetMasterTune (pMessage[2], nTG); + break; } break;