Added dedicated timer for perf meter component

This commit is contained in:
xenakios 2018-05-01 18:35:00 +03:00
parent 60293c6a84
commit fa2564f908
2 changed files with 9 additions and 2 deletions

View File

@ -411,7 +411,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
if (processor.m_offline_render_state >= 0 && processor.m_offline_render_state <= 100) if (processor.m_offline_render_state >= 0 && processor.m_offline_render_state <= 100)
infotext += String(processor.m_offline_render_state)+"%"; infotext += String(processor.m_offline_render_state)+"%";
m_info_label.setText(infotext, dontSendNotification); m_info_label.setText(infotext, dontSendNotification);
m_perfmeter.repaint();
} }
if (id == 2) if (id == 2)
{ {
@ -1277,6 +1277,7 @@ PerfMeterComponent::PerfMeterComponent(PaulstretchpluginAudioProcessor * p)
m_gradient.addColour(0.0, Colours::red); m_gradient.addColour(0.0, Colours::red);
m_gradient.addColour(0.25, Colours::yellow); m_gradient.addColour(0.25, Colours::yellow);
m_gradient.addColour(1.0, Colours::green); m_gradient.addColour(1.0, Colours::green);
startTimer(30);
} }
void PerfMeterComponent::paint(Graphics & g) void PerfMeterComponent::paint(Graphics & g)
@ -1318,6 +1319,11 @@ void PerfMeterComponent::mouseDown(const MouseEvent & ev)
} }
} }
void PerfMeterComponent::timerCallback()
{
repaint();
}
void zoom_scrollbar::mouseDown(const MouseEvent &e) void zoom_scrollbar::mouseDown(const MouseEvent &e)
{ {
m_drag_start_x = e.x; m_drag_start_x = e.x;

View File

@ -104,12 +104,13 @@ private:
Colour m_labeldefcolor; Colour m_labeldefcolor;
}; };
class PerfMeterComponent : public Component class PerfMeterComponent : public Component, public Timer
{ {
public: public:
PerfMeterComponent(PaulstretchpluginAudioProcessor* p); PerfMeterComponent(PaulstretchpluginAudioProcessor* p);
void paint(Graphics& g) override; void paint(Graphics& g) override;
void mouseDown(const MouseEvent& ev) override; void mouseDown(const MouseEvent& ev) override;
void timerCallback() override;
PaulstretchpluginAudioProcessor* m_proc = nullptr; PaulstretchpluginAudioProcessor* m_proc = nullptr;
private: private:
ColourGradient m_gradient; ColourGradient m_gradient;