Kontakt Script - How to control Time knob on Unisono Portamento script

mhbass
mhbass Member Posts: 1 Newcomer

Hey there, I need help controlling the TIME knob on the Unisono Portamento script. My UI script is on slot 5 and the Portamento script is on slot 1.

I am able to move the TIME knob using a ui_knob that I've made, but no change is happening.

Here's my code so far.

UI (slot 5):

declare ui_knob $porta_combi_knob (0, 127, 1)
make_persistent($porta_combi_knob)
pgs_create_key(TME, 1)

on ui_control ($porta_combi_knob)
pgs_set_key_val(TME, 0, $porta_combi_knob)
end on

Unisono Portamento (Slot 1) - I've changed the ui_control($port_combi_knob) into a function and called it.

Function Porta_Time_Function()
select ($porta_combi_knob)
case 0 to 31
$GlideRel := ($porta_combi_knob * 80)/32
case 32 to 63
$GlideRel := (($porta_combi_knob-32) * 120)/32 + 80
case 64 to 95
$GlideRel := (($porta_combi_knob-64) * 200)/32 + 200
case 96 to 127
$GlideRel := (($porta_combi_knob-96) * 2600)/31 +400
end select
$GlideAbs := ($porta_combi_knob*$porta_combi_knob2000)/(127127)
{if ($porta_rel_glide_button = 1)
set_knob_label($porta_combi_knob,$GlideRel)
else
if ($GlideAbs < 1000)
set_knob_label($porta_combi_knob,$Glideabs/1000&"."&($GlideAbs mod 1000)/100&($GlideAbs mod 100)/10&" s")
else
set_knob_label($porta_combi_knob,$Glideabs/1000&"."&($GlideAbs mod 1000)/100&" s")
end if
end if}
end function

{******************************************}

on ui_control ($porta_combi_knob)
call Porta_Time_Function()
end on

{PORTAMENTO TIME KNOB - PGS CONTROL*************************************************************}
on pgs_changed

if (pgs_key_exists(TME) and pgs_get_key_val(TME, 0) # $porta_combi_knob)
	$porta_combi_knob := pgs_get_key_val(TME, 0)
end if

end on

Thank you.

Back To Top