distinct CC# mapping table if tabindex= #541
-
A continuation of my first panel based on solutions provided in thread:540, thanks to #dnaldoog and #damiensellier. My goal is to reuse/recycle a limited quantity of CC#'s by essentially enabling a new meta table based on if tabindex= Have been doing some [dr frankenstein] hacks by scraping from a few demos and og Ctrlr threads but have not achieved life... yet. My script compiles:"ok" and executes when on tab=0 but not on tab=1 ??? still a noob at this... I have over 407 Sysex messages, for RealTime midi modulation controls, to send but only 32 knobs ;) per preset on the BCR. My Ctrlr panel currently receives CC# 127 from the BCR in +1 or -1 increments to switch thru tabs and returns a Sysex to the BCR to switch presets. So yes I can achieve 480 knobs but limited to 127 CC's from the BCR. I am attempting to send only a few direct CC messages and mainly Sysex to stay inline with Stephen Kay's programming of KARMA midi algorithms on the synth's and software he created, to avoid further "translation" headaches when integrating a final Ctrlr panel in the mix. Peace |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 28 replies
-
Do you mean that instead of mapping one incoming CC message to one control, you want to map that incoming CC message to multiple controls on different tabs? For example, you might have LFO1,LFO2,LFO3,LFO4 etc needing to send out 4 messages back to the Korg? |
Beta Was this translation helpful? Give feedback.
-
This panel works! Code is changed and much more complex: myMidiReceived = function(--[[ CtrlrMidiMessage --]] midi) local s = midi:getSize() if midi:getType() == 0 then -- it is a CC message local number = midi:getData():getByte(1) local value = midi:getData():getByte(2) local cycle = mapping[number].groupof or 0 if cycle == 0 then return end for i = 1, cycle do local tmp_name = string.format("%s %d", mapping[number].name, i) _m(tmp_name):setModulatorValue(value, false, true, false) end end end meta = {} meta.__index = function(t, k) -- fallback value -- writes a value to a hidden modulator _c.d:setText(string.format("CC number #%d not mapped!", k)) t[k] = "nullbin" --utils.warnWindow("Error", "number not mapped to a control") -- comment this out to die silently return t[k] end mapping = { [23] = {name = "resonance", groupof = 12}, [36] = {name = "cutoff", groupof = 11} } setmetatable(mapping, meta) |
Beta Was this translation helpful? Give feedback.
-
So the central design question is "Do you want a single control on the external controller to change banks of controls with different names or will the names be all the same?
P.S. 1 and 2 will make things much much more complex. Remembering that increasing complexity will lead to increasing bugs! To enable/disable or hide/show a component depending on the CC coming in would require a separate coding routine. Probably would call a function from the table mapping for such things. |
Beta Was this translation helpful? Give feedback.
-
This panel only sends out sysex from the controls in currently selected tab only (from CC in). I think this is what you want? myMidiReceived = function(--[[ CtrlrMidiMessage --]] midi) local currentTab = tonumber(_c.MYBIGTAB:getProperty("uiTabsCurrentTab") + 1) -- tabs start at zero but uiSliders' names in this panel start at 1 - resonance 1 - 12 etc in tabs 0-11 local s = midi:getSize() if midi:getType() == 0 then -- it is a CC message local number = midi:getData():getByte(1) local value = midi:getData():getByte(2) -- a function is called to construct the name from uiCurrentTab local r = returnCcMappedControl(number, currentTab) _m(r):setModulatorValue(value, false, true, false) end end meta = {} meta.__index = function(t, k) -- fallback value -- writes a value to a hidden modulator _c.d:setText(string.format("CC number #%d not mapped!", k)) t[k] = "nullbin" return t[k] end mapping = { [23] = "resonance", [36] = "cutoff" } setmetatable(mapping, meta) returnCcMappedControl = function(num, tab) local name = mapping[num] if name == "nullbin" then return name else return string.format("%s %d", name, tab) end end |
Beta Was this translation helpful? Give feedback.
-
I've just very quickly knocked this one together. So not fully tested! In this panel there is no If you have a record in myMidiReceived = function(--[[ CtrlrMidiMessage --]] midi) local currentTab = tonumber(_c.MYBIGTAB:getProperty("uiTabsCurrentTab") + 1) -- tabs start at zero but uiSliders start at 1 local s = midi:getSize() if midi:getType() == 0 then -- it is a CC message local number = midi:getData():getByte(1) local value = midi:getData():getByte(2) local r = returnCcMappedControl(number, currentTab) _m(r):setModulatorValue(value, false, true, false) end end meta = {} meta.__index = function(t, k) -- fallback value in case a cc number comes in but there is no corresponding index in the table mapping -- writes a value to a hidden modulator _c.d:setText(string.format("CC number #%d not mapped!", k)) t[k] = "nullbin" return t[k] end mapping = { [0] = {n = "bankselect", multi = false, q = 1}, -- * MSB --[1] = {n = "mod", multi = false, q = 1}, -- * Joystick +Y-Y (up) --[4] = {n = "footcontroller", multi = false, q = 1}, -- * Foot Pedal function --[5] = {n = "portamentoT", multi = false, q = 1}, -- * Portamento Time --[6] = {n = "dataentry", multi = false, q = 1}, -- * MSB of RPN and NRPN data [7] = {n = "volume", multi = false, q = 1}, -- * Volume --[8] = {n = "postfxpan", multi = false, q = 1}, -- * Pan post FX insert --[10] = {n = "pan", multi = true, q = 12}, -- * Panpot [23] = {n = "resonance", multi = true, q = 12}, [36] = {n = "cutoff", multi = true, q = 11} } setmetatable(mapping, meta) returnCcMappedControl = function(num, tab) local name = mapping[num] if name == "nullbin" then return name elseif mapping[num].multi then if tab > mapping[num].q then return "nullbin" else return string.format("%s %d", name.n, tab) end else return name.n end end map cc to sysex_5_0_version 4 altered.zip EDIT: |
Beta Was this translation helpful? Give feedback.
-
In this version I tackle the problem of having separate controls in each tab. With this code you can put controls in any tab in any order as long as the name of the control suffix matches the myMidiReceived = function(--[[ CtrlrMidiMessage --]] midi) local currentTab = tonumber(_c.MYBIGTAB:getProperty("uiTabsCurrentTab")) local s = midi:getSize() if midi:getType() == 0 then -- it is a CC message local number = midi:getData():getByte(1) local value = midi:getData():getByte(2) local r = returnCcMappedControl(number, currentTab) _m(r):setModulatorValue(value, false, true, false) end end meta = {} meta.__index = function(t, k) -- fallback value in case a cc number comes in but there is no corresponding index in the table mapping -- writes a value to a hidden modulator _c.d:setText(string.format("CC number #%d not mapped!", k)) t[k] = "nullbin" return t[k] end mapping = { [0] = {n = "bankselect", multi = false, q = {nil}}, -- * MSB [7] = {n = "volume", multi = false, q = {nil}}, -- * Volume [21] = {n = "lfo delay", multi = true, q = {0}}, [23] = {n = "resonance", multi = true, q = {0,5,7,9,11}}, [36] = {n = "cutoff", multi = true, q = {0,1,2}} } setmetatable(mapping, meta) returnCcMappedControl = function(num, tab) local name = mapping[num] if name == "nullbin" then return name elseif mapping[num].multi then local found = false for i, v in ipairs(mapping[num].q) do if v == tab then found = true return string.format("%s %d", name.n, tab) end end if found == false then return "nullbin" end else return name.n end end |
Beta Was this translation helpful? Give feedback.
-
Just reading quickly in diagonal this long thread... didn't look in detail to the solution I would have done the following:
This is requiring just a few lines of code... |
Beta Was this translation helpful? Give feedback.
I've just very quickly knocked this one together. So not fully tested!
In this panel there is no
cutoff 12
but the panel doesn't crash. There are also single controlsbankselect
andvolume
so you can now do CC mapping for single controls as well as multiple controls with the same name in each tab, although as I said there is nocutoff 12
intab 11
. If the table keymulti
is set tofalse
the table keyq
is never accessed, but I just default it to1
.If you have a record in
mapping
but no corresponding Ctrlr object, the panel will crash.