Hi,
I appreciate any help on this !
So I've been trying to figure out an issue i've run into recently with trying to get my big macro knob that controls multiple parameters to play nice with my random button which randomizes the same parameters in a given value range.
I have both the big macro knob and the randomize button working properly in the script however whenever I press the randomize button, the big macro knob latches onto the new values of the randomize parameters successfully but once I press the randomize button again and then try to move the big macro knob once more, it ends up resetting all of the parameters back to the first time the parameters were randomized and were latched upon the first click of the random button.
I have attached a stripped version of my script below if any one once to take a look or replicate the issue and again I appreciate any help as this as been quite a headache to find the best way to approach solving this issue.
{----- INIT -----}
{paste INIT code under here}
on init
make_perfview
set_ui_height_px(532)
set_ui_width_px(948)
declare $flutterflag
declare $flutterdiff
$flutterflag :=0
declare $wowflag
declare $wowdiff
$wowflag :=0
declare $choralflag
declare $choraldiff
$choralflag :=0
declare $replikaflag
declare $replikadiff
$replikaflag :=0
declare $reverbflag
declare $reverbdiff
$reverbflag :=0
declare $tapeflag
declare $tapediff
$tapeflag :=0
{----- SLIDER -----}
{paste SLIDER code under here}
{RANDOMIZE PANEL - SLIDER}
declare ui_switch $Randomize
set_control_par_str(get_ui_id($Randomize), $CONTROL_PAR_PICTURE,"Dice")
set_control_par(get_ui_id($Randomize),$CONTROL_PAR_WIDTH,50)
set_control_par(get_ui_id($Randomize),$CONTROL_PAR_HEIGHT,50)
set_text($Randomize, "")
move_control_px($Randomize ,608, 483)
{MORPH PANEL - SLIDER}
declare ui_slider $Morph (1,999999)
make_persistent($Morph)
read_persistent_var($Morph)
set_control_par_str(get_ui_id($Morph),$CONTROL_PAR_PICTURE,"Knob_big")
set_control_par(get_ui_id($Morph),$CONTROL_PAR_MOUSE_BEHAVIOUR,-2000)
move_control_px($Morph,348,152)
{JUNO CHORUS 1 - SLIDER}
declare ui_switch $Juno_Chorus_1
make_persistent($Juno_Chorus_1)
read_persistent_var($Juno_Chorus_1)
set_control_par_str(get_ui_id($Juno_Chorus_1),$CONTROL_PAR_PICTURE,"button_small")
set_control_par(get_ui_id($Juno_Chorus_1),$CONTROL_PAR_WIDTH,50)
set_control_par(get_ui_id($Juno_Chorus_1),$CONTROL_PAR_HEIGHT,62)
set_text($Juno_Chorus_1,"")
set_control_par(get_ui_id($Juno_Chorus_1),$CONTROL_PAR_POS_X,784)
set_control_par(get_ui_id($Juno_Chorus_1),$CONTROL_PAR_POS_Y,138)
{JUNO CHORUS 2 - SLIDER}
declare ui_switch $Juno_Chorus_2
make_persistent($Juno_Chorus_2)
read_persistent_var($Juno_Chorus_2)
set_control_par_str(get_ui_id($Juno_Chorus_2),$CONTROL_PAR_PICTURE,"button_small")
set_control_par(get_ui_id($Juno_Chorus_2),$CONTROL_PAR_WIDTH,50)
set_control_par(get_ui_id($Juno_Chorus_2),$CONTROL_PAR_HEIGHT,62)
set_text($Juno_Chorus_2,"")
set_control_par(get_ui_id($Juno_Chorus_2),$CONTROL_PAR_POS_X,832)
set_control_par(get_ui_id($Juno_Chorus_2),$CONTROL_PAR_POS_Y,138)
{CHORAL - SLIDER}
declare ui_slider $Choral(1, 999999)
make_persistent($Choral)
read_persistent_var($Choral)
declare $ChorusId
$ChorusId := get_ui_id($Choral)
set_control_par_str($ChorusId, $CONTROL_PAR_PICTURE, "knob_slider")
set_control_par($ChorusId,$CONTROL_PAR_MOUSE_BEHAVIOUR,-1000)
move_control_px($Choral, 352, 382)
{REPLIKA - SLIDER}
declare ui_slider $replika(1,999999)
make_persistent($replika)
read_persistent_var($replika)
declare $replikaId
$replikaId := get_ui_id($replika)
set_control_par_str($replikaId, $CONTROL_PAR_PICTURE, "knob_slider")
set_control_par($replikaId,$CONTROL_PAR_MOUSE_BEHAVIOUR,-1000)
move_control_px($replika, 416, 382)
{REVERB - SLIDER}
declare ui_slider $reverb(1,999999)
make_persistent($reverb)
read_persistent_var($reverb)
set_control_par(get_ui_id($reverb),$CONTROL_PAR_DEFAULT_VALUE,1000000)
declare $reverbId
$reverbId := get_ui_id($reverb)
set_control_par_str($reverbId, $CONTROL_PAR_PICTURE, "knob_slider")
set_control_par($reverbId,$CONTROL_PAR_MOUSE_BEHAVIOUR,-1000)
move_control_px($reverb, 479, 382)
{WOW - SLIDER}
declare ui_slider $wow(1, 999999)
make_persistent($wow)
read_persistent_var($wow)
set_control_par(get_ui_id($wow),$CONTROL_PAR_MOUSE_BEHAVIOUR,-2300)
set_control_par_str(get_ui_id($wow),$CONTROL_PAR_PICTURE,"Ver_slider")
move_control_px($wow, 170, 160)
{FLUTTER - SLIDER}
declare ui_slider $flutter(1, 999999)
make_persistent($flutter)
read_persistent_var($flutter)
set_control_par(get_ui_id($flutter),$CONTROL_PAR_MOUSE_BEHAVIOUR,-2300)
set_control_par_str(get_ui_id($flutter),$CONTROL_PAR_PICTURE,"Ver_slider")
move_control_px($flutter, 242, 160)
{TAPE - SLIDER}
declare ui_slider $tape(1, 999999)
make_persistent($tape)
read_persistent_var($tape)
declare $tapeId
$tapeId := get_ui_id($tape)
set_control_par_str($tapeId, $CONTROL_PAR_PICTURE, "knob_slider")
set_control_par($tapeId,$CONTROL_PAR_MOUSE_BEHAVIOUR,-1000)
move_control_px($tape, 542, 382)
declare $volume_range
$flutterflag:=1
$wowflag:=1
$choralflag:=1
$replikaflag:=1
$reverbflag:=1
$tapeflag:=1
end on
{----- FUNCTIONS -----}
{paste FUNCTION code under here}
function randomize
$wow:=random(1, 999999)
$flutter:=random(1, 999999)
$Juno_Chorus_1:=random(0, 1)
$Juno_Chorus_2:=random(0, 1)
$Choral:=random(1, 999999)
$replika:=random(1, 999999)
$reverb:=random(1, 999999)
$tape:=random(1, 999999)
$Morph:=random(1, 999999)
end function
function morph
{Wow}
if ($wowflag = 1)
$wowdiff := $Morph - $wow
$wowflag :=0
end if
if ($wow >= 0 and $wow <= 999999)
$wow := $Morph - $wowdiff
message(" ")
end if
{Flutter}
if ($flutterflag = 1)
$flutterdiff := $Morph - $flutter
$flutterflag :=0
end if
if ($flutter >= 0 and $flutter <= 999999)
$flutter := $Morph - $flutterdiff
message(" ")
end if
{Choral}
if ($choralflag = 1)
$choraldiff := $Morph - $choral
$choralflag :=0
end if
if ($wow >= 0 and $wow <= 999999)
$choral := $Morph - $choraldiff
message(" ")
end if
{Replika}
if ($replikaflag = 1)
$replikadiff := $Morph - $replika
$replikaflag :=0
end if
if ($replika >= 0 and $replika <= 999999)
$replika := $Morph - $replikadiff
message(" ")
end if
{Reverb}
if ($reverbflag = 1)
$reverbdiff := $Morph - $reverb
$reverbflag :=0
end if
if ($reverb >= 0 and $reverb <= 999999)
$reverb := $Morph - $reverbdiff
message(" ")
end if
{Tape}
if ($tapeflag = 1)
$tapediff := $Morph - $tape
$tapeflag :=0
end if
if ($tape >= 0 and $tape <= 999999)
$tape := $Morph - $tapediff
message(" ")
end if
end function
function functions
{CHORAL - CONTROL}
set_engine_par($ENGINE_PAR_CHORAL_MIX, ($choral), -1, 3, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,397500+($choral*1/36), -1, 3, $NI_BUS_OFFSET + 0)
{REPLIKA - CONTROL}
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,($replika*25/100),-1, 4, $NI_BUS_OFFSET + 0)
{REVERB - CONTROL}
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,($reverb*25/100),-1, 5, $NI_BUS_OFFSET + 0)
{TAPE - CONTROL}
set_engine_par($ENGINE_PAR_TP_GAIN, ($tape*20/100), -1, 6, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_TP_WARMTH,500000+($tape*10/50), -1, 6, $NI_BUS_OFFSET + 0)
{WOW - CONTROL}
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($wow*29/100),0,find_mod(0,"WOW"),find_target(0,find_mod(0,"WOW"),"LFO WOW"))
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($wow*29/100),1,find_mod(1,"WOW"),find_target(1,find_mod(1,"WOW"),"LFO WOW"))
{FLUTTER - CONTROL}
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($flutter*41/100),0,find_mod(0,"FLUTTER"),find_target(0,find_mod(0,"FLUTTER"),"LFO FLUTTER"))
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($flutter*41/100),1,find_mod(1,"FLUTTER"),find_target(1,find_mod(1,"FLUTTER"),"LFO FLUTTER"))
{JUNO CHORUS 1}
if ($Juno_Chorus_1 = 1)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 0, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_CH_SPEED, 455000, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,280000+($Juno_Chorus_1*1/50), -1, 7, $NI_BUS_OFFSET + 0)
$Juno_Chorus_2 := 0
end if
if ($Juno_Chorus_1 = 0 and $Juno_Chorus_2 = 0)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1, -1, 7, $NI_BUS_OFFSET + 0)
end if
{JUNO CHORUS 2}
if ($Juno_Chorus_2 = 1)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 0, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_CH_SPEED, 720000, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, 280000+($Juno_Chorus_1*1/50), -1, 7, $NI_BUS_OFFSET + 0)
$Juno_Chorus_1 := 0
end if
if ($Juno_Chorus_1 = 0 and $Juno_Chorus_2 = 0)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1, -1, 7, $NI_BUS_OFFSET + 0)
end if
end function
{RANDOMIZE - CONTROL}
on ui_control ($Randomize)
call randomize
call functions
end on
{CHORAL - CONTROL}
on ui_control($choral)
$choralflag:=1
set_engine_par($ENGINE_PAR_CHORAL_MIX, ($choral), -1, 3, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,397500+($choral*1/36), -1, 3, $NI_BUS_OFFSET + 0)
end on
{REPLIKA - CONTROL}
on ui_control($replika)
$replikaflag:=1
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,($replika*25/100),-1, 4, $NI_BUS_OFFSET + 0)
end on
{WOW - CONTROL}
on ui_control($wow)
$wowflag:=1
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($wow*29/100),0,find_mod(0,"WOW"),find_target(0,find_mod(0,"WOW"),"LFO WOW"))
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($wow*29/100),1,find_mod(1,"WOW"),find_target(1,find_mod(1,"WOW"),"LFO WOW"))
end on
{FLUTTER - CONTROL}
on ui_control($flutter)
$flutterflag:=1
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($flutter*41/100),0,find_mod(0,"FLUTTER"),find_target(0,find_mod(0,"FLUTTER"),"LFO FLUTTER"))
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,($flutter*41/100),1,find_mod(1,"FLUTTER"),find_target(1,find_mod(1,"FLUTTER"),"LFO FLUTTER"))
end on
{REVERB - CONTROL}
on ui_control($reverb)
$reverbflag:=1
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,($reverb*25/100),-1, 5, $NI_BUS_OFFSET + 0)
end on
{TAPE - CONTROL}
on ui_control($tape)
$tapeflag:=1
set_engine_par($ENGINE_PAR_TP_GAIN, ($tape*40/100), -1, 6, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_TP_WARMTH,500000+($tape*10/50), -1, 6, $NI_BUS_OFFSET + 0)
end on
{JUNO CHORUS 1 - SLIDER}
on ui_control ($Juno_Chorus_1)
if ($Juno_Chorus_1 = 1)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 0, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_CH_SPEED, 455000, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,280000+($Juno_Chorus_1*1/50), -1, 7, $NI_BUS_OFFSET + 0)
$Juno_Chorus_2 := 0
end if
if ($Juno_Chorus_1 = 0 and $Juno_Chorus_2 = 0)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1, -1, 7, $NI_BUS_OFFSET + 0)
end if
end on
{JUNO CHORUS 2 - SLIDER}
on ui_control ($Juno_Chorus_2)
if ($Juno_Chorus_2 = 1)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 0, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_CH_SPEED, 720000, -1, 7, $NI_BUS_OFFSET + 0)
set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, 280000+($Juno_Chorus_1*1/50), -1, 7, $NI_BUS_OFFSET + 0)
$Juno_Chorus_1 := 0
end if
if ($Juno_Chorus_1 = 0 and $Juno_Chorus_2 = 0)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1, -1, 7, $NI_BUS_OFFSET + 0)
end if
end on
{MORPH - SLIDER}
on ui_control($Morph)
call functions
call morph
end on