Reply To: Send whole page at once

Home Forums General Panels, Components, Macros Send whole page at once Reply To: Send whole page at once

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

    Hi leopard86,

    Many ways to do this, but for simple debugging and no error checking, create a multidimensional lua table of all the modulator names and their CC numbers:

    
    t={ -- global table
    lfo={cc=23,val=0},
    vcf={cc=8,val=0},
    vca={cc=26,val=0},
    A={cc=13,val=0},
    D={cc=14,val=0},
    S={cc=18,val=0},
    R={cc=20,val=0},
    }
    

    Create a single callback function attached to each control in the table:
    This will record the value to the table t{}.

    
    saveValue = function(mod,value,source)
    local name=L(mod:getName())
    t[name].val=value
    end
    

    Next create a mouse down callback function for a button, which on click will loop through the table and send each message in the table as CC:

    
    sendAll = function(comp,event)
        for k, v in pairs(t) do
            panel:sendMidiMessageNow(CtrlrMidiMessage({0xB0, v.cc, v.val})) -- just channel 1
            console(string.format("sent value for %s - %d [hex %.2x] using cc#%d", k, v.val, v.val, v.cc))
        end
    end
    

    Let me know if you need code for testing on different channels or see here how to do that https://ctrlr.org/forums/topic/novation-bass-station-2-panel/page/2/#post-119592

    See example panel attached

    Attachments:
    You must be logged in to view attached files.
    Ctrlr