Reply To: LUA Scripts in Positive Feedback Loop

Home Forums General Programming LUA Scripts in Positive Feedback Loop Reply To: LUA Scripts in Positive Feedback Loop

#118878
dnaldoog
Participant
    • Topics: 4
    • Replies: 480
    • Total: 484
    • ★★

    Hi Samoht – Not sure I follow, but the idea is to set up some sort of way to detect whether the user changed a value by moving the ‘dial’ or pressing a button or whether the uiSlider/uiButton etc is being modified by lua, for example an incoming midi message that updates the gui.

    So the idea is that the parameter ‘source’ passes in an integer value of 4 if the user moved the control, otherwise another number (usually 5?).

    Personally I have only used this method once, because I only discovered it towards the end of coding the last panel I did.

    What I usually do is have a ‘global’ variable that is initialised to let’s say blockMe=false on init (when the panel loads). When a midi message is received and processed by a function or another control changes the modulator, whose lua function we are trying to disable, that other function will temporarily ‘switch’ the global variable to blockMe=true so when the modulator you want to block is changed it won’t run the lua code it normally runs. So if you have at the beginning of the function you want to block a test if blockMe then return end the lua function you want to block will not run. You then need to make blockMe=false at the end of any function that temporarily writes blockMe=true. You can do this with timers as Goodweather points out, but this method should work in theory.

    If the modulator you want to block just sends MIDI via lua you could also try:

    panel:setPropertyInt("panelMidiPauseOut",1)

    and then

    panel:setPropertyInt("panelMidiPauseOut",0)

    in that modifying function.

    • This reply was modified 3 years, 10 months ago by dnaldoog.
    Ctrlr