{ ****************************************************
KGM TEMPLATE INSTRUMENT
Author: RIGID AUDIO
**************************************************** }

{ BEGIN ON INIT }
on init
    hide_inst_icon
    make_perfview
    set_ui_height_px(540)  { adjust size to your needs here }
    set_skin_offset(0)     { SKIN OFFSET }
    set_script_title("Effects")
    
    { 3D DEPTH                                              1 }
    declare const        $KGM_GROUP_OFFSET               := 1
    declare              $KGM_GROUP_COUNT                := 1
    declare              $KGM_FX_QUERY                   := 1
    declare              $KGM_SEND_QUERY                 := 1 
    
    declare              $KGM_GROUP_A                    := 0
    declare              $KGM_GROUP_B                    := 0
    declare              $KGM_GROUP_C                    := 0
    declare              $KGM_GROUP_D                    := 0
    declare              $KGM_GROUP_E                    := 0
    declare              $KGM_GROUP_F                    := 0
    declare              $KGM_GROUP_G                    := 0
    declare              $KGM_GROUP_H                    := 0
    declare              $KGM_GROUP_I                    := 0
    declare              $KGM_GROUP_J                    := 0
    declare              $KGM_GROUP_A_ACTIVE             := 1
    declare              $KGM_GROUP_B_ACTIVE             := 0
    declare              $KGM_GROUP_C_ACTIVE             := 0
    declare              $KGM_GROUP_D_ACTIVE             := 0    
	declare              $KGM_GROUP_E_ACTIVE             := 0
    declare              $KGM_GROUP_F_ACTIVE             := 0
    declare              $KGM_GROUP_G_ACTIVE             := 0
    declare              $KGM_GROUP_H_ACTIVE             := 0
	declare              $KGM_GROUP_I_ACTIVE             := 0
    declare              $KGM_GROUP_J_ACTIVE             := 0
    declare              $KGM_CONTROL_ALL_GROUPS         := 1
    declare              $KGM_ACTIVE_GROUPS              := 1
    
    declare              $KGM_MULTISAMPLE_MODE           := 0
    
    { BUSSES }
    declare              $BUS1_VOLUME                    := 630000
    declare              $BUS2_VOLUME                    := 630000
    declare              $BUS3_VOLUME                    := 630000
    declare              $BUS4_VOLUME                    := 630000
    declare              $BUS5_VOLUME                    := 630000
    declare              $BUS6_VOLUME                    := 630000
    declare              $BUS7_VOLUME                    := 630000
    declare              $BUS8_VOLUME                    := 630000
    declare              $BUS9_VOLUME                    := 630000
    declare              $BUS10_VOLUME                   := 630000
    declare              $BUS11_VOLUME                   := 630000
    declare              $BUS12_VOLUME                   := 630000
    declare              $BUS13_VOLUME                   := 630000
    declare              $BUS14_VOLUME                   := 630000
    declare              $BUS15_VOLUME                   := 630000
    declare              $BUS16_VOLUME                   := 630000
    make_persistent     ($BUS1_VOLUME)
    make_persistent     ($BUS2_VOLUME)
    make_persistent     ($BUS3_VOLUME)
    make_persistent     ($BUS4_VOLUME)
    make_persistent     ($BUS5_VOLUME)
    make_persistent     ($BUS6_VOLUME)
    make_persistent     ($BUS7_VOLUME)
    make_persistent     ($BUS8_VOLUME)   
    make_persistent     ($BUS9_VOLUME)
    make_persistent     ($BUS10_VOLUME)
    make_persistent     ($BUS11_VOLUME)
    make_persistent     ($BUS12_VOLUME)   
    make_persistent     ($BUS13_VOLUME)
    make_persistent     ($BUS14_VOLUME)
    make_persistent     ($BUS15_VOLUME)
    make_persistent     ($BUS16_VOLUME)
    read_persistent_var ($BUS1_VOLUME)    
    read_persistent_var ($BUS2_VOLUME)
    read_persistent_var ($BUS3_VOLUME)
    read_persistent_var ($BUS4_VOLUME)
    read_persistent_var ($BUS5_VOLUME)    
    read_persistent_var ($BUS6_VOLUME)
    read_persistent_var ($BUS7_VOLUME)
    read_persistent_var ($BUS8_VOLUME)   
    read_persistent_var ($BUS9_VOLUME)    
    read_persistent_var ($BUS10_VOLUME)
    read_persistent_var ($BUS11_VOLUME)
    read_persistent_var ($BUS12_VOLUME)   
    read_persistent_var ($BUS13_VOLUME)    
    read_persistent_var ($BUS14_VOLUME)
    read_persistent_var ($BUS15_VOLUME)
    read_persistent_var ($BUS16_VOLUME)               
 
    { LISTENERS }
    set_listener        ($NI_SIGNAL_TIMER_MS,18000)
    declare              $KGM_ANIM_STEP                  := 0
    declare              $KGM_ANIM_FRAMES_MAX            := 99

    { KGM NOTE SEQUENCER }
    declare              $KGM_NOTE_SEQUENCER_ARR_COUNT   := 0

    declare              %KGM_NOTE_SEQUENCER_ARRAY[128]
    make_persistent     (%KGM_NOTE_SEQUENCER_ARRAY)    
    read_persistent_var (%KGM_NOTE_SEQUENCER_ARRAY)
        
    declare              $KGM_NOTE_SEQUENCER_STEPS_SHOWN := 16
    make_persistent     ($KGM_NOTE_SEQUENCER_STEPS_SHOWN)    
    read_persistent_var ($KGM_NOTE_SEQUENCER_STEPS_SHOWN)        
    
    declare              $KGM_NOTE_SEQUENCER_ENABLE      := 0
    make_persistent     ($KGM_NOTE_SEQUENCER_ENABLE)
    read_persistent_var ($KGM_NOTE_SEQUENCER_ENABLE)
    
    declare              $KGM_NOTE_ID                    := 0
    declare              $KGM_FIRST_NOTE                 := 0
    declare              $KGM_WAIT_EVENT                 := 0
    declare              $KGM_CHK_NOTES                  := 0
    declare              $KGM_NCOUNT                     := 0
    declare              $KGM_SEQUENCER_POS              := 0
    declare              $KGM_SEQUENCER_DURATION         := 0
                         $KGM_SEQUENCER_DURATION         := $DURATION_SIXTEENTH
    make_persistent     ($KGM_SEQUENCER_DURATION)
    read_persistent_var ($KGM_SEQUENCER_DURATION)

    { GROUPS }
    make_persistent     ($KGM_CONTROL_ALL_GROUPS)
    make_persistent     ($KGM_ACTIVE_GROUPS)

    read_persistent_var ($KGM_CONTROL_ALL_GROUPS)
    read_persistent_var ($KGM_ACTIVE_GROUPS)

    { BEGIN DECLARE               $slider5360027 }
    declare ui_slider             $slider5360027(0,1000000)
    make_persistent              ($slider5360027)
    read_persistent_var          ($slider5360027)
    set_control_par_str(get_ui_id($slider5360027),$CONTROL_PAR_PICTURE,"kgm_encoder_red_led")
    set_control_par_str(get_ui_id($slider5360027),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider5360027),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider5360027),$CONTROL_PAR_AUTOMATION_NAME,"slider5360027")
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_WIDTH,70)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_HEIGHT,70)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_POS_X,96)
    set_control_par    (get_ui_id($slider5360027),$CONTROL_PAR_POS_Y,435)
    { PNG FILENAME                $slider5360027, "user/kgm_encoder_red_led.png" }
    { IS 3D                       $slider5360027, 0 }
    { 3D SHAPE                    $slider5360027, 1 }
    { 3D RADIUS                   $slider5360027, 1 }
    { 3D LENGTH                   $slider5360027, 1 }
    { BEGIN ACTION                $slider5360027 }
    { ACTION FILE                 $slider5360027, "send fx/grp fx send level reverb.txt" }
    declare $slider5360027_GRP_CURRENT := 1
    declare $slider5360027_GRP_BEGIN   := 1
    declare $slider5360027_GRP_END     := 0
            $slider5360027_GRP_END     := $NUM_GROUPS-1 { REQUIRED }
    { END ACTION                  $slider5360027 }
    { GROUP MODE                  $slider5360027, 0 }
    { GROUP SINGLE                $slider5360027, 1 }
    { GROUP FROM                  $slider5360027, 1 }
    { GROUP TO                    $slider5360027, 1 }
    { RANDOMIZE LAYER             $slider5360027, 0 }
    { END DECLARE                 $slider5360027 }

    { BEGIN DECLARE               $slider5089682 }
    declare ui_slider             $slider5089682(0,1000000)
    make_persistent              ($slider5089682)
    read_persistent_var          ($slider5089682)
    set_control_par_str(get_ui_id($slider5089682),$CONTROL_PAR_PICTURE,"kgm_encoder_red_led")
    set_control_par_str(get_ui_id($slider5089682),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider5089682),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider5089682),$CONTROL_PAR_AUTOMATION_NAME,"slider5089682")
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_WIDTH,70)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_HEIGHT,70)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_POS_X,16)
    set_control_par    (get_ui_id($slider5089682),$CONTROL_PAR_POS_Y,435)
    { PNG FILENAME                $slider5089682, "user/kgm_encoder_red_led.png" }
    { IS 3D                       $slider5089682, 0 }
    { 3D SHAPE                    $slider5089682, 1 }
    { 3D RADIUS                   $slider5089682, 1 }
    { 3D LENGTH                   $slider5089682, 1 }
    { BEGIN ACTION                $slider5089682 }
    { ACTION FILE                 $slider5089682, "send fx/grp fx send level delay.txt" }
    declare $slider5089682_GRP_CURRENT := 1
    declare $slider5089682_GRP_BEGIN   := 1
    declare $slider5089682_GRP_END     := 0
            $slider5089682_GRP_END     := $NUM_GROUPS-1 { REQUIRED }
    { END ACTION                  $slider5089682 }
    { GROUP MODE                  $slider5089682, 0 }
    { GROUP SINGLE                $slider5089682, 1 }
    { GROUP FROM                  $slider5089682, 1 }
    { GROUP TO                    $slider5089682, 1 }
    { RANDOMIZE LAYER             $slider5089682, 0 }
    { END DECLARE                 $slider5089682 }

    { BEGIN DECLARE               $slider5091613 }
    declare ui_slider             $slider5091613(0,1000000)
    make_persistent              ($slider5091613)
    read_persistent_var          ($slider5091613)
    set_control_par_str(get_ui_id($slider5091613),$CONTROL_PAR_PICTURE,"kgm_encoder_red_led")
    set_control_par_str(get_ui_id($slider5091613),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider5091613),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider5091613),$CONTROL_PAR_AUTOMATION_NAME,"slider5091613")
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_WIDTH,70)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_HEIGHT,70)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_POS_X,176)
    set_control_par    (get_ui_id($slider5091613),$CONTROL_PAR_POS_Y,435)
    { PNG FILENAME                $slider5091613, "user/kgm_encoder_red_led.png" }
    { IS 3D                       $slider5091613, 0 }
    { 3D SHAPE                    $slider5091613, 1 }
    { 3D RADIUS                   $slider5091613, 1 }
    { 3D LENGTH                   $slider5091613, 1 }
    { BEGIN ACTION                $slider5091613 }
    { ACTION FILE                 $slider5091613, "send fx/fx send level phaser.txt" }
    declare $slider5091613_GRP_CURRENT := 1
    declare $slider5091613_GRP_BEGIN   := 1
    declare $slider5091613_GRP_END     := 0
            $slider5091613_GRP_END     := $NUM_GROUPS-1 { REQUIRED }
    { END ACTION                  $slider5091613 }
    { GROUP MODE                  $slider5091613, 0 }
    { GROUP SINGLE                $slider5091613, 1 }
    { GROUP FROM                  $slider5091613, 1 }
    { GROUP TO                    $slider5091613, 1 }
    { RANDOMIZE LAYER             $slider5091613, 0 }
    { END DECLARE                 $slider5091613 }

    { BEGIN DECLARE               $slider1135442 }
    declare ui_slider             $slider1135442(0,1000000)
    make_persistent              ($slider1135442)
    read_persistent_var          ($slider1135442)
    set_control_par_str(get_ui_id($slider1135442),$CONTROL_PAR_PICTURE,"kgm_encoder_red_led")
    set_control_par_str(get_ui_id($slider1135442),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider1135442),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider1135442),$CONTROL_PAR_AUTOMATION_NAME,"slider1135442")
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_WIDTH,70)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_HEIGHT,70)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_POS_X,256)
    set_control_par    (get_ui_id($slider1135442),$CONTROL_PAR_POS_Y,436)
    { PNG FILENAME                $slider1135442, "user/kgm_encoder_red_led.png" }
    { IS 3D                       $slider1135442, 0 }
    { 3D SHAPE                    $slider1135442, 1 }
    { 3D RADIUS                   $slider1135442, 1 }
    { 3D LENGTH                   $slider1135442, 1 }
    { BEGIN ACTION                $slider1135442 }
    { ACTION FILE                 $slider1135442, "send fx/grp fx send level flanger.txt" }
    declare $slider1135442_GRP_CURRENT := 1
    declare $slider1135442_GRP_BEGIN   := 1
    declare $slider1135442_GRP_END     := 0
            $slider1135442_GRP_END     := $NUM_GROUPS-1 { REQUIRED }
    { END ACTION                  $slider1135442 }
    { GROUP MODE                  $slider1135442, 0 }
    { GROUP SINGLE                $slider1135442, 1 }
    { GROUP FROM                  $slider1135442, 1 }
    { GROUP TO                    $slider1135442, 1 }
    { RANDOMIZE LAYER             $slider1135442, 0 }
    { END DECLARE                 $slider1135442 }

    { BEGIN DECLARE               $slider3036989 }
    declare ui_slider             $slider3036989(0,1000000)
    make_persistent              ($slider3036989)
    read_persistent_var          ($slider3036989)
    set_control_par_str(get_ui_id($slider3036989),$CONTROL_PAR_PICTURE,"kgm_encoder_red_led")
    set_control_par_str(get_ui_id($slider3036989),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider3036989),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider3036989),$CONTROL_PAR_AUTOMATION_NAME,"slider3036989")
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_WIDTH,70)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_HEIGHT,70)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_POS_X,336)
    set_control_par    (get_ui_id($slider3036989),$CONTROL_PAR_POS_Y,435)
    { PNG FILENAME                $slider3036989, "user/kgm_encoder_red_led.png" }
    { IS 3D                       $slider3036989, 0 }
    { 3D SHAPE                    $slider3036989, 1 }
    { 3D RADIUS                   $slider3036989, 1 }
    { 3D LENGTH                   $slider3036989, 1 }
    { BEGIN ACTION                $slider3036989 }
    { ACTION FILE                 $slider3036989, "send fx/grp fx send level chorus.txt" }
    declare $slider3036989_GRP_CURRENT := 1
    declare $slider3036989_GRP_BEGIN   := 1
    declare $slider3036989_GRP_END     := 0
            $slider3036989_GRP_END     := $NUM_GROUPS-1 { REQUIRED }
    { END ACTION                  $slider3036989 }
    { GROUP MODE                  $slider3036989, 0 }
    { GROUP SINGLE                $slider3036989, 1 }
    { GROUP FROM                  $slider3036989, 1 }
    { GROUP TO                    $slider3036989, 1 }
    { RANDOMIZE LAYER             $slider3036989, 0 }
    { END DECLARE                 $slider3036989 }

    { BEGIN DECLARE               $slider3220047 }
    declare ui_slider             $slider3220047(0,1000000)
    make_persistent              ($slider3220047)
    read_persistent_var          ($slider3220047)
    set_control_par_str(get_ui_id($slider3220047),$CONTROL_PAR_PICTURE,"delay")
    set_control_par_str(get_ui_id($slider3220047),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider3220047),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider3220047),$CONTROL_PAR_AUTOMATION_NAME,"slider3220047")
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_WIDTH,96)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_HEIGHT,16)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_POS_X,3)
    set_control_par    (get_ui_id($slider3220047),$CONTROL_PAR_POS_Y,500)
    { PNG FILENAME                $slider3220047, "user/delay.png" }
    { IS 3D                       $slider3220047, 0 }
    { 3D SHAPE                    $slider3220047, 1 }
    { 3D RADIUS                   $slider3220047, 1 }
    { 3D LENGTH                   $slider3220047, 1 }
    { BEGIN ACTION                $slider3220047 }
    { ACTION FILE                 $slider3220047, "N/A" }
    { END ACTION                  $slider3220047 }
    { GROUP MODE                  $slider3220047, 0 }
    { GROUP SINGLE                $slider3220047, 1 }
    { GROUP FROM                  $slider3220047, 1 }
    { GROUP TO                    $slider3220047, 1 }
    { RANDOMIZE LAYER             $slider3220047, 0 }
    { END DECLARE                 $slider3220047 }

    { BEGIN DECLARE               $slider7183844 }
    declare ui_slider             $slider7183844(0,1000000)
    make_persistent              ($slider7183844)
    read_persistent_var          ($slider7183844)
    set_control_par_str(get_ui_id($slider7183844),$CONTROL_PAR_PICTURE,"reverb")
    set_control_par_str(get_ui_id($slider7183844),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider7183844),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider7183844),$CONTROL_PAR_AUTOMATION_NAME,"slider7183844")
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_WIDTH,96)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_HEIGHT,16)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_POS_X,83)
    set_control_par    (get_ui_id($slider7183844),$CONTROL_PAR_POS_Y,500)
    { PNG FILENAME                $slider7183844, "user/reverb.png" }
    { IS 3D                       $slider7183844, 0 }
    { 3D SHAPE                    $slider7183844, 1 }
    { 3D RADIUS                   $slider7183844, 1 }
    { 3D LENGTH                   $slider7183844, 1 }
    { BEGIN ACTION                $slider7183844 }
    { ACTION FILE                 $slider7183844, "N/A" }
    { END ACTION                  $slider7183844 }
    { GROUP MODE                  $slider7183844, 0 }
    { GROUP SINGLE                $slider7183844, 1 }
    { GROUP FROM                  $slider7183844, 1 }
    { GROUP TO                    $slider7183844, 1 }
    { RANDOMIZE LAYER             $slider7183844, 0 }
    { END DECLARE                 $slider7183844 }

    { BEGIN DECLARE               $slider6104330 }
    declare ui_slider             $slider6104330(0,1000000)
    make_persistent              ($slider6104330)
    read_persistent_var          ($slider6104330)
    set_control_par_str(get_ui_id($slider6104330),$CONTROL_PAR_PICTURE,"phaser")
    set_control_par_str(get_ui_id($slider6104330),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider6104330),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider6104330),$CONTROL_PAR_AUTOMATION_NAME,"slider6104330")
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_WIDTH,96)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_HEIGHT,16)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_POS_X,163)
    set_control_par    (get_ui_id($slider6104330),$CONTROL_PAR_POS_Y,500)
    { PNG FILENAME                $slider6104330, "user/phaser.png" }
    { IS 3D                       $slider6104330, 0 }
    { 3D SHAPE                    $slider6104330, 1 }
    { 3D RADIUS                   $slider6104330, 1 }
    { 3D LENGTH                   $slider6104330, 1 }
    { BEGIN ACTION                $slider6104330 }
    { ACTION FILE                 $slider6104330, "N/A" }
    { END ACTION                  $slider6104330 }
    { GROUP MODE                  $slider6104330, 0 }
    { GROUP SINGLE                $slider6104330, 1 }
    { GROUP FROM                  $slider6104330, 1 }
    { GROUP TO                    $slider6104330, 1 }
    { RANDOMIZE LAYER             $slider6104330, 0 }
    { END DECLARE                 $slider6104330 }

    { BEGIN DECLARE               $slider4432338 }
    declare ui_slider             $slider4432338(0,1000000)
    make_persistent              ($slider4432338)
    read_persistent_var          ($slider4432338)
    set_control_par_str(get_ui_id($slider4432338),$CONTROL_PAR_PICTURE,"flanger")
    set_control_par_str(get_ui_id($slider4432338),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider4432338),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider4432338),$CONTROL_PAR_AUTOMATION_NAME,"slider4432338")
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_WIDTH,96)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_HEIGHT,16)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_POS_X,243)
    set_control_par    (get_ui_id($slider4432338),$CONTROL_PAR_POS_Y,500)
    { PNG FILENAME                $slider4432338, "user/flanger.png" }
    { IS 3D                       $slider4432338, 0 }
    { 3D SHAPE                    $slider4432338, 1 }
    { 3D RADIUS                   $slider4432338, 1 }
    { 3D LENGTH                   $slider4432338, 1 }
    { BEGIN ACTION                $slider4432338 }
    { ACTION FILE                 $slider4432338, "N/A" }
    { END ACTION                  $slider4432338 }
    { GROUP MODE                  $slider4432338, 0 }
    { GROUP SINGLE                $slider4432338, 1 }
    { GROUP FROM                  $slider4432338, 1 }
    { GROUP TO                    $slider4432338, 1 }
    { RANDOMIZE LAYER             $slider4432338, 0 }
    { END DECLARE                 $slider4432338 }

    { BEGIN DECLARE               $slider6715904 }
    declare ui_slider             $slider6715904(0,1000000)
    make_persistent              ($slider6715904)
    read_persistent_var          ($slider6715904)
    set_control_par_str(get_ui_id($slider6715904),$CONTROL_PAR_PICTURE,"chorus")
    set_control_par_str(get_ui_id($slider6715904),$CONTROL_PAR_HELP,"")
    set_control_par_str(get_ui_id($slider6715904),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($slider6715904),$CONTROL_PAR_AUTOMATION_NAME,"slider6715904")
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_ALLOW_AUTOMATION,1)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_MIN_VALUE,0)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_MAX_VALUE,1000000)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_DEFAULT_VALUE,0)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_WIDTH,96)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_HEIGHT,16)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_POS_X,323)
    set_control_par    (get_ui_id($slider6715904),$CONTROL_PAR_POS_Y,500)
    { PNG FILENAME                $slider6715904, "user/chorus.png" }
    { IS 3D                       $slider6715904, 0 }
    { 3D SHAPE                    $slider6715904, 1 }
    { 3D RADIUS                   $slider6715904, 1 }
    { 3D LENGTH                   $slider6715904, 1 }
    { BEGIN ACTION                $slider6715904 }
    { ACTION FILE                 $slider6715904, "N/A" }
    { END ACTION                  $slider6715904 }
    { GROUP MODE                  $slider6715904, 0 }
    { GROUP SINGLE                $slider6715904, 1 }
    { GROUP FROM                  $slider6715904, 1 }
    { GROUP TO                    $slider6715904, 1 }
    { RANDOMIZE LAYER             $slider6715904, 0 }
    { END DECLARE                 $slider6715904 }
end on

{ BEGIN FUNCTIONS }
function randomize_layer_a
end function
function randomize_layer_b
end function
function randomize_layer_c
end function
function randomize_layer_d
end function
{ END FUNCTIONS }

{ BEGIN UI_CONTROL DEFINITIONS }
on ui_control ($slider5360027)
    $slider5360027_GRP_CURRENT := $slider5360027_GRP_BEGIN { $slider5360027 }
    while ($slider5360027_GRP_CURRENT < $slider5360027_GRP_END+1) { $slider5360027 }
    	$KGM_FX_QUERY := 0 { $slider5360027 }
    	while ($KGM_FX_QUERY < 8) { $slider5360027 }
    		if (get_engine_par($ENGINE_PAR_EFFECT_TYPE,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) = $EFFECT_TYPE_SEND_LEVELS) { $slider5360027 }
    			$KGM_SEND_QUERY := 0 { $slider5360027 }
    			while ($KGM_SEND_QUERY < 8) { $slider5360027 }
    				if (get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$KGM_SEND_QUERY,0) = $EFFECT_TYPE_REVERB) { $slider5360027 }
    					select($KGM_SEND_QUERY) { $slider5360027 }
    						case 0 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_0,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5360027 }
    						case 1 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_1,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider5360027 }
    						case 2 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_2,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5360027 }
    						case 3 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_3,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5360027 }
    						case 4 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_4,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5360027 }
    						case 5 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_5,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5360027 }
    						case 6 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_6,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5360027 }
    						case 7 { $slider5360027 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_7,$slider5360027,$slider5360027_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider5360027 }
    					end select { $slider5360027 }
    				end if { $slider5360027 }
    				inc($KGM_SEND_QUERY)								 { $slider5360027 }
    			end while { $slider5360027 }
    		end if		 { $slider5360027 }
    		inc($KGM_FX_QUERY)			 { $slider5360027 }
    	end while { $slider5360027 }
    	inc($slider5360027_GRP_CURRENT) { $slider5360027 }
    end while { $slider5360027 }
end on
on ui_control ($slider5089682)
    $slider5089682_GRP_CURRENT := $slider5089682_GRP_BEGIN { $slider5089682 }
    while ($slider5089682_GRP_CURRENT < $slider5089682_GRP_END+1) { $slider5089682 }
    	$KGM_FX_QUERY := 0 { $slider5089682 }
    	while ($KGM_FX_QUERY < 8) { $slider5089682 }
    		if (get_engine_par($ENGINE_PAR_EFFECT_TYPE,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) = $EFFECT_TYPE_SEND_LEVELS) { $slider5089682 }
    			$KGM_SEND_QUERY := 0 { $slider5089682 }
    			while ($KGM_SEND_QUERY < 8) { $slider5089682 }
    				if (get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$KGM_SEND_QUERY,0) = $EFFECT_TYPE_DELAY) { $slider5089682 }
    					select($KGM_SEND_QUERY) { $slider5089682 }
    						case 0 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_0,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5089682 }
    						case 1 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_1,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider5089682 }
    						case 2 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_2,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5089682 }
    						case 3 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_3,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5089682 }
    						case 4 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_4,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5089682 }
    						case 5 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_5,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5089682 }
    						case 6 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_6,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider5089682 }
    						case 7 { $slider5089682 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_7,$slider5089682,$slider5089682_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider5089682 }
    					end select { $slider5089682 }
    				end if { $slider5089682 }
    				inc($KGM_SEND_QUERY)								 { $slider5089682 }
    			end while { $slider5089682 }
    		end if		 { $slider5089682 }
    		inc($KGM_FX_QUERY)			 { $slider5089682 }
    	end while { $slider5089682 }
    	inc($slider5089682_GRP_CURRENT) { $slider5089682 }
    end while { $slider5089682 }
end on
on ui_control ($slider5091613)
    $slider5091613_GRP_CURRENT := $slider5091613_GRP_BEGIN { $slider5091613 }
    while ($slider5091613_GRP_CURRENT < $slider5091613_GRP_END+1) { $slider5091613 }
    	$KGM_FX_QUERY := 0 { $slider5091613 }
    	while ($KGM_FX_QUERY < 8) { $slider5091613 }
    		if (get_engine_par($ENGINE_PAR_EFFECT_TYPE,-1,$KGM_FX_QUERY,-1) = $EFFECT_TYPE_SEND_LEVELS) { $slider5091613 }
    			$KGM_SEND_QUERY := 0 { $slider5091613 }
    			while ($KGM_SEND_QUERY < 8) { $slider5091613 }
    				if (get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$KGM_SEND_QUERY,0) = $EFFECT_TYPE_PHASER) { $slider5091613 }
    					select($KGM_SEND_QUERY) { $slider5091613 }
    						case 0 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_0,$slider5091613,-1,$KGM_FX_QUERY,-1) { $slider5091613 }
    						case 1 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_1,$slider5091613,-1,$KGM_FX_QUERY,-1)							 { $slider5091613 }
    						case 2 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_2,$slider5091613,-1,$KGM_FX_QUERY,-1) { $slider5091613 }
    						case 3 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_3,$slider5091613,-1,$KGM_FX_QUERY,-1) { $slider5091613 }
    						case 4 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_4,$slider5091613,-1,$KGM_FX_QUERY,-1) { $slider5091613 }
    						case 5 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_5,$slider5091613,-1,$KGM_FX_QUERY,-1) { $slider5091613 }
    						case 6 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_6,$slider5091613,-1,$KGM_FX_QUERY,-1) { $slider5091613 }
    						case 7 { $slider5091613 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_7,$slider5091613,-1,$KGM_FX_QUERY,-1)							 { $slider5091613 }
    					end select { $slider5091613 }
    				end if { $slider5091613 }
    				inc($KGM_SEND_QUERY)								 { $slider5091613 }
    			end while { $slider5091613 }
    		end if		 { $slider5091613 }
    		inc($KGM_FX_QUERY)			 { $slider5091613 }
    	end while { $slider5091613 }
    	inc($slider5091613_GRP_CURRENT) { $slider5091613 }
    end while { $slider5091613 }
end on
on ui_control ($slider1135442)
    $slider1135442_GRP_CURRENT := $slider1135442_GRP_BEGIN { $slider1135442 }
    while ($slider1135442_GRP_CURRENT < $slider1135442_GRP_END+1) { $slider1135442 }
    	$KGM_FX_QUERY := 0 { $slider1135442 }
    	while ($KGM_FX_QUERY < 8) { $slider1135442 }
    		if (get_engine_par($ENGINE_PAR_EFFECT_TYPE,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) = $EFFECT_TYPE_SEND_LEVELS) { $slider1135442 }
    			$KGM_SEND_QUERY := 0 { $slider1135442 }
    			while ($KGM_SEND_QUERY < 8) { $slider1135442 }
    				if (get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$KGM_SEND_QUERY,0) = $EFFECT_TYPE_FLANGER) { $slider1135442 }
    					select($KGM_SEND_QUERY) { $slider1135442 }
    						case 0 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_0,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider1135442 }
    						case 1 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_1,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider1135442 }
    						case 2 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_2,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider1135442 }
    						case 3 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_3,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider1135442 }
    						case 4 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_4,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider1135442 }
    						case 5 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_5,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider1135442 }
    						case 6 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_6,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider1135442 }
    						case 7 { $slider1135442 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_7,$slider1135442,$slider1135442_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider1135442 }
    					end select { $slider1135442 }
    				end if { $slider1135442 }
    				inc($KGM_SEND_QUERY)								 { $slider1135442 }
    			end while { $slider1135442 }
    		end if		 { $slider1135442 }
    		inc($KGM_FX_QUERY)			 { $slider1135442 }
    	end while { $slider1135442 }
    	inc($slider1135442_GRP_CURRENT) { $slider1135442 }
    end while { $slider1135442 }
end on
on ui_control ($slider3036989)
    $slider3036989_GRP_CURRENT := $slider3036989_GRP_BEGIN { $slider3036989 }
    while ($slider3036989_GRP_CURRENT < $slider3036989_GRP_END+1) { $slider3036989 }
    	$KGM_FX_QUERY := 0 { $slider3036989 }
    	while ($KGM_FX_QUERY < 8) { $slider3036989 }
    		if (get_engine_par($ENGINE_PAR_EFFECT_TYPE,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) = $EFFECT_TYPE_SEND_LEVELS) { $slider3036989 }
    			$KGM_SEND_QUERY := 0 { $slider3036989 }
    			while ($KGM_SEND_QUERY < 8) { $slider3036989 }
    				if (get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$KGM_SEND_QUERY,0) = $EFFECT_TYPE_CHORUS) { $slider3036989 }
    					select($KGM_SEND_QUERY) { $slider3036989 }
    						case 0 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_0,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider3036989 }
    						case 1 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_1,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider3036989 }
    						case 2 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_2,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider3036989 }
    						case 3 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_3,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider3036989 }
    						case 4 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_4,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider3036989 }
    						case 5 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_5,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider3036989 }
    						case 6 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_6,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1) { $slider3036989 }
    						case 7 { $slider3036989 }
    							set_engine_par($ENGINE_PAR_SENDLEVEL_7,$slider3036989,$slider3036989_GRP_CURRENT,$KGM_FX_QUERY,-1)							 { $slider3036989 }
    					end select { $slider3036989 }
    				end if { $slider3036989 }
    				inc($KGM_SEND_QUERY)								 { $slider3036989 }
    			end while { $slider3036989 }
    		end if		 { $slider3036989 }
    		inc($KGM_FX_QUERY)			 { $slider3036989 }
    	end while { $slider3036989 }
    	inc($slider3036989_GRP_CURRENT) { $slider3036989 }
    end while { $slider3036989 }
end on
on ui_control ($slider3220047)
    { }
end on
on ui_control ($slider7183844)
    { }
end on
on ui_control ($slider6104330)
    { }
end on
on ui_control ($slider4432338)
    { }
end on
on ui_control ($slider6715904)
    { }
end on
{ END UI_CONTROL DEFINITIONS }

{ BEGIN ON LISTENER }
on listener
    if ($NI_SIGNAL_TYPE = $NI_SIGNAL_TIMER_MS)
        if ($KGM_ANIM_STEP < $KGM_ANIM_FRAMES_MAX)
            inc($KGM_ANIM_STEP)
        else
            $KGM_ANIM_STEP := 0
        end if
    end if
end on
{ END ON LISTENER }

