Fix SetPendingVoicePerformanceUpdate

md-perf
probonopd 2 days ago
parent 457906267c
commit 7f4f4f8ce8
  1. 6
      src/mididevice.cpp
  2. 17
      src/minidexed.cpp
  3. 2
      src/minidexed.h

@ -819,13 +819,11 @@ void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nL
// Load sysex-data into voice memory // Load sysex-data into voice memory
LOGDBG("One Voice bulk upload"); LOGDBG("One Voice bulk upload");
m_pSynthesizer->loadVoiceParameters(pMessage,nTG); m_pSynthesizer->loadVoiceParameters(pMessage,nTG);
// Defer performance config update to main loop // Defer performance config update to main loop because it would be too slow to do it here
if (m_pSynthesizer && m_pSynthesizer->GetPerformanceConfig()) { if (m_pSynthesizer && m_pSynthesizer->GetPerformanceConfig()) {
uint8_t unpackedVoice[156];
m_pSynthesizer->GetCurrentVoiceData(unpackedVoice, nTG);
CMiniDexed* pMiniDexed = static_cast<CMiniDexed*>(m_pSynthesizer); CMiniDexed* pMiniDexed = static_cast<CMiniDexed*>(m_pSynthesizer);
if (pMiniDexed) { if (pMiniDexed) {
pMiniDexed->SetPendingVoicePerformanceUpdate(unpackedVoice, nTG); pMiniDexed->SetPendingVoicePerformanceUpdate(nTG);
} }
} }
break; break;

@ -2505,8 +2505,17 @@ void CMiniDexed::GetCurrentVoiceData(uint8_t* dest, unsigned nTG) {
} }
} }
void CMiniDexed::SetPendingVoicePerformanceUpdate(const uint8_t* voiceData, uint8_t tg) { void CMiniDexed::SetPendingVoicePerformanceUpdate(unsigned nTG) {
m_PendingVoicePerformanceUpdate.pending = true; if (nTG < m_nToneGenerators && m_pTG[nTG]) {
memcpy(m_PendingVoicePerformanceUpdate.voiceData, voiceData, 156); // Get the current voice data from the synthesizer
m_PendingVoicePerformanceUpdate.tg = tg; uint8_t currentVoiceData[155];
m_pTG[nTG]->getVoiceData(currentVoiceData);
// We need to set the voice data in the synthesizer's performance config
// to ensure that the performance is not changed back to the previous one
// when a parameter is changed.
// This is a workaround for the fact that the performance config
// is not updated when the voice data is changed because it would be
// too costly to do in the thread.
this->GetPerformanceConfig()->SetVoiceDataToTxt(currentVoiceData, nTG);
}
} }

@ -249,7 +249,7 @@ public:
void GetCurrentVoiceData(uint8_t* dest, unsigned nTG); void GetCurrentVoiceData(uint8_t* dest, unsigned nTG);
public: public:
void SetPendingVoicePerformanceUpdate(const uint8_t* voiceData, uint8_t tg); void SetPendingVoicePerformanceUpdate(unsigned nTG);
private: private:
int16_t ApplyNoteLimits (int16_t pitch, unsigned nTG); // returns < 0 to ignore note int16_t ApplyNoteLimits (int16_t pitch, unsigned nTG); // returns < 0 to ignore note

Loading…
Cancel
Save