Welcome to %s forums

BrainModular Users Forum

Login Register

variable scope in the callback code block

I need help on a Patch
Post Reply
ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 23 Mar 2014, 13:06

For each case statement block, do I need to provide unique counters and temporary variables (like midiTmp, for holding the current tMidi when iterating over the midi array, or throwaway counters like m,x,p etc) ?

I've been playing it safe so far and creating new counters and temp variables for each block because I'm worried what might happen if two callbacks are initiated and both are using 'x' as a counter in a for loop, but maybe this isn't actually something I need to worry about?

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 24 Mar 2014, 12:28

hi ceasless,

you are speaking about script right ?

just to be sure ;)

if so,

each time the callback function is called, it end up in only one case block and this block is guaranteed to be executed plainly before another callback call

thus, you can use only one counter variable for the callback function

for infos, it's not the same for the process function

hope it help
Martin FLEURENT - Usine Developer - SDK maintainer

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 24 Mar 2014, 13:45

Yes, talking about fastscript for sure.

So no matter how complex the input streams get, callbacks are called one at a time? What if all params receive input at exactly the same time?

I was imagining it to have a more asynchronous nature.

Anyway, thanks for the clarification!

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 26 Mar 2014, 12:19

it's engine events internal

but one way or another, the engine end up by calling param callback multiple time, one for each param who need it, one after one
Martin FLEURENT - Usine Developer - SDK maintainer

Post Reply

Who is online

Users browsing this forum: No registered users and 150 guests