From d7336ee180f195b59df2edadb898e4240917d13d Mon Sep 17 00:00:00 2001 From: Javier Nonis Date: Sat, 20 Jul 2024 20:14:08 -0300 Subject: [PATCH] Save Tempo into Performance --- src/minidexed.cpp | 5 +++++ src/performanceconfig.cpp | 15 +++++++++++++++ src/performanceconfig.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/src/minidexed.cpp b/src/minidexed.cpp index a3185e3..a716245 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -1016,6 +1016,7 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue) break; case ParameterTempo: + nValue=constrain((int)nValue,30,250); this->setTempo(nValue); break; @@ -1562,6 +1563,8 @@ bool CMiniDexed::DoSavePerformance (void) m_PerformanceConfig.SetReverbDiffusion (m_nParameter[ParameterReverbDiffusion]); m_PerformanceConfig.SetReverbLevel (m_nParameter[ParameterReverbLevel]); + m_PerformanceConfig.SetTempo (m_nTempo); + if(m_bSaveAsDeault) { m_PerformanceConfig.SetNewPerformance(0); @@ -2021,6 +2024,8 @@ void CMiniDexed::LoadPerformanceParameters(void) SetParameter (ParameterReverbLowPass, m_PerformanceConfig.GetReverbLowPass ()); SetParameter (ParameterReverbDiffusion, m_PerformanceConfig.GetReverbDiffusion ()); SetParameter (ParameterReverbLevel, m_PerformanceConfig.GetReverbLevel ()); + + SetParameter (ParameterTempo, m_PerformanceConfig.GetTempo ()); } std::string CMiniDexed::GetNewPerformanceDefaultName(void) diff --git a/src/performanceconfig.cpp b/src/performanceconfig.cpp index ce82378..8bd107c 100644 --- a/src/performanceconfig.cpp +++ b/src/performanceconfig.cpp @@ -223,6 +223,8 @@ bool CPerformanceConfig::Load (void) m_nReverbDiffusion = m_Properties.GetNumber ("ReverbDiffusion", 65); m_nReverbLevel = m_Properties.GetNumber ("ReverbLevel", 100); + m_nTempo = m_Properties.GetNumber ("Tempo", 120); + // Set EFFECT_REVERB as Default for backward compatibility // EFFECT_REVERB 7 m_nSendFX = m_Properties.GetNumber ("SendFX", 7); @@ -407,6 +409,8 @@ bool CPerformanceConfig::Save (void) tokens.shrink_to_fit(); } + m_Properties.SetNumber ("Tempo", m_nTempo); + return m_Properties.Save (); } @@ -658,6 +662,11 @@ unsigned CPerformanceConfig::GetReverbLevel (void) const return m_nReverbLevel; } +unsigned CPerformanceConfig::GetTempo (void) const +{ + return m_nTempo; +} + void CPerformanceConfig::SetCompressorEnable (bool bValue) { m_bCompressorEnable = bValue; @@ -712,6 +721,12 @@ void CPerformanceConfig::SetReverbLevel (unsigned nValue) { m_nReverbLevel = nValue; } + +void CPerformanceConfig::SetTempo (unsigned nValue) +{ + m_nTempo = nValue; +} + // Pitch bender and portamento: void CPerformanceConfig::SetPitchBendRange (unsigned nValue, unsigned nTG) { diff --git a/src/performanceconfig.h b/src/performanceconfig.h index 48e224a..1810674 100644 --- a/src/performanceconfig.h +++ b/src/performanceconfig.h @@ -122,6 +122,7 @@ public: unsigned GetReverbLowPass (void) const; // 0 .. 99 unsigned GetReverbDiffusion (void) const; // 0 .. 99 unsigned GetReverbLevel (void) const; // 0 .. 99 + unsigned GetTempo (void) const; void SetCompressorEnable (bool bValue); void SetSendFX (unsigned nValue); @@ -134,6 +135,7 @@ public: void SetReverbLowPass (unsigned nValue); void SetReverbDiffusion (unsigned nValue); void SetReverbLevel (unsigned nValue); + void SetTempo (unsigned nValue); bool VoiceDataFilled(unsigned nTG); bool ListPerformances(); @@ -224,6 +226,7 @@ private: unsigned m_nReverbLowPass; unsigned m_nReverbDiffusion; unsigned m_nReverbLevel; + unsigned m_nTempo; std::string VectorToString (std::vector pParams); std::vector StringToVector (std::string sParams) const;