No more crackle after voice uploading

md-perf
probonopd 5 days ago
parent 3ce4445067
commit b4f4e8fdd4
  1. 7
      src/mididevice.cpp
  2. 6
      src/minidexed.cpp
  3. 10
      src/minidexed.h

@ -819,11 +819,14 @@ void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nL
// Load sysex-data into voice memory
LOGDBG("One Voice bulk upload");
m_pSynthesizer->loadVoiceParameters(pMessage,nTG);
// Also update performance config so the new voice is not lost
// Defer performance config update to main loop
if (m_pSynthesizer && m_pSynthesizer->GetPerformanceConfig()) {
uint8_t unpackedVoice[156];
m_pSynthesizer->GetCurrentVoiceData(unpackedVoice, nTG);
m_pSynthesizer->GetPerformanceConfig()->SetVoiceDataToTxt(unpackedVoice, nTG);
CMiniDexed* pMiniDexed = static_cast<CMiniDexed*>(m_pSynthesizer);
if (pMiniDexed) {
pMiniDexed->SetPendingVoicePerformanceUpdate(unpackedVoice, nTG);
}
}
break;
case 200:

@ -2504,3 +2504,9 @@ void CMiniDexed::GetCurrentVoiceData(uint8_t* dest, unsigned nTG) {
m_pTG[nTG]->getVoiceData(dest);
}
}
void CMiniDexed::SetPendingVoicePerformanceUpdate(const uint8_t* voiceData, uint8_t tg) {
m_PendingVoicePerformanceUpdate.pending = true;
memcpy(m_PendingVoicePerformanceUpdate.voiceData, voiceData, 156);
m_PendingVoicePerformanceUpdate.tg = tg;
}

@ -248,6 +248,9 @@ public:
void GetCurrentVoiceData(uint8_t* dest, unsigned nTG);
public:
void SetPendingVoicePerformanceUpdate(const uint8_t* voiceData, uint8_t tg);
private:
int16_t ApplyNoteLimits (int16_t pitch, unsigned nTG); // returns < 0 to ignore note
uint8_t m_uchOPMask[CConfig::AllToneGenerators];
@ -367,6 +370,13 @@ private:
bool m_bLoadPerformanceBusy;
bool m_bLoadPerformanceBankBusy;
bool m_bSaveAsDeault;
// Add for deferred performance update after SysEx voice load
struct PendingVoicePerformanceUpdate {
bool pending = false;
uint8_t voiceData[156];
uint8_t tg = 0;
} m_PendingVoicePerformanceUpdate;
};
#endif

Loading…
Cancel
Save