KSP Multiple XY's Host Automation question
Hi KSP Scripters, I hope all is well with you. I have a question/problem about scripting Host Automation with multiple XY pads in KSP. Is this possible?
I have created two XY Pads and cannot get Host Automation correctly assigned to both XY pads via KSP. When I create a 2 cursor XY pad, I can get the Host Automation for the four parameters on XY pad one, but if I add a second XY pad I cannot assign this to Host Automation correctly.
And, if I create one XY pad with 1 cursor and a second with 1 cursor, I only get the first XY's two parameters assigned and named correctly.
As always, it's bound to be my scripting but I have spent the afternoon trying to work this out. I have even tried the $CONTROL_PAR_ALLOW_AUTOMATION command just in case, although according to the manual the default is to allow automation… "By default, automation is allowed for all automatable widgets".
They do appear assigned to the instrument in Kontakt's Host Automation panel, but are not named and do not work when trying to automate with the DAW.
Here are two very basic scripts that demonstrate the issue:
First, this script recognises the 4 parameters on XY Pad 1 correctly… but not XY Pad 2:
on init message("XY") make_perfview set_ui_height_px(260) {Creates an XY Controller with 2 cursors} declare ui_xy ?xy_1[4] declare $xy_1_id make_persistent(?xy_1) $xy_1_id := get_ui_id(?xy_1) set_control_par($xy_1_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_1_id,$CONTROL_PAR_POS_Y,10) set_control_par($xy_1_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_1_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_MODE,0) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) {Setting Automation IDs and Names of the XY 1 pad} set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,0,0) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,1,1) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,2,2) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,3,3) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"ONE", 0) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TWO", 1) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"THREE", 2) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FOUR", 3) {Creates XY 2 Controller with 1 cursor} declare ui_xy ?xy_2[2] declare $xy_2_id make_persistent(?xy_2) $xy_2_id := get_ui_id(?xy_2) {sets the position and size of XY Controller} set_control_par($xy_2_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_2_id,$CONTROL_PAR_POS_Y,120) set_control_par($xy_2_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_2_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_MODE,2) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,4,4) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,5,5) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"FIVE", 4) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"SIX", 5) end on
Second, this script assigns the 2 parameters on XY Pad 1 correctly… but not XY Pad 2:
on init message("XY") make_perfview set_ui_height_px(260) {Creates an XY 1 Controller with 1 cursor} declare ui_xy ?xy_1[2] declare $xy_1_id make_persistent(?xy_1) $xy_1_id := get_ui_id(?xy_1) set_control_par($xy_1_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_1_id,$CONTROL_PAR_POS_Y,10) set_control_par($xy_1_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_1_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_MODE,0) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) {Setting Automation IDs and Names of the XY 1 pad} set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,0,0) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,1,1) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"ONE", 0) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TWO", 1) {Creates XY 2 Controller with 1 cursor} declare ui_xy ?xy_2[2] declare $xy_2_id make_persistent(?xy_2) $xy_2_id := get_ui_id(?xy_2) {sets the position and size of XY Controller} set_control_par($xy_2_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_2_id,$CONTROL_PAR_POS_Y,120) set_control_par($xy_2_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_2_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_MODE,2) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) {Setting Automation IDs and Names of the XY 1 pad} set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,2,2) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,3,3) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"THREE", 2) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"FOUR", 3) end on
Any help or guidance with this would be sincerely appreciated :)
Comments
-
It looks like only one XY can be assigned automation per script slot. In this example below I have an eight cursor XY Pad with the 16 parameters assigned with no problem, and they all automate correctly within the DAW (I did higher value XY cursor tests also with no problems), but, when adding a second XY Pad with one cursor it does not get assigned correctly via KSP:
on init message("XY") make_perfview set_ui_height_px(260) {Creates an XY Conroller with 8 cursors} declare ui_xy ?xy_1[16] declare $xy_1_id make_persistent(?xy_1) $xy_1_id := get_ui_id(?xy_1) set_control_par($xy_1_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_1_id,$CONTROL_PAR_POS_Y,10) set_control_par($xy_1_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_1_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_MODE,0) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) {Setting Automation IDs and Names of the XY 1 pad} set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,0,0) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,1,1) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,2,2) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,3,3) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,4,4) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,5,5) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,6,6) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,7,7) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,8,8) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,9,9) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,10,10) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,11,11) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,12,12) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,13,13) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,14,14) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,15,15) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"ONE", 0) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TWO", 1) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"THREE", 2) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FOUR", 3) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FIVE", 4) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"SIX", 5) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"SEVEN", 6) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"EIGHT", 7) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"NINE", 8) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TEN", 9) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"ELEVEN", 10) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TWELVE", 11) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"THIRTEEN", 12) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FOURTEEN", 13) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FIFTEEN", 14) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"SIXTEEN", 15) {Creates XY 2 Conroller with 1 cursor} declare ui_xy ?xy_2[2] declare $xy_2_id make_persistent(?xy_2) $xy_2_id := get_ui_id(?xy_2) {sets the position and size of XY Controller} set_control_par($xy_2_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_2_id,$CONTROL_PAR_POS_Y,120) set_control_par($xy_2_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_2_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_MODE,2) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,16,16) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,17,17) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"SEVENTEEN", 16) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"EIGHTEEN", 17) end on
0 -
Actually, you've assigned the second XY pad incorrectly. It should be set up like this:
set_control_par_arr($xy_2_id, $CONTROL_PAR_AUTOMATION_ID, <automation id number>, <xy element>)
So it should look like that:
set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,2,0)
set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,3,1)
And then…
set_control_par_str_arr($xy_2_id, $CONTROL_PAR_AUTOMATION_NAME, "SEVENTEEN", 0)
set_control_par_str_arr($xy_2_id, $CONTROL_PAR_AUTOMATION_NAME, "EIGHTEEN", 1)
Since it's a new XY pad with just 2 array elements, KSP expects the indexing to start from 0. In your code, Kontakt was trying to access the 16th element, which doesn't exist.0 -
Perfect theodorech, thank you for your answer, it has improved my understanding and solved my problem!
on init message("XY") make_perfview set_ui_height_px(260) {Creates an XY Conroller with 8 cursors} declare ui_xy ?xy_1[16] declare $xy_1_id make_persistent(?xy_1) $xy_1_id := get_ui_id(?xy_1) set_control_par($xy_1_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_1_id,$CONTROL_PAR_POS_Y,10) set_control_par($xy_1_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_1_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_MODE,0) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_1_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) {Setting Automation IDs and Names of the XY 1 pad} set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,0,0) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,1,1) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,2,2) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,3,3) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,4,4) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,5,5) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,6,6) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,7,7) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,8,8) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,9,9) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,10,10) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,11,11) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,12,12) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,13,13) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,14,14) set_control_par_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_ID,15,15) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"ONE", 0) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TWO", 1) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"THREE", 2) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FOUR", 3) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FIVE", 4) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"SIX", 5) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"SEVEN", 6) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"EIGHT", 7) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"NINE", 8) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TEN", 9) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"ELEVEN", 10) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"TWELVE", 11) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"THIRTEEN", 12) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FOURTEEN", 13) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"FIFTEEN", 14) set_control_par_str_arr($xy_1_id,$CONTROL_PAR_AUTOMATION_NAME,"SIXTEEN", 15) {Creates XY 2 Conroller with 1 cursor} declare ui_xy ?xy_2[2] declare $xy_2_id make_persistent(?xy_2) $xy_2_id := get_ui_id(?xy_2) {sets the position and size of XY Controller} set_control_par($xy_2_id,$CONTROL_PAR_POS_X,265) set_control_par($xy_2_id,$CONTROL_PAR_POS_Y,120) set_control_par($xy_2_id,$CONTROL_PAR_WIDTH,96) set_control_par($xy_2_id,$CONTROL_PAR_HEIGHT,76) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_MODE,2) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_X,1000) set_control_par($xy_2_id,$CONTROL_PAR_MOUSE_BEHAVIOUR_Y,1000) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,16,0) set_control_par_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_ID,17,1) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"SEVENTEEN", 0) set_control_par_str_arr($xy_2_id,$CONTROL_PAR_AUTOMATION_NAME,"EIGHTEEN", 1) end on
Really appreciated! Thank you again theodorech.
0 -
Btw, just a suggestion: rather than writing long blocks of code to assign the automation ID and its name, you could create a string array with all the different names you need for the automation IDs. Then, wrap everything in a loop (or maybe two). In the loop, you’d go through each element in the array, making it easier to assign the automation ID and name at the same time.
8-9 vs 20+ lines of code :)
on init
declare !my_list[31]
!my_list[0] := "FIRST"
!my_list[1] := "SECOND"
!my_list[2] := "THIRD"
!my_list[3] := "FOURTH"
!my_list[4] := "FIFTH"
!my_list[5] := "SIXTH"
!my_list[6] := "SEVENTH"
!my_list[7] := "EIGHTH"
!my_list[8] := "NINTH"
!my_list[9] := "TENTH"
!my_list[10] := "ELEVENTH"
!my_list[11] := "TWELFTH"
!my_list[12] := "THIRTEENTH"
!my_list[13] := "FOURTEENTH"
!my_list[14] := "FIFTEENTH"
!my_list[15] := "SIXTEENTH"
!my_list[16] := "SEVENTEENTH"
!my_list[17] := "EIGHTEENTH"
!my_list[18] := "NINETEENTH"
!my_list[19] := "TWENTIETH"
!my_list[20] := "TWENTY-FIRST"
!my_list[21] := "TWENTY-SECOND"
!my_list[22] := "TWENTY-THIRD"
!my_list[23] := "TWENTY-FOURTH"
!my_list[24] := "TWENTY-FIFTH"
!my_list[25] := "TWENTY-SIXTH"
!my_list[26] := "TWENTY-SEVENTH"
!my_list[27] := "TWENTY-EIGHTH"
!my_list[28] := "TWENTY-NINTH"
!my_list[29] := "THIRTIETH"
declare $i
declare ui_xy ?xy_pad_1[16]
declare ui_xy ?xy_pad_2[6]
$i := 0
while ($i<16)
set_control_par_arr(get_ui_id(?xy_pad_1),$CONTROL_PAR_AUTOMATION_ID,$i,$i)
set_control_par_str_arr(get_ui_id(?xy_pad_1),$CONTROL_PAR_AUTOMATION_NAME,!my_list[$i],$i)
inc($i)
end while
$i := 16
while ($i<22)
set_control_par_arr(get_ui_id(?xy_pad_2),$CONTROL_PAR_AUTOMATION_ID,$i-16,$i-16)
set_control_par_str_arr(get_ui_id(?xy_pad_2),$CONTROL_PAR_AUTOMATION_NAME,!my_list[$i],$i-16)
inc($i)
end while
end on0 -
Excellent theodorech, thank you for the suggestion, and the code to experiment with! I will try this tomorrow :)
0 -
Hi theodorech, that method works perfectly for multiple XY Controllers. Brilliant! Thank you again :)
1
Categories
- All Categories
- 19 Welcome
- 1.3K Hangout
- 59 NI News
- 710 Tech Talks
- 3.7K Native Access
- 15.2K Komplete
- 1.8K Komplete General
- 4K Komplete Kontrol
- 5.3K Kontakt
- 1.5K Reaktor
- 356 Battery 4
- 787 Guitar Rig & FX
- 403 Massive X & Synths
- 1.1K Other Software & Hardware
- 5.3K Maschine
- 6.7K Traktor
- 6.7K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators