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

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.

If the lazy elements are all updating at the same time, it would be more efficient to use GUI.func:
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
woodslanding is offline   Reply With Quote