Fix op ordering and reenabling (#870)

* fix op ordering

The ops are in reverse order in the OPMask as well

* reset OPMask after voice load

If you change a voice, Dexed enables all operator.
Do the same in MiniDexed.
pull/874/head^2
soyer 2 days ago committed by GitHub
parent 26e258b25a
commit bebf9cec95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      src/minidexed.cpp
  2. 1
      src/minidexed.h

@ -658,6 +658,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);
setOPMask(0b111111, nTG);
if (m_pConfig->GetMIDIAutoVoiceDumpOnPC()) if (m_pConfig->GetMIDIAutoVoiceDumpOnPC())
{ {
@ -1178,23 +1179,22 @@ void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigne
if (nOP < 6) if (nOP < 6)
{ {
nOP = 5 - nOP; // OPs are in reverse order
if (uchOffset == DEXED_OP_ENABLE) if (uchOffset == DEXED_OP_ENABLE)
{ {
if (uchValue) if (uchValue)
{ {
m_uchOPMask[nTG] |= 1 << nOP; setOPMask(m_uchOPMask[nTG] | 1 << nOP, nTG);
} }
else else
{ {
m_uchOPMask[nTG] &= ~(1 << nOP); setOPMask(m_uchOPMask[nTG] & ~(1 << nOP), nTG);
} }
m_pTG[nTG]->setOPAll (m_uchOPMask[nTG]);
return; return;
} }
nOP = 5 - nOP; // OPs are in reverse order
} }
uchOffset += nOP * 21; uchOffset += nOP * 21;
@ -1213,12 +1213,12 @@ uint8_t CMiniDexed::GetVoiceParameter (uint8_t uchOffset, unsigned nOP, unsigned
if (nOP < 6) if (nOP < 6)
{ {
nOP = 5 - nOP; // OPs are in reverse order
if (uchOffset == DEXED_OP_ENABLE) if (uchOffset == DEXED_OP_ENABLE)
{ {
return !!(m_uchOPMask[nTG] & (1 << nOP)); return !!(m_uchOPMask[nTG] & (1 << nOP));
} }
nOP = 5 - nOP; // OPs are in reverse order
} }
uchOffset += nOP * 21; uchOffset += nOP * 21;
@ -1792,6 +1792,8 @@ void CMiniDexed::loadVoiceParameters(const uint8_t* data, uint8_t nTG)
m_pTG[nTG]->loadVoiceParameters(&voice[6]); m_pTG[nTG]->loadVoiceParameters(&voice[6]);
m_pTG[nTG]->doRefreshVoice(); m_pTG[nTG]->doRefreshVoice();
setOPMask(0b111111, nTG);
m_UI.ParameterChanged (); m_UI.ParameterChanged ();
} }
@ -1848,6 +1850,12 @@ void CMiniDexed::getSysExVoiceDump(uint8_t* dest, uint8_t nTG)
dest[162] = 0xF7; // SysEx end dest[162] = 0xF7; // SysEx end
} }
void CMiniDexed::setOPMask(uint8_t uchOPMask, uint8_t nTG)
{
m_uchOPMask[nTG] = uchOPMask;
m_pTG[nTG]->setOPAll (m_uchOPMask[nTG]);
}
void CMiniDexed::setMasterVolume(float32_t vol) void CMiniDexed::setMasterVolume(float32_t vol)
{ {
if (vol < 0.0) if (vol < 0.0)
@ -2022,6 +2030,7 @@ void CMiniDexed::LoadPerformanceParameters(void)
{ {
uint8_t* tVoiceData = m_PerformanceConfig.GetVoiceDataFromTxt(nTG); uint8_t* tVoiceData = m_PerformanceConfig.GetVoiceDataFromTxt(nTG);
m_pTG[nTG]->loadVoiceParameters(tVoiceData); m_pTG[nTG]->loadVoiceParameters(tVoiceData);
setOPMask(0b111111, nTG);
} }
setMonoMode(m_PerformanceConfig.GetMonoMode(nTG) ? 1 : 0, nTG); setMonoMode(m_PerformanceConfig.GetMonoMode(nTG) ? 1 : 0, nTG);
SetReverbSend (m_PerformanceConfig.GetReverbSend (nTG), nTG); SetReverbSend (m_PerformanceConfig.GetReverbSend (nTG), nTG);

@ -122,6 +122,7 @@ public:
void loadVoiceParameters(const uint8_t* data, uint8_t nTG); void loadVoiceParameters(const uint8_t* data, uint8_t nTG);
void setVoiceDataElement(uint8_t data, uint8_t number, uint8_t nTG); void setVoiceDataElement(uint8_t data, uint8_t number, uint8_t nTG);
void getSysExVoiceDump(uint8_t* dest, uint8_t nTG); void getSysExVoiceDump(uint8_t* dest, uint8_t nTG);
void setOPMask(uint8_t uchOPMask, uint8_t nTG);
void setModController (unsigned controller, unsigned parameter, uint8_t value, uint8_t nTG); void setModController (unsigned controller, unsigned parameter, uint8_t value, uint8_t nTG);
unsigned getModController (unsigned controller, unsigned parameter, uint8_t nTG); unsigned getModController (unsigned controller, unsigned parameter, uint8_t nTG);

Loading…
Cancel
Save