diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 21e79f1..8a3376f 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -201,7 +201,9 @@ bool CMiniDexed::Initialize (void) m_nNoteLimitLow[nTG] = m_PerformanceConfig.GetNoteLimitLow (nTG); m_nNoteLimitHigh[nTG] = m_PerformanceConfig.GetNoteLimitHigh (nTG); m_nNoteShift[nTG] = m_PerformanceConfig.GetNoteShift (nTG); - + uint8_t* tVoiceData = m_PerformanceConfig.GetVoiceDataFromTxt(nTG); + m_pTG[nTG]->loadVoiceParameters(tVoiceData); + SetReverbSend (m_PerformanceConfig.GetReverbSend (nTG), nTG); } @@ -955,6 +957,8 @@ bool CMiniDexed::SavePerformance (void) m_PerformanceConfig.SetNoteShift (m_nNoteShift[nTG], nTG); m_PerformanceConfig.SetReverbSend (m_nReverbSend[nTG], nTG); + m_pTG[nTG]->getVoiceData(m_nRawVoiceData); + m_PerformanceConfig.SetVoiceDataToTxt (m_nRawVoiceData, nTG); } m_PerformanceConfig.SetCompressorEnable (!!m_nParameter[ParameterCompressorEnable]); diff --git a/src/minidexed.h b/src/minidexed.h index 66beb35..93ff9df 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -193,6 +193,8 @@ private: int m_nNoteShift[CConfig::ToneGenerators]; unsigned m_nReverbSend[CConfig::ToneGenerators]; + + uint8_t m_nRawVoiceData[156]; CUserInterface m_UI; CSysExFileLoader m_SysExFileLoader; diff --git a/src/performance.ini b/src/performance.ini index bdd3d66..d1abdcc 100644 --- a/src/performance.ini +++ b/src/performance.ini @@ -20,6 +20,7 @@ #PortamentoMode#=0 # 0 .. 1 #PortamentoGlissando#=0 # 0 .. 1 #PortamentoTime#=0 # 0 .. 99 +#VoiceData#= # space separated hex numbers of 156 voice parameters. Example: 5F 1D 14 32 63 [....] 20 55 # TG1 BankNumber1=0 @@ -39,6 +40,7 @@ PitchBendStep1=0 PortamentoMode1=0 PortamentoGlissando1=0 PortamentoTime1=0 +VoiceData1=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG2 BankNumber2=0 @@ -58,6 +60,7 @@ PitchBendStep2=0 PortamentoMode2=0 PortamentoGlissando2=0 PortamentoTime2=0 +VoiceData2=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG3 BankNumber3=0 @@ -77,6 +80,7 @@ PitchBendStep3=0 PortamentoMode3=0 PortamentoGlissando3=0 PortamentoTime3=0 +VoiceData3=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG4 BankNumber4=0 @@ -96,6 +100,7 @@ PitchBendStep4=0 PortamentoMode4=0 PortamentoGlissando4=0 PortamentoTime4=0 +VoiceData4=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG5 BankNumber5=0 @@ -115,6 +120,7 @@ PitchBendStep5=0 PortamentoMode5=0 PortamentoGlissando5=0 PortamentoTime5=0 +VoiceData5=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG6 BankNumber6=0 @@ -134,6 +140,7 @@ PitchBendStep6=0 PortamentoMode6=0 PortamentoGlissando6=0 PortamentoTime6=0 +VoiceData6=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG7 BankNumber7=0 @@ -153,6 +160,7 @@ PitchBendStep7=0 PortamentoMode7=0 PortamentoGlissando7=0 PortamentoTime7=0 +VoiceData7=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # TG8 BankNumber8=0 @@ -172,6 +180,7 @@ PitchBendStep8=0 PortamentoMode8=0 PortamentoGlissando8=0 PortamentoTime8=0 +VoiceData8=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 00 00 00 00 00 03 00 06 59 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 00 00 00 00 00 03 00 07 3A 00 0E 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 03 06 00 0F 21 00 00 00 04 02 18 45 2E 50 49 41 4E 4F 20 31 20 55 # Effects #CompressorEnable=1 # 0: off, 1: on diff --git a/src/performanceconfig.cpp b/src/performanceconfig.cpp index 5c381ec..88ffb37 100644 --- a/src/performanceconfig.cpp +++ b/src/performanceconfig.cpp @@ -113,6 +113,9 @@ bool CPerformanceConfig::Load (void) PropertyName.Format ("PortamentoTime%u", nTG+1); m_nPortamentoTime[nTG] = m_Properties.GetNumber (PropertyName, 0); + + PropertyName.Format ("VoiceData%u", nTG+1); + m_nVoiceDataTxt[nTG] = m_Properties.GetString (PropertyName, 0); } m_bCompressorEnable = m_Properties.GetNumber ("CompressorEnable", 1) != 0; @@ -199,6 +202,10 @@ bool CPerformanceConfig::Save (void) PropertyName.Format ("PortamentoTime%u", nTG+1); m_Properties.SetNumber (PropertyName, m_nPortamentoTime[nTG]); + + PropertyName.Format ("VoiceData%u", nTG+1); + char *cstr = &m_nVoiceDataTxt[nTG][0]; + m_Properties.SetString (PropertyName, cstr); } m_Properties.SetNumber ("CompressorEnable", m_bCompressorEnable ? 1 : 0); @@ -501,3 +508,33 @@ unsigned CPerformanceConfig::GetPortamentoTime (unsigned nTG) const assert (nTG < CConfig::ToneGenerators); return m_nPortamentoTime[nTG]; } + +void CPerformanceConfig::SetVoiceDataToTxt (const uint8_t *pData, unsigned nTG) +{ + assert (nTG < CConfig::ToneGenerators); + m_nVoiceDataTxt[nTG] = ""; + char nDtoH[]="0123456789ABCDEF"; + for (int i = 0; i < NUM_VOICE_PARAM; i++) + { + m_nVoiceDataTxt[nTG] += nDtoH[(pData[i] & 0xF0)/16]; + m_nVoiceDataTxt[nTG] += nDtoH[pData[i] & 0x0F] ; + if ( i < (NUM_VOICE_PARAM-1) ) + { + m_nVoiceDataTxt[nTG] += " "; + } + } +} + +uint8_t *CPerformanceConfig::GetVoiceDataFromTxt (unsigned nTG) +{ + assert (nTG < CConfig::ToneGenerators); + static uint8_t pData[NUM_VOICE_PARAM]; + std::string nHtoD="0123456789ABCDEF"; + + for (int i=0; i<NUM_VOICE_PARAM * 3; i=i+3) + { + pData[i/3] = ((nHtoD.find(toupper(m_nVoiceDataTxt[nTG][i]),0) * 16 + nHtoD.find(toupper(m_nVoiceDataTxt[nTG][i+1]),0))) & 0xFF ; + } + + return pData; +} diff --git a/src/performanceconfig.h b/src/performanceconfig.h index bf7617a..bd73aa9 100644 --- a/src/performanceconfig.h +++ b/src/performanceconfig.h @@ -26,6 +26,7 @@ #include "config.h" #include <fatfs/ff.h> #include <Properties/propertiesfatfsfile.h> +#define NUM_VOICE_PARAM 156 class CPerformanceConfig // Performance configuration { @@ -55,6 +56,8 @@ public: unsigned GetPortamentoMode (unsigned nTG) const; // 0 .. 1 unsigned GetPortamentoGlissando (unsigned nTG) const; // 0 .. 1 unsigned GetPortamentoTime (unsigned nTG) const; // 0 .. 99 + void SetVoiceDataToTxt (const uint8_t *pData, unsigned nTG); + uint8_t *GetVoiceDataFromTxt (unsigned nTG); void SetBankNumber (unsigned nValue, unsigned nTG); void SetVoiceNumber (unsigned nValue, unsigned nTG); @@ -113,6 +116,7 @@ private: unsigned m_nPortamentoMode[CConfig::ToneGenerators]; unsigned m_nPortamentoGlissando[CConfig::ToneGenerators]; unsigned m_nPortamentoTime[CConfig::ToneGenerators]; + std::string m_nVoiceDataTxt[CConfig::ToneGenerators]; bool m_bCompressorEnable; bool m_bReverbEnable;