Questions on implementing XG Drum editor functionality #546
Replies: 1 comment
-
I found it difficult to understand the bit about the last note/key pressed, but you could record each noteOn in a table and build that table and later loop through the table to do what you want. Do that in in a midiReceived function: -- -- Called when a panel receives a midi message (does not need to match any modulator mask) -- @midi CtrlrMidiMessage object -- myMidiReceived = function(--[[ CtrlrMidiMessage --]] midi) local s = midi:getSize() if midi:getType() == 3 then -- it is note on (4) = note off local noteNumber = midi:getData():getByte(1) collectNotes[noteNumber] = true --console(midi:getData():toHexString(1)) end for k in pairs(collectNotes) do if k then --do something console("we registered " .. k) end end end collectNotes = {} Record Incoming Note On_1_0.zip
First set up a callback in each modulator that records that the modulator was changed: recordChange = function(--[[ CtrlrModulator --]] mod --[[ number --]], value --[[ number --]], source) if source ~= 4 then return end -- only activate if user changed value local nameOfMod = L(mod:getName()) recorder[nameOfMod] = true end recorder = {} -- CLICK BUTTON ON PANEL TO RUN CODE runCodeForchangedModulators = function(--[[ CtrlrComponent --]] comp --[[ MouseEvent --]], event) for k in pairs(recorder) do if k then local value = panel:getComponent(k):getValue() console(string.format("%q was changed to a value of \187 %d",k,value)) end end end Record which modulator was tampered with_1_0.zip Good luck with the QY700 - I nearly bought one once! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I've been working with ctrlr for a bit now and getting more comfortable with the tool, but implementing specific logic has been tricky when I can't find an existing example to reference, as I am not a highly experienced programmer.
My goal is to replicate the XG drum parameter editing behavior found on the Yamaha QY700, where triggering the sound by playing a MIDI note on the keyboard sets it as the actively edited drum sound. The method for setting which drum sound is to receive a parameter change is done via NRPN, where one of the bytes is the MIDI note number. Ideally this could correlate with a set of drum maps/kits, so depending on which drum kit is chosen/active, the name of the currently edited drum sound in the kit would also change, when the corresponding midi note/key press is registered.
AFAIK, the easiest way to do this, would be to store the last played note as a variable and place that at the correct position in the MIDI message strings for all relevant modulators, but I haven't been able to find an example for recognizing the last played note.
The secondary behavior I'd really like to implement, is a "value has been changed" list, so rather than dumping every possible parameter in the panel, or saving and managing them manually, a list is generated dynamically, as adjustments to certain sounds are made. So it would be possible to send or save only modified parameters.
Any insight or reference points for generating a list of parameters, based on whether a parameter has been changed would be super helpful, if this has been done elsewhere.
Thanks so much!
Beta Was this translation helpful? Give feedback.
All reactions