Reply To: Need help with complex MIDI CC Expression

Home Forums General Programming Need help with complex MIDI CC Expression Reply To: Need help with complex MIDI CC Expression

#45298
Puppeteer
Participant
  • Topics: 16
  • Replies: 185
  • Total: 201
  • ★★

Never mind, I worked it out.

There’s probably a much better way of doing this, but this works

-- get the MIDI Channel from the panel and set ch to the hex representation of that
-- ready for transmitting as part of the MIDI message.
-- Will need to move this either to InitializePanel and/or to a method when MIDI Channel changes

ch = string.format("%x",L(panel:getPropertyString("panelMidiOutputChannelDevice")))

-- for debugging
-- console (ch)

if ch == "1" then
	Mch = 0xb0
elseif ch == "2" then
	Mch = 0xb1
elseif ch == "3" then
	Mch = 0xb2
elseif ch == "4" then
	Mch = 0xb3
elseif ch == "5" then
	Mch = 0xb4
elseif ch == "6" then
	Mch = 0xb5
elseif ch == "7" then
	Mch = 0xb6
elseif ch == "8" then
	Mch = 0xb7
elseif ch == "9" then
	Mch = 0xb8
elseif ch == "a" then
	Mch = 0xb9
elseif ch == "b" then
	Mch = 0xba
elseif ch == "c" then
	Mch = 0xbb
elseif ch == "d" then
	Mch = 0xbc
elseif ch == "e" then
	Mch = 0xbd
elseif ch == "f" then
	Mch = 0xbe
else 
	Mch = 0xbf
end -- if
-- Controller 1 Program
	m = CtrlrMidiMessage({Mch, 0x6e, 0x02})
	panel:sendMidiMessageNow(m)

-- Controller 2 Layer.  Get the layer from the AEnv1TLayer control	
	m = CtrlrMidiMessage({Mch, 0x6f, panel:getModulatorByName("AEnvA1TLayer"):getValue()})
	panel:sendMidiMessageNow(m)

The Puppeteer
http://godlike.com.au

Ctrlr