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 :)