pull/287/head
BeZo 2 years ago
parent d62cbb724f
commit 31c52b3bc2
  1. 52
      src/mididevice.cpp
  2. 8
      src/mididevice.h
  3. 3
      src/minidexed.cpp

@ -489,10 +489,22 @@ void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nL
LOGDBG("Set Mono mode for TG %i", instanceID); LOGDBG("Set Mono mode for TG %i", instanceID);
m_pSynthesizer->setMonoMode(pMessage[5],instanceID); m_pSynthesizer->setMonoMode(pMessage[5],instanceID);
break; break;
case 90: // Set Cutoff
LOGDBG("Set Cutoff for TG %i", instanceID);
m_pSynthesizer->SetCutoff(pMessage[5], instanceID);
break;
case 91: // Set Reso
LOGDBG("Set Resonanece for TG %i", instanceID);
m_pSynthesizer->SetResonance(pMessage[5], instanceID);
break;
case 600: // Config requestnTG case 600: // Config requestnTG
LOGDBG("Config request received\n"); LOGDBG("Config request received\n");
SendSystemExclusiveConfig(nCable); SendSystemExclusiveConfig();
break; break;
// case 601:
// printf("Get Bank Name\n");
// std::string Value = pUIMenu->m_pMiniDexed->GetSysExFileLoader ()->GetBankName (nValue);
// break;
/* End of BeZo patches */ /* End of BeZo patches */
case 100: case 100:
// load sysex-data into voice memory // load sysex-data into voice memory
@ -519,13 +531,13 @@ void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nL
else if(sysex_return >= 500 && sysex_return < 600) else if(sysex_return >= 500 && sysex_return < 600)
{ {
LOGDBG("SysEx send voice %u request",sysex_return-500); LOGDBG("SysEx send voice %u request",sysex_return-500);
SendSystemExclusiveVoice(sysex_return-500, nCable, instanceID); SendSystemExclusiveVoice(sysex_return-500, instanceID);
} }
break; break;
} }
} }
void CMIDIDevice::SendSystemExclusiveVoice(uint8_t nVoice, const unsigned nCable, uint8_t nTG) void CMIDIDevice::SendSystemExclusiveVoice(uint8_t nVoice, uint8_t nTG)
{ {
uint8_t voicedump[163]; uint8_t voicedump[163];
@ -542,7 +554,7 @@ void CMIDIDevice::SendSystemExclusiveVoice(uint8_t nVoice, const unsigned nCable
} }
} }
void CMIDIDevice::SendSystemExclusiveConfig(const unsigned nCable) void CMIDIDevice::SendSystemExclusiveConfig()
{ {
uint8_t count = 0; uint8_t count = 0;
uint8_t configdump[196]; uint8_t configdump[196];
@ -596,3 +608,35 @@ void CMIDIDevice::SendSystemExclusiveConfig(const unsigned nCable)
LOGDBG("Send SYSEX config dump to \"%s\"",Iterator->first.c_str()); LOGDBG("Send SYSEX config dump to \"%s\"",Iterator->first.c_str());
} }
} }
void CMIDIDevice::SendProgramChange(uint8_t pgm, uint8_t nTG)
{
uint8_t PgmChange[2] = { 0xC0|(nTG & 0x0F), (pgm & 0x7f) };
TDeviceMap::const_iterator Iterator;
// send voice dump to all MIDI interfaces
for(Iterator = s_DeviceMap.begin(); Iterator != s_DeviceMap.end(); ++Iterator)
{
Iterator->second->Send (PgmChange, sizeof(PgmChange)*sizeof(uint8_t));
LOGDBG("Send Program Change %i to \"%s\"",pgm&0x7f,Iterator->first.c_str());
}
}
void CMIDIDevice::SendBankChange(uint8_t bank, uint8_t nTG)
{
SendCtrlChange(0xB0,32, (bank&0x7f));
}
void CMIDIDevice::SendCtrlChange(uint8_t ctrl, uint8_t val, uint8_t nTG)
{
uint8_t CtrlMsg[3] = { 0xB0|(nTG & 0x0F), ctrl&0x7f, val&0x7f };
TDeviceMap::const_iterator Iterator;
// send voice dump to all MIDI interfaces
for(Iterator = s_DeviceMap.begin(); Iterator != s_DeviceMap.end(); ++Iterator)
{
Iterator->second->Send (CtrlMsg, sizeof(CtrlMsg)*sizeof(uint8_t));
LOGDBG("Send Ctrl change %02X = %i to \"%s\"",ctrl&0x7f, val&0x7f,Iterator->first.c_str());
}
}

@ -50,9 +50,11 @@ public:
u8 GetChannel (unsigned nTG) const; u8 GetChannel (unsigned nTG) const;
virtual void Send (const u8 *pMessage, size_t nLength, unsigned nCable = 0) {} virtual void Send (const u8 *pMessage, size_t nLength, unsigned nCable = 0) {}
virtual void SendSystemExclusiveVoice(uint8_t nVoice, const unsigned nCable, uint8_t nTG); virtual void SendSystemExclusiveVoice(uint8_t nVoice, uint8_t nTG);
virtual void SendSystemExclusiveConfig(const unsigned nCable); virtual void SendSystemExclusiveConfig();
virtual void SendProgramChange(uint8_t pgm, uint8_t nTG);
virtual void SendBankChange(uint8_t bank, uint8_t nTG);
virtual void SendCtrlChange(uint8_t ctrl, uint8_t val, uint8_t nTG);
protected: protected:
void MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsigned nCable = 0); void MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsigned nCable = 0);
void AddDevice (const char *pDeviceName); void AddDevice (const char *pDeviceName);

@ -346,6 +346,7 @@ void CMiniDexed::BankSelectLSB (unsigned nBankLSB, unsigned nTG)
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
m_nVoiceBankID[nTG] = nBankLSB; m_nVoiceBankID[nTG] = nBankLSB;
m_SerialMIDI.SendBankChange(nBankLSB,nTG);
m_UI.ParameterChanged (); m_UI.ParameterChanged ();
} }
@ -362,7 +363,7 @@ void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG)
assert (m_pTG[nTG]); assert (m_pTG[nTG]);
m_pTG[nTG]->loadVoiceParameters (Buffer); m_pTG[nTG]->loadVoiceParameters (Buffer);
m_SerialMIDI.SendSystemExclusiveVoice(nProgram,0,nTG); m_SerialMIDI.SendProgramChange(nProgram,nTG);
m_UI.ParameterChanged (); m_UI.ParameterChanged ();
} }

Loading…
Cancel
Save