diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index 4245782..a3e750d 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -382,6 +382,8 @@ double StretchAudioSource::getInfileLengthSeconds() void StretchAudioSource::setRate(double rate) { + if (rate == m_playrate) + return; std::lock_guard locker(m_mutex); //if (rate != m_lastplayrate) { @@ -394,16 +396,20 @@ void StretchAudioSource::setRate(double rate) m_stretchers[i]->set_rap((float)rate); } } + ++m_param_change_count; } void StretchAudioSource::setProcessParameters(ProcessParameters * pars) { + if (memcmp(pars, &m_ppar, sizeof(ProcessParameters)) == 0) + return; std::lock_guard locker(m_mutex); m_ppar = *pars; for (int i = 0; i < m_stretchers.size(); ++i) { m_stretchers[i]->set_parameters(pars); } + ++m_param_change_count; } ProcessParameters StretchAudioSource::getProcessParameters() diff --git a/Source/PS_Source/StretchSource.h b/Source/PS_Source/StretchSource.h index 309f54f..8cbbbed 100644 --- a/Source/PS_Source/StretchSource.h +++ b/Source/PS_Source/StretchSource.h @@ -91,6 +91,7 @@ public: void setLoopingEnabled(bool b); void setMaxLoops(int64_t numloops) { m_maxloops = numloops; } void setAudioBufferAsInputSource(AudioBuffer* buf, int sr, int len); + int m_param_change_count = 0; private: CircularBuffer m_stretchoutringbuf{ 1024 * 1024 }; AudioBuffer m_file_inbuf; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 0a56e27..de6adfe 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -96,7 +96,10 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) e->updateComponent(); if (processor.isRecordingEnabled() != m_rec_enable.getToggleState()) m_rec_enable.setToggleState(processor.isRecordingEnabled(), dontSendNotification); - m_info_label.setText(String(processor.getRecordingPositionPercent()*100.0, 1),dontSendNotification); + if (processor.isRecordingEnabled()) + m_info_label.setText(String(processor.getRecordingPositionPercent()*100.0, 1),dontSendNotification); + else + m_info_label.setText(String(processor.m_control->getStretchAudioSource()->m_param_change_count), dontSendNotification); } }