1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

modulators by EvilDragon

Discussion in 'Scripting Workshop' started by plugaudio, Mar 18, 2011.

Thread Status:
Not open for further replies.
  1. plugaudio

    plugaudio Forum Member

    Messages:
    21
    hi EvilDragon

    thank you for your great help incl. tutorials
    I did find your approaching modulators tutorial somewhere ...
    but is it possible to sync LFO to tempo of the track ?


    may I ask you one more Q ?
    is it good approach to buttons based on ui_slider - to have custom graphic button ?


    on ui_control($knobFilteron)
    $F := get_engine_par($ENGINE_PAR_EFFECT_BYPASS,0,1,-1)
    if ($F = 1)
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS,($F-1) mod 2 ,0,1,-1)
    else
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS,($F-1) mod 2 ,0,1,-1)
    end if
    end on
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Syncing stuff to tempo is not the easiest stuff done with KSP, because of the simple reason that when you set a knob to tempo-sync mode, it CHANGES the engine parameter values for the same time division, depending on tempo! This is extremely tricky and convoluted way of going about it.

    Your other question - you don't need to use ui_sliders to skin buttons. ui_buttons and ui_switches can be skinned as well, you need to have a special image that consists of 6 states:

    off
    on
    off, mouse down
    on, mouse down
    off, mouse over
    on, mouse over

    And accompanying text file naturally. This is all explained in Kontakt Player Developer Guide.
     
  3. plugaudio

    plugaudio Forum Member

    Messages:
    21
    oh thanks ... I followed script in developer manual

    on init

    {--Set performance view attributes--}
    make_perfview
    set_ui_height_px(250)
    set_script_title("Example Script")

    {--Declare UI elements--}
    declare ui_slider $slider01 (0,100)
    declare ui_switch $switch01
    declare ui_label $label01 (1,1)
    declare ui_menu $menu01

    {--Place UI IDs in an Array--}
    declare %ui_id_array[4]
    %ui_id_array[0] := get_ui_id($slider01)
    %ui_id_array[1] := get_ui_id($switch01)
    %ui_id_array[2] := get_ui_id($label01)
    %ui_id_array[3] := get_ui_id($menu01)
    declare $count := 0

    while ($count < 4)

    set_control_par(%ui_id_array[$count],$CONTROL_PAR_POS_X,262)
    set_control_par(%ui_id_array[$count],$CONTROL_PAR_POS_Y,18+($count*50))
    set_control_par_str(%ui_id_array[$count],$CONTROL_PAR_TEXT,"")
    inc($count)
    end while

    end on


    works fine but
    when I added two lines at the end

    set_control_par_str(get_ui_id($slider01),$CONTROL_PAR_PICTURE,"pv_vintage_drums_knob")

    set_control_par_str(get_ui_id($switch01),$CONTROL_PAR_PICTURE,"pv_band_switch_slow_fast")


    slider looks fine but switch is not displayed in full how . why it happens ? and how to correct it ?
    switch picture and knob picture is taken directly from picture folder of kontakt. so the picture is not the point
    ---
    looks like I did it :)
    ok ?

    on init

    make_perfview

    declare $F

    declare ui_switch $switch_states
    move_control_px($switch_states,66,2)
    set_control_par (get_ui_id($switch_states),$CONTROL_PAR_HEIGHT,40)
    set_control_par_str(get_ui_id($switch_states),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($switch_states),$CONTROL_PAR_PICTURE,"pv_urban_switch")
    end on

    on ui_control ($switch_states)

    $F := get_engine_par($ENGINE_PAR_EFFECT_BYPASS,0,1,-1)
    if ($F = 1)
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS,($F-1) mod 2 ,0,1,-1)
    else
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS,($F-1) mod 2 ,0,1,-1)
    end if
    end on
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Please, use
    Code:
     tags, or paste code to www.pastebin.com in the future, this is a mess right now if you look at it :)
    
    
    Yep, for buttons you need to use $CONTROL_PAR_WIDTH and $CONTROL_PAR_HEIGHT since they're usually resizeable.
     
Thread Status:
Not open for further replies.