diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index c022759..a7d73e8 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -24,6 +24,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa addAndMakeVisible(m_parcomps.back().get()); } setSize (600, pars.size()*25); + startTimer(1, 100); } PaulstretchpluginAudioProcessorEditor::~PaulstretchpluginAudioProcessorEditor() @@ -41,3 +42,12 @@ void PaulstretchpluginAudioProcessorEditor::resized() // This is generally where you'll want to lay out the positions of any // subcomponents in your editor.. } + +void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) +{ + if (id == 1) + { + for (auto& e : m_parcomps) + e->updateComponent(); + } +} diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 7e5df7e..6821cb9 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -51,7 +51,16 @@ public: } void sliderValueChanged(Slider* slid) override { - + AudioParameterFloat* floatpar = dynamic_cast(m_par); + *floatpar = slid->getValue(); + } + void updateComponent() + { + AudioParameterFloat* floatpar = dynamic_cast(m_par); + if (m_slider != nullptr && (float)m_slider->getValue() != *floatpar) + { + m_slider->setValue(*floatpar, dontSendNotification); + } } private: Label m_label; @@ -61,7 +70,8 @@ private: std::unique_ptr m_togglebut; }; -class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor +class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor, + public MultiTimer { public: PaulstretchpluginAudioProcessorEditor (PaulstretchpluginAudioProcessor&); @@ -70,7 +80,7 @@ public: //============================================================================== void paint (Graphics&) override; void resized() override; - + void timerCallback(int id) override; private: PaulstretchpluginAudioProcessor& processor; std::vector> m_parcomps;