Hi,
In my previous post I asked if it was possible to make some vertical progressbar, to make a VU Meter. Then Rock Hardbuns gave me a code to display a VU Meter. Here is this code:
[code]#ifndef METERCOMPONENT_H
class MeterComponent : public Component, public ChangeBroadcaster {
private:
GradientBrush* brsGreen;
float value;
public:
MeterComponent() : Component( T(“Slider Field Component”) ){
value = .5f;
brsGreen = new GradientBrush(Colour(0,200,0),0,0,Colour(200,200,0),0,100,false);
}
~MeterComponentComponent(){
delete brsGreen;
deleteAllChildren ();
}
void paint (Graphics& g){
//background
g.setColour(Colour(0,0,0));
g.fillRect(0,0,getWidth(),getHeight());
g.setBrush(brsGreen);
g.fillRect(0,int(getHeight() * (1-value)),getWidth(),getHeight());
//bevel outline for the entire draw area
g.drawBevel(0, 0, getWidth(), getHeight(), 2, Colour(100,100,100), Colours::white, 0);
}
float getValue(){
return value;
}
void setValue(float v){
value = jmin(jmax(v , .0f) , 1.0f);
repaint(); // this is the line I added
}
};[/code]
As I wanted the VU Meter to repaint itself when I set a value, I added a call to “repaint()” after setting the value in “setValue(float v)”. But I just remarked that this call to “repaint()” make the virtual memory rise a lot. In fact it doesn’t stop rising till I stop my process… Could it be linked with this call, or should I search somewhere else? Thanks in advance for your help.
I’ve created a thread to update my VU Meter. I set the value from the “run()” method. Maybe it has a link with my problem…
Leskimo