Panel Update LUA script

Home Forums General Programming Panel Update LUA script

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #380
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    I’ve got the midi example tweaked to work with my panel for most everything I have in there. There’s one aspect that is not updating properly and I’m having trouble figuring out why. The problem occurs when I attempt to update the FX settings. The Effects unit has several possible choices of which effect is enabled, but they all share the same generic value for the parameters. THE FX code here is the important part. Here’s the code I currently have :

    [code:12idefi7]
    function assignValues(midiMessage)
    console ("assignValues")
    programData = midiMessage:getLuaData():getRange(7,389)

    console ("RAW DATA: ")
    console (programData:toHexString(1))

    — Oscillator 1
    panel:getModulatorByName("Osc 1 Octave"):setModulatorValue(programData:getByte(1), false, true, true)
    panel:getModulatorByName("Osc 1 Semitone"):setModulatorValue(programData:getByte(2), false, true, true)
    panel:getModulatorByName("Osc 1 Detune"):setModulatorValue(programData:getByte(3), false, true, true)
    panel:getModulatorByName("Osc 1 Bend Range"):setModulatorValue(programData:getByte(4), false, true, true)

    — Edited for brevity

    — FX 1


    Need to program Effect Type value to "Enable" that effect based on this value.
    panel:getModulatorByName("FX 1 Mix"):setModulatorValue(programData:getByte(129), false, true, true)


    Assigns a variable for the 14 possible parameters used in effects
    effect1Param1 = programData:getByte(130)
    effect1Param2 = programData:getByte(131)
    effect1Param3 = programData:getByte(132)
    effect1Param4 = programData:getByte(133)
    effect1Param5 = programData:getByte(134)
    effect1Param6 = programData:getByte(135)
    effect1Param7 = programData:getByte(136)
    effect1Param8 = programData:getByte(137)
    effect1Param9 = programData:getByte(138)
    effect1Param10 = programData:getByte(139)
    effect1Param11 = programData:getByte(140)
    effect1Param12 = programData:getByte(141)
    effect1Param13 = programData:getByte(142)
    effect1Param14 = programData:getByte(143)

    fx1Type = programData:getByte(128)
    fx2Type = programData:getByte(144)
    console (string.format("FX 1 type byte value : %d", fx1Type)) — bug testing
    console (string.format("FX 2 type byte value : %d", fx2Type)) — bug testing
    console (string.format("Effect 1 Parameter 1 value : %d", effect1Param1)) — bug testing

    if fx1type == 0 then — all effects are bypassed, setting bypass buttons to ON
    panel:getModulatorByName("Chorus 1 Bypass"):setModulatorValue(1, false, true, true)
    panel:getModulatorByName("Flanger 1 Bypass"):setModulatorValue(1, false, true, true)
    panel:getModulatorByName("Phaser 1 Bypass"):setModulatorValue(1, false, true, true)
    panel:getModulatorByName("Overdrive 1 Bypass"):setModulatorValue(1, false, true, true)
    panel:getModulatorByName("Triple FX 1 Bypass"):setModulatorValue(1, false, true, true)

    elseif fx1type == 1 then
    panel:getModulatorByName("Chorus 1 Enable"):setModulatorValue(1, false, true, true)
    panel:getModulatorByName("Chorus 1 Bypass"):setModulatorValue(0, false, true, true)
    panel:getModulatorByName("Chorus 1 Speed"):setModulatorValue(effect1Param1, false, true, true)
    panel:getModulatorByName("Chorus 1 Depth"):setModulatorValue(effect1Param2, false, true, true)
    [/code:12idefi7]

    When I run this, I can see that the FX Type byte is correct, the parameter value for the effect is correct, except those modulators don’t get updated like the rest do. The code for Oscillator 1 works just fine, but not for effects. I’m guessing it’s something to do with the variables and assignments of those variables, but it looks like the values are what they’re supposed to be, the panel just doesn’t update for those. I get no errors from LUA indicating syntax problems or typos.

    #2978
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    Any ideas? Need more details?

    #2979
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    what type of components are thet (sliders, buttons?)

    #2980
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    Enable and Bypass are buttons, the parameters are mostly sliders except for a couple combo boxes. None of these get updated. There’s 5 different effects to select from on effects unit 1. The FX Type value (byte 128) determins which effect is enabled. 0 value is bypass, 1 Chorus, 2 Flanger, etc

    I can see that FX Type value is correct, so based on that, the If / Elseif statements determine which of the effects gets it’s modulator’s updated. I can also see that I’m getting the right value for the first parameter (effect1Param1), but for some reason when telling it to update the appropriate modulator, like :

    [code:a1wirk9f]
    elseif fx1type == 1 then
    panel:getModulatorByName("Chorus 1 Speed"):setModulatorValue(effect1Param1, false, true, true)
    [/code:a1wirk9f]

    it doesnt’ get updated. And I don’t get an error either indicating I spelled or named somethign wrong, or put in the some wrong syntax.

    #2981
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    well i can’t see any errors in there, i can suggest adding more console() stuff to see what actually gets executed and whats not.

    #2982
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    I think I see everything I can see in the console at that point. I have the effect type, the parameter setting, unless I can see something for the line where it goes to the panel and updates the modulator for :

    [code:15cpd6sp]panel:getModulatorByName("Chorus 1 Speed"):setModulatorValue(effect1Param1, false, true, true)[/code:15cpd6sp]

    #2983
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    well the best way is to do step by step
    [code:2rzslim3]
    mod = panel:getModulatorByName("whatever")
    if mod ~= nil then
    mod:setModulatorValue()
    end
    [/code:2rzslim3]

    can you send the panel ? maybe i can try to see what’s going on.

    #2984
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    I see what you’re doing there. I’ll try that and see what data I get. If it still looks right, I’ll link the bpanelz when I get home tonight.

    #2985
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    i just uploaded a new nightly build, there is an updated midi example that shows how to read and write programs to files, if you can please write one program to a file and attach that with your panel it will allow me to simulate receiving midi dumps on your panel.

    #2986
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    I found my problem after doing more values to console testing.

    my IF statements say fx1type instead of fx1Type …. :-p

    But since I have your attention, I’ll ask here. What would be the way to tell a Tab to display/select tab "Whatever" when value x is received?

    #2987
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    you can set it’s value just like any other component, the tabs are indexed from zero, so setting a value of 2 would switch to the 3 tab in a tabbed component

    #2988
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★

    So if I had Tab Group "Effects" and I wanted it to pop over to tab 2 of that group, it would just be something like :

    panel:getModulatorByName("Effects"):setModulatorValue(1, false, true, true)

    **edit**
    That doesn’t work. There’s no error b/c it’s valid, but it doesn’t display the Tab I’ve told it to select.

    #2989
    dasfaker
    Keymaster
    • Topics: 80
    • Replies: 793
    • Total: 873
    • ★★★

    Tabs still don’t receive midi, only send.

    #2990
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    i’ll check that asap, i thought i did that but i must have missed something.

    #2991
    Filch
    Participant
    • Topics: 22
    • Replies: 173
    • Total: 195
    • ★★
    "dasfaker":1l04l2l9 wrote:
    Tabs still don’t receive midi, only send.[/quote:1l04l2l9]

    That maybe the case, but I’m not sending the Tab any midi. I’m telling LUA in script to change to the tab I’ve specified based on the Tab index and it doesn’t do it.

    #2992
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    yes i found it, i missed one very important line of code, i added it and it works, i’ll re-do the builds asap.

Viewing 16 posts - 1 through 16 (of 16 total)
  • The forum ‘Programming’ is closed to new topics and replies.
There is currently 0 users and 69 guests online
No users are currently active
Forum Statistics
Threads: 2,495, Posts: 17,374, Members: 77,605
Most users ever online was 12 on January 22, 2019 3:47 pm
Ctrlr