Implement MIDI CC 120 (All Sound Off) and 123 (All Notes Off) (#127)

Implement MIDI CC 120 (All Sound Off) and 123 (All Notes Off)

Closes https://github.com/probonopd/MiniDexed/issues/126
pull/129/head^2
probonopd 3 years ago committed by GitHub
parent 33ebdcff21
commit 47ad10cbad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/mididevice.cpp
  2. 18
      src/minidexed.cpp
  3. 2
      src/minidexed.h

@ -40,6 +40,8 @@
#define MIDI_CC_FREQUENCY_CUTOFF 74 #define MIDI_CC_FREQUENCY_CUTOFF 74
#define MIDI_CC_REVERB_LEVEL 91 #define MIDI_CC_REVERB_LEVEL 91
#define MIDI_CC_DETUNE_LEVEL 94 #define MIDI_CC_DETUNE_LEVEL 94
#define MIDI_CC_ALL_SOUND_OFF 120
#define MIDI_CC_ALL_NOTES_OFF 123
#define MIDI_PROGRAM_CHANGE 0b1100 #define MIDI_PROGRAM_CHANGE 0b1100
#define MIDI_PITCH_BEND 0b1110 #define MIDI_PITCH_BEND 0b1110
@ -194,6 +196,14 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
case MIDI_CC_DETUNE_LEVEL: case MIDI_CC_DETUNE_LEVEL:
m_pSynthesizer->SetMasterTune (pMessage[2], nTG); m_pSynthesizer->SetMasterTune (pMessage[2], nTG);
break; break;
case MIDI_CC_ALL_SOUND_OFF:
m_pSynthesizer->panic (pMessage[2], nTG);
break;
case MIDI_CC_ALL_NOTES_OFF:
m_pSynthesizer->notesOff (pMessage[2], nTG);
break;
} }
break; break;

@ -521,6 +521,24 @@ void CMiniDexed::setSustain(bool sustain, unsigned nTG)
m_pTG[nTG]->setSustain (sustain); m_pTG[nTG]->setSustain (sustain);
} }
void CMiniDexed::panic(uint8_t value, unsigned nTG)
{
assert (nTG < CConfig::ToneGenerators);
assert (m_pTG[nTG]);
if (value == 0) {
m_pTG[nTG]->panic ();
}
}
void CMiniDexed::notesOff(uint8_t value, unsigned nTG)
{
assert (nTG < CConfig::ToneGenerators);
assert (m_pTG[nTG]);
if (value == 0) {
m_pTG[nTG]->notesOff ();
}
}
void CMiniDexed::setModWheel (uint8_t value, unsigned nTG) void CMiniDexed::setModWheel (uint8_t value, unsigned nTG)
{ {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);

@ -76,6 +76,8 @@ public:
void keydown (int16_t pitch, uint8_t velocity, unsigned nTG); void keydown (int16_t pitch, uint8_t velocity, unsigned nTG);
void setSustain (bool sustain, unsigned nTG); void setSustain (bool sustain, unsigned nTG);
void panic (uint8_t value, unsigned nTG);
void notesOff (uint8_t value, unsigned nTG);
void setModWheel (uint8_t value, unsigned nTG); void setModWheel (uint8_t value, unsigned nTG);
void setPitchbend (int16_t value, unsigned nTG); void setPitchbend (int16_t value, unsigned nTG);
void ControllersRefresh (unsigned nTG); void ControllersRefresh (unsigned nTG);

Loading…
Cancel
Save