Skip to main content
Inspiring
May 6, 2016
Answered

Arbitrary Parameter Data

  • May 6, 2016
  • 1 reply
  • 1370 views

Hi,

A quick question about adding multiple arbitrary parameters.

Do you create a single struct/class containing all your data for ALL your arb params, or do you have a struct/class per arb param?

e.g.

// Single struct with data for two arbitrary parameters

struct AllMyArbsData {

    A_long  arb_1_fooL;

    PF_FpLong arb_1_barF;

    A_char arb_2_textC[128];

}

// or... Two structs with data for each arb param separately

struct Arb1Data {

    A_long  arb_1_fooL;

    PF_FpLong arb_1_barF;

}

struct Arb2Data {

    A_char arb_2_textC[128];

}

It's unclear from the example projects how to handle multiple arb params. The callbacks for setting dephault, print, etc. don't check for a given parameter ID. Of course in the examples there is only the one arb parameter... I'm not at my dev computer at the moment so can't check, but, for example CreateDefaultArb doesn't have an extra parameter, so there's no way of checking which arb is being referenced.

Thanks, C

This topic has been closed for replies.
Correct answer shachar carmi

yes, some of the handler's functions could be the same for all arb types. i

personally found that except for the "create new" function, i hardly ever

change anything between the handlers of different arbs.

as for storing the arb value in the arb handler class. you can do that, but

why? either you create the data and send it over to AE to store, or you get

data from AE to process and return. why would you want to store the data in

the handler?

that also has to do with your next question. (we'll swing back to the

previous soon)

where do i create and store the handlers? i do that during global setup,

and store them in the global data structure. then during param setup, i

pass the pointer to these handlers.

if you do so, you'll need to create a handle for these classes, initialize

them using "placed new", and keep the handler locked throughout the

session, so the handles don't move.

back to the previous question. if you allocate a handler that can serve a

few arbs, then storing the value in the handler class would not allow you

to use the same allocated handler for all.

if the handler is "neutral", then you could reuse. i found that sticking

with the generalized arb handler and re-using it saved me a lot of time.

1 reply

Community Expert
May 6, 2016

the arb param needs it's default data, and needs to be handled. if you need

different initialization or different handling you'll need to implement

different functions for each arb param.

there are a couple of ways to go about it.

1. C style.

when a param is defined, you can place a new "default data creator"

function for each arb.

when AE calls for PF_Cmd_ARBITRARY_CALLBACK, one of the data bits it

transfers tells you the disk_id of the called param, so you can use a

switch to call the right handling function for the specific arb.

2. C++ style.

the last param on the arb definition is a pointer which will be sent back

along with every call for PF_Cmd_ARBITRARY_CALLBACK.

put a pointer to some arb handing class in there, with virtual handling

methods. this way you can create a general arb handling class and just

override the methods you need for each specific arb.

i personally opted for the C++ option, and it made dealing with arbs one

hell of a lot easier.

Inspiring
May 6, 2016

Thanks Shachar.

I was wondering whether arbs are the way to go at all, actually; one of my custom UI params is just a graphical front-end for a choice selection, so I guess I can just override the events for a Popup, since each choice corresponds to a popup choice anyway.

The other UIs are currently handling multiple other sliders that are grouped under hidden topics (and never unhidden). Since none of the custom UI parameters can be keyframed, perhaps arbitrary data handling is complicating things somewhat!