Welcome to %s forums

BrainModular Users Forum

Login Register

Wht is the most efficient way to "wait" one bloc using a script?

I need help on a Patch
Post Reply
ahonoe
Member
Posts: 161
Location: Toronto
Contact:

Unread post by ahonoe » 23 Dec 2015, 04:45

Doing lots of "code optimization" these days and I'm wondering what the most CPU friendly way of waiting one bloc is in a script.

If I understand correctly, setting a flag based on polling an input in the main process block of a script, and then executing code using a condition will allow me to span blocs. Compared to the event-driven fast callback procedure, continuously polling and looping in the body seems processing intensive.

Is there a way that I can trigger a script's execution using the callback but have it wait one bloc to update an output? Can I simply move the flag-&-conditional-evaluation into a procedure called from the fast callback?
Regards,

Scott

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 25 Dec 2015, 20:35

what i do is on callback procedure when according input changes i set a counting variable value to 0. then on process only if that value is positive it counts to N blocs and reverts to -1 when max is reached, until a new event is trigged and so on

ahonoe
Member
Posts: 161
Location: Toronto
Contact:

Unread post by ahonoe » 29 Dec 2015, 18:53

Thanks 23fx23. Doesn't this mean that the processing block is continuously running to check your counting var?
Regards,

Scott

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 30 Dec 2015, 08:52

yes could be reduce to bool but im not sure something lower cpu could be found, since a process procedure will necessarely need something to be trigged. Unless i missed something time relative blocs manipulation cannot rely only on callbacks procedures

Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests