View Single Post
Old 05-31-2019, 08:07 AM   #497
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Quote:
Originally Posted by Lokasenna View Post
- Put the lazy elements on separate layers. As long as nothing on a given layer needs to be redrawn, the entire layer will just keep blitting the same image when the GUI redraws everything.

The thing is if I am needlessly checking values from Reaper on every update, that's going to use a lot of cpu, quite independent of the task of drawing anything. I'll have maybe 300 elements in the gui, and they all need to stay in sync with Reaper, even if it's not that frequently.... I just don't want to peg the cpu by asking for all that data at once. So I've got to figure that out.

Quote:
If the lazy elements are all updating at the same time, it would be more efficient to use GUI.func:
Code:
GUI.func = updateAllTheLazyStuff
GUI.freq = 0.1 -- seconds
Basically every one of my components is going to need to poll reaper for changes, so I'd like to have a default implementation in the component. But I'm confused about where I'd put these, so that I'd have a good default behaviour (such as 'check 5x a second, offset by a random amount') and still be able to override it in individual components, such as my metronome display, which should update on every cycle.

thinking out loud here.... so I can have individual components set their GUI.func to 'getReaperVal(x)' and then have the image component class call GUI.func itself. And it could call it every "GUI.freq + (random %)"?

Well, no, because GUI.func is triggered at the discretion of the core function, right? So I need to implement similar functionality in my component that includes an offset?
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote