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

Macro Knob with Linkable Controls

Discussion in 'Scripting Workshop' started by Kalen Smith, Sep 6, 2019.

  1. medusa

    medusa NI Product Owner

    Messages:
    239
    If you want the switches to be simple selection switches, and there are only two, then just change the above function to:

    Code:
    function toggle_switches(switch_1,switch_2)
    switch_1 := 1
    if (switch_1 = 1)
    switch_2 := 0
    end if
    end function

    If there are many possible switches to select, it'd be better to make an array of their ui_ids to cycle through.
     
  2. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Right all seems to be working. Just one thing: there's a little black box that's appearing in the top right hand corner on my main interface.
     

    Attached Files:

  3. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    That looks like ui_label or ui_button/ui_switch with a dark image assigned to it.
     
  4. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    From what I can tell both the label parts I'm using have no picture set to them, or they are hidden.
    set_control_par_str($label_id ,$CONTROL_PAR_TEXT,"")
    set_control_par_str($wallpaper,$CONTROL_PAR_TEXT,"")
    set_control_par_str($label_id,$CONTROL_PAR_PICTURE,"")
    set_control_par_str($wallpaper,$CONTROL_PAR_PICTURE,"")
     
  5. medusa

    medusa NI Product Owner

    Messages:
    239
    Write some text in the label, and you can check if that's the one. You need to use CONTROL_PAR_HIDE to hide a label.
     
  6. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    It fixed the black for the label but now the background no longer appears. The label variable is being used to change the background.
     
  7. medusa

    medusa NI Product Owner

    Messages:
    239
    A label variable is not used to change the background....
     
  8. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Right...it has worked fine for the other wallpapers without any trouble. I'm guessing I should be using set_skin_offset then? From what I understand that requires pasting all the images needed into one image.
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Well... it CAN be used that way for sure, if you design the UI around that and make the instrument header so that it looks fine no matter which page you're on.
     
  10. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Yes, this weird box only appears on one page out of 6. In the same script section I have one page that appears via button, and on that specific ui, there is no box. Odd I think.
     
  11. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Not much we can do here to help you. Debug your code, find out which control it is, see why it's behaving like that.
     
  12. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Of course. I'll figure it out. Just one more thing. I was trying to make a button that bypasses an effect. The only thing is that when it's on (so pressed) the effect is not bypassed, and when unpressed, the effect is bypassed. So essentially the opposite of a regular button.
    Here's the scripting I made for that, but it does not really seem to be working. The effect is located in group FX, very first slot.


    on ui_control($lowpass_enable)
    if ($lowpass_enable=1)
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS,$lowpass_enable,-1,0,-1)
    end if
    if ($lowpass_enable=0)
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS,$lowpass_enable,0,0,-1)
    end if
    end on
     
  13. medusa

    medusa NI Product Owner

    Messages:
    239
    Just subtract your switch from 1, so it's always opposite of the switch:
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1 - $lowpass_enable, 0,0,-1)
     
  14. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Thanks for the reply. It still does not seem to really be doing anything. In fact it does not bypass at all. Is the 1- for both ifs of the switch?
     
  15. medusa

    medusa NI Product Owner

    Messages:
    239
    Code:
    on ui_control (lowpassenable)
    set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1 -$lowpass_enable, 0, 0, -1)
    end on
    Don't use any ifs.
     
  16. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Ok I see. Honestly I think there seems to be a larger problem. None of the passes (low, high, band) seem to work, even when I'm directly modulating them in the effects slots engine. Maybe that's part of the reason why the bypass button won't work. It still does not work with the ifs.
    All the other effects are perfectly fine with their given controls.
    I have no idea or clue as to what the issue could be.
     
  17. medusa

    medusa NI Product Owner

    Messages:
    239
  18. Kalen Smith

    Kalen Smith NI Product Owner

    Messages:
    38
    Yes everything seems to fine on that front. The -1 up there was supposed to provide the same sort of functionality as the 1- lowpass-enable. What I'm getting at is that the lowpass does not work no matter what, even if I'm using its controls directly from the effects page in the Kontakt editor (and it is not bypassed). The filters are all located in the group FX section. Odd thing is, the distortion is in the group FX and works fine.
    When I load a lowpass filter into the instrument fx rack it seems to work. Uh....what is going on?