Hi,
I am struggling with the PGS scripting for the Portamento Combi Knob (Time). Can anyone help please?
I have tried to follow the instructions from previous posts but keep running into script errors. I simply want a knob in script slot 1 to control the Portamento Time knob in script slot 4.
The script below is where I have got up to but it won't compile as there is a script error.
Thanks for any help.
{SCRIPT SLOT 1}
on init
declare ui_knob $porta_combi_knob (0, 127, 1)
make_persistent($porta_combi_knob)
pgs_create_key(TME, 1)
end on
on ui_control ($porta_combi_knob)
pgs_set_key_val(TME, 0, $porta_combi_knob)
{BELOW CODE IS COPIED FROM UNISONO PORTAMENTO ON UI_CONTROL ($porta_combi_knob)}
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_knob*2000)/(127*127)
{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 on
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_knob*2000)/(127*127)
{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
{SCRIPT SLOT 4 - UNISONO PORTAMENTO SCRIPT PLUS THE FOLLOWING CODE AT THE END}
{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