Skip to main content
Inspiring
May 31, 2024
Answered

SDK: Set Parameter value during paramSetup

  • May 31, 2024
  • 2 replies
  • 1129 views

Hi

 

I need my effects to have a unique ID. So I have created an AEGP and a custom suite. The custom suite have a function which returns an unique effect ID.

In the very end of the ParamSetup function I want to do this:

 

Call GetUniqueEffectID function

Use AEGP_GetNewEffectForEffect to get effect

Use AEGP_GetNewEffectStreamByIndex to get parameter stream

Use AEGP_SetStreamValue to set value of a hidden ID parameter to the uniqueID

 

The problem is I don't get far. If I call this line at the end of paramSetup I get a runtime error:

ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(globP->my_id, in_data->effect_ref, &effectRef));

What would be the correct way to do this? Is there a better time to set the parameter value?

 

Thanks,

Jakob

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

If you need each instance of your effect to have a unique id, then there's a conceptual problem here.

Param setup is called once per session per effect type, and not once per instance. So all your instances will end up with the same id for that session.

 

The way to go is to setup sequence data with a unique ud, as the sequence setup call is triggered only once per instace, when it is created.

There are some complications with this method, so look it up in this forum ad it has been duscussed throughly in the past.

2 replies

shachar carmiCommunity ExpertCorrect answer
Community Expert
May 31, 2024

If you need each instance of your effect to have a unique id, then there's a conceptual problem here.

Param setup is called once per session per effect type, and not once per instance. So all your instances will end up with the same id for that session.

 

The way to go is to setup sequence data with a unique ud, as the sequence setup call is triggered only once per instace, when it is created.

There are some complications with this method, so look it up in this forum ad it has been duscussed throughly in the past.

Inspiring
June 5, 2024

Is there a way to set a parameters value during the PF_Cmd_SEQUENCE_RESETUP? Can I reset a specific parameter during PF_Cmd_SEQUENCE_RESETUP?

Community Expert
June 5, 2024

in short: no.

in long:
sequence setup (and ususally all other sequence data calls) usually happen without the call having a specific instance associated to the call. that means the passed params array contains junk data, and trying to aquire an AEGP_EffectRef will result in a crash.

so although is seems logical to change params during the sequence data call, it's technically not possible.

the way to go is to set a flag in the new squence data saying "this is a brand new instance, and it should be treated", then then checking this flag during idle_hook or during UPDATE_PARAMS_UI, and making the change accordingly (and not to forget to set that flag off...).

Inspiring
May 31, 2024

Simply set the default value during the PF_ADD_FLOAT_SLIDER call, of course!

Sorry, friday afternoon here.