OK thanks for the idea. However, I’m using the midiMessageReceived method from the monstrum wave XL panel and parsing the whole sysex dump.
What I did come up with today for the buttons is this, thought I would post it just in case anyone else might find a use for it:
[code:2xhnvdux]
— Reacts to a switch being changed onscreen
function mySwitchOP1Sustain (modulator)
— get the bit to be modified
bit1 = modulator:getModulatorValue()
— get the state of the other bits to be modified
bit2 = panel:getModulatorByName("OP1-vibrato-on"):getModulatorValue()
bit3 = panel:getModulatorByName("OP1-tremolo-on"):getModulatorValue()
— roll the bits together (using as rangebecause no idea how to change int to boolean)
modToSend = CtrlrLuaBigInteger(0)
modToSend:setBitRangeAsInt(1,1,bit1)
modToSend:setBitRangeAsInt(2,1,bit2)
modToSend:setBitRangeAsInt(3,1,bit3)
modTSInt = modToSend:getBitRangeAsInt(0,4)
console(string.format ("modToSend as value = %s, TSInt= %d, as bits = %s",modToSend:toString(10,0),modTSInt,modToSend:toString(2,4)))
— create the SysEx message
m = CtrlrMidiMessage({0xF0, 0, 0, 0x7e, 0x49, 0, 0x06, 0, 0, 0x10, modTSInt, 0xF7})
panel:sendMidiMessageNow(m)
end
[/code:2xhnvdux]
Note: this is currently untested, but the MIDI output looks right so far ” title=”Smile” />
I’m still learning LUA, so if anyone can see something that could be improved I’m open to suggestions….
David