More parameter GUI work

This commit is contained in:
xenakios 2017-11-13 20:54:08 +02:00
parent b9db955a99
commit d9e9107ed4
2 changed files with 23 additions and 3 deletions

View File

@ -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();
}
}

View File

@ -51,7 +51,16 @@ public:
}
void sliderValueChanged(Slider* slid) override
{
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(m_par);
*floatpar = slid->getValue();
}
void updateComponent()
{
AudioParameterFloat* floatpar = dynamic_cast<AudioParameterFloat*>(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<ToggleButton> 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<std::shared_ptr<ParameterComponent>> m_parcomps;