From 2f044b6fcb550eec08ee6f57285f8849a2523ed5 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 21 May 2022 19:01:47 +0000 Subject: [PATCH] Fix Save Performance (#238) Closes #151 Thanks @rsta2 --- src/minidexed.cpp | 17 ++++++++++++++++- src/minidexed.h | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 21e79f1..3eba164 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -49,7 +49,8 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, #endif m_GetChunkTimer ("GetChunk", 1000000U * pConfig->GetChunkSize ()/2 / pConfig->GetSampleRate ()), - m_bProfileEnabled (m_pConfig->GetProfileEnabled ()) + m_bProfileEnabled (m_pConfig->GetProfileEnabled ()), + m_bSavePerformance (false) { assert (m_pConfig); @@ -270,6 +271,13 @@ void CMiniDexed::Process (bool bPlugAndPlayUpdated) m_UI.Process (); + if (m_bSavePerformance) + { + DoSavePerformance (); + + m_bSavePerformance = false; + } + if (m_bProfileEnabled) { m_GetChunkTimer.Dump (); @@ -933,6 +941,13 @@ void CMiniDexed::ProcessSound (void) #endif bool CMiniDexed::SavePerformance (void) +{ + m_bSavePerformance = true; + + return true; +} + +bool CMiniDexed::DoSavePerformance (void) { for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) { diff --git a/src/minidexed.h b/src/minidexed.h index 66beb35..7acf52f 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -149,6 +149,7 @@ public: std::string GetVoiceName (unsigned nTG); bool SavePerformance (void); + bool DoSavePerformance (void); private: int16_t ApplyNoteLimits (int16_t pitch, unsigned nTG); // returns < 0 to ignore note @@ -222,6 +223,8 @@ private: AudioStereoMixer* reverb_send_mixer; CSpinLock m_ReverbSpinLock; + + bool m_bSavePerformance; }; #endif