# Control_par_automation_id and friends



## magneto538 (Feb 28, 2017)

Hello folks,

I'm getting into Kontakt 5.6.x these days (finally!) and I am collecting info about the new features included in the new version in order to update Koala.

As far as I've seen, very little informations are provided by NI about the new CONTROL_PAR_AUTOMATION_ID, as well as how it interacts with the new XY Pad. 
Any real life scenario where CONTROL_PAR_AUTOMATION_ID can be used? How can we process the assigned ID within the script?


----------



## EvilDragon (Feb 28, 2017)

It's explained in KSP reference: Control Parameter Variables->General->Automation.


----------



## magneto538 (Feb 28, 2017)

EvilDragon said:


> It's explained in KSP reference: Control Parameter Variables->General->Automation.



Thanks for the heads-up. I had already checked the manual, but it doesn't really explain how to handle that, nor it has any example. I mean, there is no info about how to process those IDs anywhere in the manual (or, at least, I couldn't find any) so I'm not sure about what has to be done after the ID has been assigned.


----------



## EvilDragon (Feb 28, 2017)

You don't need to process IDs at all - nothing needs to be done post-assignment. Setting an ID for a control just means reserving that particular automation slot ID for that particular UI control, for as long as the assignment exists. Valid numbers are 0 to 511, and it is not a good idea to assign multiple parameters to the same ID (although it's possible, I think - just like it's possible to do so manually in Kontakt's Auto tab in the left side browser).

$CONTROL_PAR_AUTOMATION_ID actually exists since Kontakt 4, but it worked in a very weird (and complicated) way, so it wasn't documented at all. Factory library uses it, though  With K5.6, NI finally improved the implementation, so now you can link all automatable controls to their individual automation slots in a single loop easily (caveat: you gotta keep track of which controls are automatable in an array, because getting $CONTROL_PAR_ALLOW_AUTOMATION always returns 0 unfortunately).


----------



## magneto538 (Feb 28, 2017)

EvilDragon said:


> You don't need to process IDs at all - nothing needs to be done post-assignment. Setting an ID for a control just means reserving that particular automation slot ID for that particular UI control, for as long as the assignment exists. Valid numbers are 0 to 511, and it is not a good idea to assign multiple parameters to the same ID (although it's possible, I think - just like it's possibe to do so manually in Kontakt's Auto tab in the left side browser).
> 
> $CONTROL_PAR_AUTOMATION_ID actually exists since Kontakt 4, but it worked in a very weird (and complicated) way, so it wasn't documented at all. Factory library uses it, though  With K5.6, NI finally improved the implementation, so now you can link all automatable controls to their individual automation slots in a single loop easily (caveat: you gotta keep track of which controls are automatable in an array, because getting $CONTROL_PAR_ALLOW_AUTOMATION always returns 0 unfortunately).



Clear as crystal. I didn't have a chance to use automation so far, so I didn't have any experience with that. I also thought that CONTROL_PAR_AUTOMATION_ID was introduced with K5.6 actually (the changelog calls it a "new control parameter" under K5.6 section...). Thanks for helping Mario


----------



## EvilDragon (Feb 28, 2017)

Yep, it's new because it wasn't documented before. Ehehe.


----------



## polypx (Feb 28, 2017)

Mario, do you know if you still have to just set the AUTOMATION_ID once, save the instrument, and then disable the control_par assignments? Or has that changed in 5.6?


----------



## EvilDragon (Feb 28, 2017)

That's what was changed in 5.6 - that horrible implementation is no more. Now for as long as you have AUTOMATION_ID assigning a slot number to a UI control, it's going to reserve that slot forever, until you remove AUTOMATION_ID (which you obviously don't want).

The way I deal with this in instruments I'm working on is having an array for all control pars for all controls, then I loop through it and set them all. After that, I check the column that contains ALLOW_AUTOMATION state (0 or 1), then run this loop to assign a slot (starting at ID 0) for each UI control that is automatable:


```
// assign automation IDs
   j := 0
   for i := 0 to NUM_CONTROLS - 1
     if CONTROL_PAR[ 9 + (i * 11)] = 1    { this is my control par array, and ALLOW_AUTOMATION is stored in 10th column }
       ID[i] -> automation_id := j
       inc(j)
     end if
   end for
```


So this automatically updates automation slots if you add any controls, etc. (although one needs to be careful not to break the order of controls, if you've already created NKS parameter pages, etc. - because this sort of auto-updating will break it.)


----------



## polypx (Feb 28, 2017)

Ok, that looks much better. Thanks so much for the info. But that also means, I guess, that if you load a pre 5.6 with automation setup instrument in 5.6, it can overwrite the existing automation setup? Or only if you "RE"-assign it in the script? If not, does it still stay with the NKI?


----------



## EvilDragon (Feb 28, 2017)

Only if you reassign it. Your existing auto ID implementation is stored in the NKI, so if you don't change anything via the new implementation, it has no influence to what's in there already, of course.


----------



## polypx (Mar 1, 2017)

Is there a way to remove the AUTOMATION_ID completely, in KSP? (I know I can do it manually, but it's slow.)


----------



## EvilDragon (Mar 1, 2017)

I honestly don't know. Easy way would be to open the NKI that has auto IDs assigned the old way, then tweak the script so that the same parameter is assigned to the same auto ID slot, then apply the script. After that, remove that auto ID slot assignment and see what happens.


----------

