It has been about 5 months that I am trying to create a plugin in Juce. The window of my plug in is resizable. It has two LEDs on it. They are blinking(Each one consists of 15 images. I know this is not recommended ). It does not have many components.Only 4 or 5. But the problem is the GUI is very slow. I have to wait two or three seconds to see that one paint method is being called.
For example I am trying to read the value of a knob(slider) and do some math and then print this into a label. All of these are happening in the paint. Then when I try to see this on. the gui, it gets into paint method. It does what it should do but after changing the content of the label, it takes seconds to repaint the label, I don’t want to add a repaint call in the paint Actually I already tried it but it didn’t work.
Timers!!! I tried to set a timer with 1 ms interval, it is being called perfectly when I have only one component and doing nothing but when I add more code and try to put a counter in the timer callback to see how accurate it is, I saw that it is lagging. When I have an LED blinking animation in the gui, timer cannot call the timercallback function on the time.When the gui is empty, I tried to measure the time between two mouse clicks, it works perfectly but when I add more stuff to gui, it starts lagging. Difference is huge. I use a metronome to click correctly. When the gui is empty, metronome 120bpm(500ms) and my click time value is between 480-520 . But when I add more components to gui and try to use the same code. I get something between 320-390. Timer slows down. I had to use millisecondCounter to get over this problem. I don’t use timers for milliseconds anymore.
When I add one blinking LED animation to gui, it effects everything in terms of timing , I fix everything and then when I add another blinking LED to it , it even effects the previous LED it slows down, it speeds up, rendering stops or images stops being displayed.
So my question is, I don’t use any special method to do these things. You can see my previous posts. I am just trying to understand what’s going on. All methods that I use, are from tutorials and examples. Is there any one else who has problems about timing and these kind of strange behaviors. Whenever I need to add something to plugin, I am freaking out that something else is going to fall apart. I’ve started thinking that Juce gives a limited source to editor to keep everything safe on the processor side.
Thank you if you read all of it.