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

Solved Controlling ui_knob with sustain pedal

Discussion in 'Scripting Workshop' started by leojarina, Jan 12, 2022.

  1. leojarina

    leojarina NI Product Owner

    Messages:
    77
    Hi guys,

    I have this short code I created that supposed to control a ui_knob using sustain pedal without midi learn method. Is this possible?

    Here's the code:

    Code:
    on init
    
    declare ui_knob $pedal(500000, 1000000, 1)
    set_knob_unit($pedal,$KNOB_UNIT_MS)
    declare $xyID
    $xyID := get_ui_id($pedal)
    
    declare $grp_idx
    $grp_idx := 0
    
    declare $env_idx
    $env_idx := find_mod(0,"ENV_AHDSR")
    
    set_control_par($xyID, $CONTROL_PAR_AUTOMATION_ID, 64)
    
    
    end on
    
    on ui_control ($pedal)
    
        set_engine_par($ENGINE_PAR_RELEASE,$pedal,$grp_idx,$env_idx,-1)
    
    end on
    
    
    
    Thanks in advanced!
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    $CONTROL_PAR_AUTOMATION_ID is host automation, not MIDI CC. You would need to use "on controller" callback.