How can I pick first taker and last taker in process block

Dear all,

I’m trying to adapt external library which write data as customized format. It’s start from initilzation part / Write / Finallizer. The expected format is consists of all tracks in session, so I have to figure out which track(plug-in instance) is first taker and last taker.

I tried to use simple way which uses static bool flag, but processBlock in instances enter the scope almost simultaneously. Sometimes, those are all set as first taker.

I am considering make their own ciritical senction for updating status one by one saefly. Surely, it is lock, and it can makes trouble in processBlock. But it is so short and the function is only work in offline bounce (render).

static bool isFirstTaker = false;
static bool isLastTaker = false;
static TrackManager trackManager;

isFirstTaker = true;
//Init Logic


I’m not really sure this is possible because you have no control in which order, on which threads and when the host will invoke the processBlock method in your various instances.

Well yes, but maybe the host will choose to call processBlock several times on the same audio track. There really is no guarantee.

Dear Fabian, Otristan

As I tested on flow of multiple plug-in instance, they almost do like parallel. I thought that if DAW guarantee real-time playing back in multiple instances (at least same type of plug-in like my case), they should do as simultaneously. I traced up the origin of processBlock callback in AAX Wrapper, it shows a pattern they transfer the list of instances.

Your suggestion is really good for solving problem.