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

Function fader action for inserts fx

Discussion in 'Scripting Workshop' started by NI.Entuciasta, Feb 7, 2021.

  1. NI.Entuciasta

    NI.Entuciasta New Member

    Messages:
    8
    Hello I am building a new instrument and I have doubts, hopefully someone can help me.

    Code:
    function alien_fader_view
      $_countx := 0
      while ($_countx<num_elements(%alien_fader_id))
        if ($tab_btn__active=1)
          $_group := $active_key
          set_control_par(%alien_fader_id[$_countx],$CONTROL_PAR_VALUE,get_engine_par(%alien[$_countx],$_group,find_mod($_group,"STEP"),-1))
        end if
        inc($_countx)
      end while
      end function
    This code I did work pretty good I have different groups and I can make a call of the view from on_note and on ui_control, now the trick is if I want to assign the same function for an insert effect to get a different values on every active note , I have a note per group. this one above work pretty good to find a mods but how to find and insert fx?
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    There is no command to find an insert FX slot.
     
  3. NI.Entuciasta

    NI.Entuciasta New Member

    Messages:
    8
    thanks i realized there is no way to do anything similar after many tries and fail.

    I found a way and its controlling the mod for the reverb in the post ampfx slots but there is no effect on the reverb and now I am trying to see what I am missing o_O

    Code:
    {reverb send}
          declare %reverb[1]
          %reverb[0] := $ENGINE_PAR_INTMOD_INTENSITY
    
          declare !reverb_text[1]
          !reverb_text[0] := "%"
    
          declare %reverb_fader_id[1]
          declare %reverb_fader_label_id[1]
    
          declare ui_slider $reverb_fader1(500000,1000000)
          %reverb_fader_id[1-1] := get_ui_id($reverb_fader1)
          set_control_par_str(get_ui_id($reverb_fader1),$CONTROL_PAR_PICTURE,"f")
          set_control_par(get_ui_id($reverb_fader1),$CONTROL_PAR_MOUSE_BEHAVIOUR,-1000)
          set_control_par(get_ui_id($reverb_fader1),$CONTROL_PAR_DEFAULT_VALUE,500)
          set_control_par(get_ui_id($reverb_fader1),$CONTROL_PAR_POS_X,170)
          set_control_par(get_ui_id($reverb_fader1),$CONTROL_PAR_POS_Y,423)
          set_control_par_str(get_ui_id($reverb_fader1),$CONTROL_PAR_AUTOMATION_NAME,"Space Verb")
    
          declare ui_label $reverb_fader_label1(1, 1)
          %reverb_fader_label_id[1-1] := get_ui_id($reverb_fader_label1)
          set_text ($reverb_fader_label1," ")
          set_control_par(get_ui_id($reverb_fader_label1),$CONTROL_PAR_FONT_TYPE, 10)
          set_control_par(get_ui_id($reverb_fader_label1),$CONTROL_PAR_TEXT_ALIGNMENT,1)
          set_control_par(get_ui_id($reverb_fader_label1),$CONTROL_PAR_POS_X,150)
          set_control_par(get_ui_id($reverb_fader_label1),$CONTROL_PAR_POS_Y,453)
          set_control_par(get_ui_id($reverb_fader_label1),$CONTROL_PAR_HIDE,$HIDE_WHOLE_CONTROL)
    
    end on
    
    function reverb_fader_view
      $_count17 := 0
      while ($_count17<num_elements(%reverb_fader_id))
        if ($tab_btn__active=1)
          $_group := $active_key
          set_control_par(%reverb_fader_id[$_count17],$CONTROL_PAR_VALUE,get_engine_par(%reverb[$_count17],$_group,find_mod($_group,"CV_SEND_1"),-1))
        end if
        inc($_count17)
      end while
      end function
    
    function reverb_fader_action_alt
      $_knob_id3 := $arg1
      $_count18 := 0
      while ($_count18<$NUM_GROUPS)
        set_engine_par(%reverb[$_knob_id3],get_control_par(%reverb_fader_id[$_knob_id3],$CONTROL_PAR_VALUE),$_count18,find_mod($_count18,"CV_SEND_1"),-1)
        inc($_count18)
      end while
      end function
    
    function reverb_fader_action
      $_knob_id2 := $arg1
      set_engine_par(%reverb[$_knob_id2],get_control_par(%reverb_fader_id[$_knob_id2],$CONTROL_PAR_VALUE),$active_key,find_mod($active_key,"CV_SEND_1"),-1)
      end function
    
    function reverb_fader_label_action
      $_knob_id4 := $arg1
      @_text2 := get_engine_par_disp(%reverb[$_knob_id4],$active_key,find_mod($active_key,"CV_SEND_1"),-1) & !reverb_text[$_knob_id4]
      %_cb_id2[$_knob_id4] := $NI_CALLBACK_ID
      set_control_par_str(%reverb_fader_label_id[$_knob_id4],$CONTROL_PAR_TEXT,@_text2)
      set_control_par(%reverb_fader_label_id[$_knob_id4],$CONTROL_PAR_HIDE,$HIDE_PART_BG)
      wait(1500000)
      if (search(%_cb_id2,$NI_CALLBACK_ID) # -1)
        set_control_par(%reverb_fader_label_id[search(%_cb_id2,$NI_CALLBACK_ID)],$CONTROL_PAR_HIDE,$HIDE_WHOLE_CONTROL)
      end if
      end function
     
    on ui_control($reverb_fader1)
          $arg1 := search(%reverb_fader_id,get_ui_id($reverb_fader1))
          if (get_control_par(get_ui_id($reverb_fader1),$CONTROL_PAR_KEY_ALT)=1)
          call reverb_fader_action_alt
          else
          call reverb_fader_action
          end if
          call reverb_fader_label_action
          end on
    
     
    Last edited: Feb 8, 2021