Experiment with a colour gradient fill in the performance meter
This commit is contained in:
parent
9ceb7201f7
commit
974f55dcad
@ -1032,14 +1032,23 @@ double MySlider::valueToProportionOfLength(double x)
|
|||||||
|
|
||||||
PerfMeterComponent::PerfMeterComponent(PaulstretchpluginAudioProcessor * p)
|
PerfMeterComponent::PerfMeterComponent(PaulstretchpluginAudioProcessor * p)
|
||||||
: m_proc(p)
|
: m_proc(p)
|
||||||
{}
|
{
|
||||||
|
m_gradient.isRadial = false;
|
||||||
|
m_gradient.addColour(0.0, Colours::red);
|
||||||
|
m_gradient.addColour(0.25, Colours::yellow);
|
||||||
|
m_gradient.addColour(1.0, Colours::green);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PerfMeterComponent::paint(Graphics & g)
|
void PerfMeterComponent::paint(Graphics & g)
|
||||||
{
|
{
|
||||||
|
m_gradient.point1 = {0.0f,0.0f};
|
||||||
|
m_gradient.point2 = {(float)getWidth(),0.0f};
|
||||||
g.fillAll(Colours::grey);
|
g.fillAll(Colours::grey);
|
||||||
double amt = m_proc->getPreBufferingPercent();
|
double amt = m_proc->getPreBufferingPercent();
|
||||||
g.setColour(Colours::green);
|
g.setColour(Colours::green);
|
||||||
int w = amt * getWidth();
|
int w = amt * getWidth();
|
||||||
|
g.setGradientFill(m_gradient);
|
||||||
g.fillRect(0, 0, w, getHeight());
|
g.fillRect(0, 0, w, getHeight());
|
||||||
g.setColour(Colours::white);
|
g.setColour(Colours::white);
|
||||||
g.drawRect(0, 0, getWidth(), getHeight());
|
g.drawRect(0, 0, getWidth(), getHeight());
|
||||||
|
@ -110,6 +110,8 @@ public:
|
|||||||
void paint(Graphics& g) override;
|
void paint(Graphics& g) override;
|
||||||
void mouseDown(const MouseEvent& ev) override;
|
void mouseDown(const MouseEvent& ev) override;
|
||||||
PaulstretchpluginAudioProcessor* m_proc = nullptr;
|
PaulstretchpluginAudioProcessor* m_proc = nullptr;
|
||||||
|
private:
|
||||||
|
ColourGradient m_gradient;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyThumbCache : public AudioThumbnailCache
|
class MyThumbCache : public AudioThumbnailCache
|
||||||
|
Loading…
Reference in New Issue
Block a user