xiphonics/picoTracker

Add new clock signal for use outside of project playback

Closed this issue · 2 comments

maks commented

Currently there is only the OnPlayerUpdate() callback for use for any code in the app that needs a clock signal but this is only available during project playback, which limits its usefulness and doesn't cater for things that need to be regularly run/updated even when playback is not happening (eg. the battery gauge UI).

So I'd like to propose a new callback along similar lines to OnPlayUpdate(), maybe OnClockUpdate() but that is always running, called at a set rate (1Hz?) to allow for any code to hook into that needs to update regularly. I think 1Hz is pretty undemanding CPU wise but of course would not be sufficient if we wanted to use it to drive UI animations, so perhaps something higher rate like 30Hz is required?

How would this be driven? interrupt or just as part of the main loop with a timer? If it's not interrupt driven and we decide to do some heavy lifting in the future with processor 0, then the timing may not be very precise, which may or may not be a problem.

maks commented

Yes I was just thinking main loop driven as the intention is for it to be only for UI so doesn't need to be precise while anything audio related already has OnPlayUpdate(). I think its standard to except dropped UI frames when the main loop is doing too much work, at least it is for people who do mobile apps or web dev so that should be fine.

@democloid would you know of a good place this could go in the main loop? Before or after the if (event) {} in picoTrackerEventManager::MainLoop() ?