CPlusPlus CHOP - dynamic number of output samples?

When writing a CPlusPlus CHOP, is it possible to output a dynamic number of output samples or must the number of samples be statically set in getOutputInfo()?

Currently not possible, but if your application has a manageable consistent upper bound, you may consider setting it to that upper bound, then having an extra channel filled with the actual number of samples.
Feed this output to a Trim CHOP to delete the extra samples, if that proves to be efficient enough.
Cheers,
Rob.

OK cool, that’s what I have set up now. Thanks, Rob!

getOutputInfo is called every frame though, so you can change it every frame if you want. You don’t need to set it to a static value.

Ah cool, thanks for the tip, Malcolm. Just to be sure, getOutputInfo is called before execute, right?

Yep, every cook.

Sorry misunderstood, my workaround is only if the number of samples is not known until the cook processing has begun, but as Malcolm points out, that number is determined each cook by a separate function.

Rob and Malcolm, is there any counter indication to having the bulk of the calculations in the getoutputinfo function? And only copying values to the channels and samples in execute().

It’s what I’ve been doing in the case of chops with changing number of samples and it seemed to work fine.

No, that should be fine. The only cost is an extra copy of the final data,
but that can be more efficient than the previous workarounds.