Store Midi FX settings into performance

pull/764/head
Javier Nonis 7 months ago
parent 6cd3a82253
commit 652db3e05f
  1. 12
      src/minidexed.cpp
  2. 113
      src/performanceconfig.cpp
  3. 9
      src/performanceconfig.h

@ -1511,6 +1511,12 @@ bool CMiniDexed::DoSavePerformance (void)
pParams.clear(); pParams.clear();
pParams.shrink_to_fit(); pParams.shrink_to_fit();
m_PerformanceConfig.SetMidiFX (m_MidiArp[nTG]->getId(), nTG);
std::vector<unsigned> pMidiFXParams = m_MidiArp[nTG]->getParameters();
m_PerformanceConfig.SetMidiFXParams (pMidiFXParams, nTG);
pMidiFXParams.clear();
pMidiFXParams.shrink_to_fit();
m_PerformanceConfig.SetDetune (m_nMasterTune[nTG], nTG); m_PerformanceConfig.SetDetune (m_nMasterTune[nTG], nTG);
m_PerformanceConfig.SetCutoff (m_nCutoff[nTG], nTG); m_PerformanceConfig.SetCutoff (m_nCutoff[nTG], nTG);
m_PerformanceConfig.SetResonance (m_nResonance[nTG], nTG); m_PerformanceConfig.SetResonance (m_nResonance[nTG], nTG);
@ -1968,6 +1974,12 @@ void CMiniDexed::LoadPerformanceParameters(void)
pParams.clear(); pParams.clear();
pParams.shrink_to_fit(); pParams.shrink_to_fit();
setMidiFXType(m_PerformanceConfig.GetMidiFX (nTG), nTG);
std::vector<unsigned> pMidiFXParams = m_PerformanceConfig.GetMidiFXParams(nTG);
m_MidiArp[nTG]->setParameters(pMidiFXParams);
pMidiFXParams.clear();
pMidiFXParams.shrink_to_fit();
m_nNoteLimitLow[nTG] = m_PerformanceConfig.GetNoteLimitLow (nTG); m_nNoteLimitLow[nTG] = m_PerformanceConfig.GetNoteLimitLow (nTG);
m_nNoteLimitHigh[nTG] = m_PerformanceConfig.GetNoteLimitHigh (nTG); m_nNoteLimitHigh[nTG] = m_PerformanceConfig.GetNoteLimitHigh (nTG);
m_nNoteShift[nTG] = m_PerformanceConfig.GetNoteShift (nTG); m_nNoteShift[nTG] = m_PerformanceConfig.GetNoteShift (nTG);

@ -139,6 +139,12 @@ bool CPerformanceConfig::Load (void)
PropertyName.Format ("InsertFXParams%u", nTG+1); PropertyName.Format ("InsertFXParams%u", nTG+1);
m_sInsertFXParams[nTG] = m_Properties.GetString (PropertyName, ""); m_sInsertFXParams[nTG] = m_Properties.GetString (PropertyName, "");
PropertyName.Format ("MidiFX%u", nTG+1);
m_nMidiFX[nTG] = m_Properties.GetNumber (PropertyName, 0);
PropertyName.Format ("MidiFXParams%u", nTG+1);
m_sMidiFXParams[nTG] = m_Properties.GetString (PropertyName, "");
PropertyName.Format ("Detune%u", nTG+1); PropertyName.Format ("Detune%u", nTG+1);
m_nDetune[nTG] = m_Properties.GetSignedNumber (PropertyName, 0); m_nDetune[nTG] = m_Properties.GetSignedNumber (PropertyName, 0);
@ -274,6 +280,12 @@ bool CPerformanceConfig::Save (void)
PropertyName.Format ("InsertFXParams%u", nTG+1); PropertyName.Format ("InsertFXParams%u", nTG+1);
m_Properties.SetString (PropertyName, m_sInsertFXParams[nTG].c_str()); m_Properties.SetString (PropertyName, m_sInsertFXParams[nTG].c_str());
PropertyName.Format ("MidiFX%u", nTG+1);
m_Properties.SetNumber (PropertyName, m_nMidiFX[nTG]);
PropertyName.Format ("MidiFXParams%u", nTG+1);
m_Properties.SetString (PropertyName, m_sMidiFXParams[nTG].c_str());
PropertyName.Format ("Detune%u", nTG+1); PropertyName.Format ("Detune%u", nTG+1);
m_Properties.SetSignedNumber (PropertyName, m_nDetune[nTG]); m_Properties.SetSignedNumber (PropertyName, m_nDetune[nTG]);
@ -437,21 +449,19 @@ unsigned CPerformanceConfig::GetInsertFX (unsigned nTG) const
std::vector<unsigned> CPerformanceConfig::GetInsertFXParams (unsigned nTG) const std::vector<unsigned> CPerformanceConfig::GetInsertFXParams (unsigned nTG) const
{ {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
return StringToVector(m_sInsertFXParams[nTG]);
}
std::vector<unsigned> tokens; unsigned CPerformanceConfig::GetMidiFX (unsigned nTG) const
std::string params = m_sInsertFXParams[nTG]; {
if (params.empty()) { assert (nTG < CConfig::ToneGenerators);
return tokens; return m_nMidiFX[nTG];
} }
char delimiter = ','; std::vector<unsigned> CPerformanceConfig::GetMidiFXParams (unsigned nTG) const
std::stringstream ss(params); {
std::string temp; assert (nTG < CConfig::ToneGenerators);
while (getline(ss, temp, delimiter)) return StringToVector(m_sMidiFXParams[nTG]);
{
tokens.push_back(stoi(temp));
}
return tokens;
} }
int CPerformanceConfig::GetDetune (unsigned nTG) const int CPerformanceConfig::GetDetune (unsigned nTG) const
@ -535,16 +545,19 @@ void CPerformanceConfig::SetInsertFX (unsigned nValue, unsigned nTG)
void CPerformanceConfig::SetInsertFXParams (std::vector<unsigned> pParams, unsigned nTG) void CPerformanceConfig::SetInsertFXParams (std::vector<unsigned> pParams, unsigned nTG)
{ {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
m_sInsertFXParams[nTG] = VectorToString(pParams);
}
std::string params = ""; void CPerformanceConfig::SetMidiFX (unsigned nValue, unsigned nTG)
for (size_t i = 0; i < pParams.size(); i++) {
{ assert (nTG < CConfig::ToneGenerators);
if (i != 0) { m_nMidiFX[nTG] = nValue;
params += ","; }
}
params += std::to_string(pParams[i]); void CPerformanceConfig::SetMidiFXParams (std::vector<unsigned> pParams, unsigned nTG)
} {
m_sInsertFXParams[nTG] = params; assert (nTG < CConfig::ToneGenerators);
m_sMidiFXParams[nTG] = VectorToString(pParams);
} }
void CPerformanceConfig::SetDetune (int nValue, unsigned nTG) void CPerformanceConfig::SetDetune (int nValue, unsigned nTG)
@ -601,20 +614,7 @@ unsigned CPerformanceConfig::GetSendFX (void) const
std::vector<unsigned> CPerformanceConfig::GetSendFXParams (void) const std::vector<unsigned> CPerformanceConfig::GetSendFXParams (void) const
{ {
std::vector<unsigned> tokens; return StringToVector(m_sSendFXParams);
std::string params = m_sSendFXParams;
if (params.empty()) {
return tokens;
}
char delimiter = ',';
std::stringstream ss(params);
std::string temp;
while (getline(ss, temp, delimiter))
{
tokens.push_back(stoi(temp));
}
return tokens;
} }
unsigned CPerformanceConfig::GetSendFXLevel (void) const unsigned CPerformanceConfig::GetSendFXLevel (void) const
@ -670,15 +670,7 @@ void CPerformanceConfig::SetSendFX (unsigned nValue)
void CPerformanceConfig::SetSendFXParams (std::vector<unsigned> pParams) void CPerformanceConfig::SetSendFXParams (std::vector<unsigned> pParams)
{ {
std::string params = ""; m_sSendFXParams = VectorToString(pParams);
for (size_t i = 0; i < pParams.size(); i++)
{
if (i != 0) {
params += ",";
}
params += std::to_string(pParams[i]);
}
m_sSendFXParams = params;
} }
void CPerformanceConfig::SetSendFXLevel (unsigned nValue) void CPerformanceConfig::SetSendFXLevel (unsigned nValue)
@ -1490,3 +1482,34 @@ bool CPerformanceConfig::IsValidPerformanceBank(unsigned nBankID)
} }
return true; return true;
} }
std::string CPerformanceConfig::VectorToString (std::vector<unsigned> pParams)
{
std::string params = "";
for (size_t i = 0; i < pParams.size(); i++)
{
if (i != 0) {
params += ",";
}
params += std::to_string(pParams[i]);
}
return params;
}
std::vector<unsigned> CPerformanceConfig::StringToVector (std::string sParams) const
{
std::vector<unsigned> tokens;
if (sParams.empty()) {
return tokens;
}
char delimiter = ',';
std::stringstream ss(sParams);
std::string temp;
while (getline(ss, temp, delimiter))
{
tokens.push_back(stoi(temp));
}
return tokens;
}

@ -51,6 +51,8 @@ public:
unsigned GetPan (unsigned nTG) const; // 0 .. 127 unsigned GetPan (unsigned nTG) const; // 0 .. 127
unsigned GetInsertFX (unsigned nTG) const; // 0 .. X unsigned GetInsertFX (unsigned nTG) const; // 0 .. X
std::vector<unsigned> GetInsertFXParams (unsigned nTG) const; std::vector<unsigned> GetInsertFXParams (unsigned nTG) const;
unsigned GetMidiFX (unsigned nTG) const; // 0 .. X
std::vector<unsigned> GetMidiFXParams (unsigned nTG) const;
int GetDetune (unsigned nTG) const; // -99 .. 99 int GetDetune (unsigned nTG) const; // -99 .. 99
unsigned GetCutoff (unsigned nTG) const; // 0 .. 99 unsigned GetCutoff (unsigned nTG) const; // 0 .. 99
unsigned GetResonance (unsigned nTG) const; // 0 .. 99 unsigned GetResonance (unsigned nTG) const; // 0 .. 99
@ -81,6 +83,8 @@ public:
void SetPan (unsigned nValue, unsigned nTG); void SetPan (unsigned nValue, unsigned nTG);
void SetInsertFX (unsigned nValue, unsigned nTG); void SetInsertFX (unsigned nValue, unsigned nTG);
void SetInsertFXParams (std::vector<unsigned> pParams, unsigned nTG); void SetInsertFXParams (std::vector<unsigned> pParams, unsigned nTG);
void SetMidiFX (unsigned nValue, unsigned nTG);
void SetMidiFXParams (std::vector<unsigned> pParams, unsigned nTG);
void SetDetune (int nValue, unsigned nTG); void SetDetune (int nValue, unsigned nTG);
void SetCutoff (unsigned nValue, unsigned nTG); void SetCutoff (unsigned nValue, unsigned nTG);
void SetResonance (unsigned nValue, unsigned nTG); void SetResonance (unsigned nValue, unsigned nTG);
@ -170,6 +174,8 @@ private:
unsigned m_nPan[CConfig::ToneGenerators]; unsigned m_nPan[CConfig::ToneGenerators];
unsigned m_nInsertFX[CConfig::ToneGenerators]; unsigned m_nInsertFX[CConfig::ToneGenerators];
std::string m_sInsertFXParams[CConfig::ToneGenerators]; std::string m_sInsertFXParams[CConfig::ToneGenerators];
unsigned m_nMidiFX[CConfig::ToneGenerators];
std::string m_sMidiFXParams[CConfig::ToneGenerators];
int m_nDetune[CConfig::ToneGenerators]; int m_nDetune[CConfig::ToneGenerators];
unsigned m_nCutoff[CConfig::ToneGenerators]; unsigned m_nCutoff[CConfig::ToneGenerators];
unsigned m_nResonance[CConfig::ToneGenerators]; unsigned m_nResonance[CConfig::ToneGenerators];
@ -218,6 +224,9 @@ private:
unsigned m_nReverbLowPass; unsigned m_nReverbLowPass;
unsigned m_nReverbDiffusion; unsigned m_nReverbDiffusion;
unsigned m_nReverbLevel; unsigned m_nReverbLevel;
std::string VectorToString (std::vector<unsigned> pParams);
std::vector<unsigned> StringToVector (std::string sParams) const;
}; };
#endif #endif

Loading…
Cancel
Save