From 14ede7c27c03caed37c2fc83b558927266d3943d Mon Sep 17 00:00:00 2001 From: Jeremy Arnold <497595+jaggednz@users.noreply.github.com> Date: Tue, 22 Sep 2020 03:48:05 -0500 Subject: [PATCH 01/10] Only try to print debug for found devices, else will error on unkown midi interfaces --- lib/midigrid.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/midigrid.lua b/lib/midigrid.lua index 3292d24..01a1c3c 100644 --- a/lib/midigrid.lua +++ b/lib/midigrid.lua @@ -76,9 +76,11 @@ function midigrid._find_midigrid_devices() for _, dev in pairs(midi.devices) do found_device = supported_devices.find_midi_device_type(dev) - print("Dev" .. dev.id .." FD "..found_device) - if found_device then mounted_devices[dev.id] = found_device end + if found_device then + print("Dev" .. dev.id .." FD "..found_device) + mounted_devices[dev.id] = found_device + end end print("mounted_devices") From 52293f8c90d23621b225f2d608d2fd71884960cc Mon Sep 17 00:00:00 2001 From: Jeremy Arnold <497595+jaggednz@users.noreply.github.com> Date: Tue, 22 Sep 2020 03:49:00 -0500 Subject: [PATCH 02/10] debug? --- lib/vgrid.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vgrid.lua b/lib/vgrid.lua index b7c49b1..2eb6d10 100644 --- a/lib/vgrid.lua +++ b/lib/vgrid.lua @@ -129,7 +129,9 @@ function Vgrid:set_all(z) end function Vgrid:refresh(device_id) - for _,quad in pairs(self.quads) do + for qid,quad in pairs(self.quads) do + --print('vgrid refresh ' .. qid) + quad:freeze_updates() if device_id then From 591b19a33f93407abe3a66baefefa411b0026d07 Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Wed, 23 Sep 2020 21:27:08 +0100 Subject: [PATCH 03/10] Match on device when name matches "launchpad mini %d" --- lib/base.lua | 8 ++++++-- lib/supported_devices.lua | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/base.lua b/lib/base.lua index 7ef506e..7d1202a 100644 --- a/lib/base.lua +++ b/lib/base.lua @@ -24,10 +24,14 @@ function midigrid._find_midigrid_devices() --TODO should we use midi.vports? for _, dev in pairs(midi.devices) do local name = string.lower(dev.name) - for device, device_name in pairs(supported_devices) do + if name:find 'launchpad mini %d' then + table.insert(midi_devices, 'launchpadmini') + else + for device, device_name in pairs(supported_devices) do if name == device_name then table.insert(midi_devices, device) end + end end end @@ -143,4 +147,4 @@ function midigrid:rotation(rotate_to) -- rotate the grid? end -return midigrid \ No newline at end of file +return midigrid diff --git a/lib/supported_devices.lua b/lib/supported_devices.lua index 3fba8b1..8e5cb11 100644 --- a/lib/supported_devices.lua +++ b/lib/supported_devices.lua @@ -2,10 +2,11 @@ local supported_devices = { midi_devices = { { midi_base_name= 'launchpad', device_type='launchpad' }, { midi_base_name= 'launchpad mini', device_type='launchpad' }, - { midi_base_name= 'launchpad mini 2', device_type='launchpad' }, - { midi_base_name= 'apc mini', device_type='apc_mini' }, + { midi_base_name= 'apc mini', device_type='apc_mini' }, { midi_base_name= 'block 1', device_type='livid_block' }, ---[[ known devices to be implemented, help required! +--[[ Known devices to be implemented, help required! + Old launchpad mini's have user set hardware ID 1 - 16: + e.g. ID 4 appears as midi_device.name "Launchpad Mini 4" { midi_base_name= 'launchpad mk2 ? ', device_type='launchpadmk2' }, { midi_base_name= 'launchpad pro 2', device_type='launchpadpro2' }, { midi_base_name: 'launchpad mk3' device_type:'launchpadmk3' }, @@ -17,14 +18,18 @@ function supported_devices.find_midi_device_type(midi_device) print('finding device: ' .. midi_device.id .. " with name " .. midi_device.name) local sysex_ident_resp = nil -- TODO get response to sysex indentify call - local matched_device_type = nil - for _,device_def in pairs(supported_devices.midi_devices) do - if sysex_ident_resp and device_def.sysex_ident then - --TODO use General Sysex ident call to try and ID device + + if string.lower(midi_device.name):find 'launchpad mini %d' then + return 'launchpad' + else + for _,device_def in pairs(supported_devices.midi_devices) do + if sysex_ident_resp and device_def.sysex_ident then + --TODO use General Sysex ident call to try and ID device + end + -- Fall back to midi name matching + -- TODO strip / ignore device name suffix for multiple devices + if (device_def.midi_base_name == string.lower(midi_device.name)) then return device_def.device_type end end - -- Fall back to midi name matching - -- TODO strip / ignore device name suffix for multiple devices - if (device_def.midi_base_name == string.lower(midi_device.name)) then return device_def.device_type end end return nil end From 9e7ea549d8884d463d25f8564c9d238da14301d6 Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Wed, 23 Sep 2020 23:02:21 +0100 Subject: [PATCH 04/10] Add config for launchpad mini mk3 --- lib/devices/launchpad_minimk3.lua | 34 +++++++++++++++++++++++++++++++ lib/supported_devices.lua | 2 ++ 2 files changed, 36 insertions(+) create mode 100644 lib/devices/launchpad_minimk3.lua diff --git a/lib/devices/launchpad_minimk3.lua b/lib/devices/launchpad_minimk3.lua new file mode 100644 index 0000000..64450e2 --- /dev/null +++ b/lib/devices/launchpad_minimk3.lua @@ -0,0 +1,34 @@ +local launchpad = include('midigrid/lib/devices/generic_device') + +launchpad.grid_notes= { + {81,82,83,84,85,86,87,88}, + {71,72,73,74,75,76,77,78}, + {61,62,63,64,65,66,67,68}, + {51,52,53,54,55,56,57,58}, + {41,42,43,44,45,46,47,48}, + {31,32,33,34,35,36,37,38}, + {21,22,23,24,25,26,27,28}, + {11,12,13,14,15,16,17,18} +} + +launchpad.brightness_map = {0, + 15, + 11, + 125, + 117, + 14, + 99, + 118, + 2, + 97, + 97, + 115, + 119, + 119, + 3, + 3 +} + +launchpad.device_name = 'launchpad_minimk3' + +return launchpad diff --git a/lib/supported_devices.lua b/lib/supported_devices.lua index 8e5cb11..b752a6f 100644 --- a/lib/supported_devices.lua +++ b/lib/supported_devices.lua @@ -2,6 +2,8 @@ local supported_devices = { midi_devices = { { midi_base_name= 'launchpad', device_type='launchpad' }, { midi_base_name= 'launchpad mini', device_type='launchpad' }, + { midi_base_name= 'launchpad mini mk3 1', device_type='launchpad_minimk3' }, + { midi_base_name= 'launchpad mini mk3 2', device_type='launchpad_minimk3' }, { midi_base_name= 'apc mini', device_type='apc_mini' }, { midi_base_name= 'block 1', device_type='livid_block' }, --[[ Known devices to be implemented, help required! From 9359b412c1346ece000c51d6b8715f66ece54d3a Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Sat, 26 Sep 2020 11:29:31 +0100 Subject: [PATCH 05/10] Improve mini mk3 colour palette --- lib/devices/launchpad_minimk3.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/devices/launchpad_minimk3.lua b/lib/devices/launchpad_minimk3.lua index 64450e2..48fc530 100644 --- a/lib/devices/launchpad_minimk3.lua +++ b/lib/devices/launchpad_minimk3.lua @@ -12,21 +12,21 @@ launchpad.grid_notes= { } launchpad.brightness_map = {0, - 15, 11, + 100, 125, + 83, 117, 14, + 62, 99, 118, - 2, + 126, 97, - 97, - 115, - 119, - 119, - 3, - 3 + 109, + 13, + 12, + 119 } launchpad.device_name = 'launchpad_minimk3' From 73d36b846dfcc83380303c088f4c5be5e437005a Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Sat, 26 Sep 2020 15:02:20 +0100 Subject: [PATCH 06/10] Set base name for multiple LP mini mk3 devices --- lib/supported_devices.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/supported_devices.lua b/lib/supported_devices.lua index b752a6f..b814a72 100644 --- a/lib/supported_devices.lua +++ b/lib/supported_devices.lua @@ -2,8 +2,10 @@ local supported_devices = { midi_devices = { { midi_base_name= 'launchpad', device_type='launchpad' }, { midi_base_name= 'launchpad mini', device_type='launchpad' }, - { midi_base_name= 'launchpad mini mk3 1', device_type='launchpad_minimk3' }, { midi_base_name= 'launchpad mini mk3 2', device_type='launchpad_minimk3' }, + { midi_base_name= 'launchpad mini mk3 2 2', device_type='launchpad_minimk3' }, + { midi_base_name= 'launchpad mini mk3 2 3', device_type='launchpad_minimk3' }, + { midi_base_name= 'launchpad mini mk3 2 4', device_type='launchpad_minimk3' }, { midi_base_name= 'apc mini', device_type='apc_mini' }, { midi_base_name= 'block 1', device_type='livid_block' }, --[[ Known devices to be implemented, help required! From e236cab296aa79df11dda66652f1ccb8a3d99153 Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Sat, 26 Sep 2020 19:18:08 +0100 Subject: [PATCH 07/10] Rotate second LP mini mk3 grid --- lib/devices/launchpad_minimk3_128.lua | 12 ++++++++++++ lib/supported_devices.lua | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 lib/devices/launchpad_minimk3_128.lua diff --git a/lib/devices/launchpad_minimk3_128.lua b/lib/devices/launchpad_minimk3_128.lua new file mode 100644 index 0000000..4be530b --- /dev/null +++ b/lib/devices/launchpad_minimk3_128.lua @@ -0,0 +1,12 @@ +local launchpad = include('midigrid/lib/devices/launchpad_minimk3') + +launchpad.grid_notes= { + {88,78,68,58,48,38,28,18}, + {87,77,67,57,47,37,27,17}, + {86,76,66,56,46,36,26,16}, + {85,75,65,55,45,35,25,15}, + {84,74,64,54,44,34,24,14}, + {83,73,63,53,43,33,23,13}, + {82,72,62,52,42,32,22,12}, + {81,71,61,51,41,31,21,11} +} diff --git a/lib/supported_devices.lua b/lib/supported_devices.lua index b814a72..4ae07ba 100644 --- a/lib/supported_devices.lua +++ b/lib/supported_devices.lua @@ -3,9 +3,7 @@ local supported_devices = { { midi_base_name= 'launchpad', device_type='launchpad' }, { midi_base_name= 'launchpad mini', device_type='launchpad' }, { midi_base_name= 'launchpad mini mk3 2', device_type='launchpad_minimk3' }, - { midi_base_name= 'launchpad mini mk3 2 2', device_type='launchpad_minimk3' }, - { midi_base_name= 'launchpad mini mk3 2 3', device_type='launchpad_minimk3' }, - { midi_base_name= 'launchpad mini mk3 2 4', device_type='launchpad_minimk3' }, + { midi_base_name= 'launchpad mini mk3 2 2', device_type='launchpad_minimk3_128' }, { midi_base_name= 'apc mini', device_type='apc_mini' }, { midi_base_name= 'block 1', device_type='livid_block' }, --[[ Known devices to be implemented, help required! From 9f7b4d015a99984402d2db0a303aeb1d41dd43a9 Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Sun, 27 Sep 2020 08:04:01 +0100 Subject: [PATCH 08/10] Fix 2nd LP mini mk3 config --- lib/devices/launchpad_minimk3_128.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/devices/launchpad_minimk3_128.lua b/lib/devices/launchpad_minimk3_128.lua index 4be530b..1285033 100644 --- a/lib/devices/launchpad_minimk3_128.lua +++ b/lib/devices/launchpad_minimk3_128.lua @@ -10,3 +10,7 @@ launchpad.grid_notes= { {82,72,62,52,42,32,22,12}, {81,71,61,51,41,31,21,11} } + +launchpad.device_name = 'launchpad_minimk3_128' + +return launchpad From f21ba6fa46ef9be2f0199166be3da5c4e77dc558 Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Sun, 27 Sep 2020 09:47:17 +0100 Subject: [PATCH 09/10] Add LP mini mk3 auxcol/auxrow configuration --- lib/devices/launchpad_minimk3.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/devices/launchpad_minimk3.lua b/lib/devices/launchpad_minimk3.lua index 48fc530..234ba91 100644 --- a/lib/devices/launchpad_minimk3.lua +++ b/lib/devices/launchpad_minimk3.lua @@ -1,5 +1,13 @@ local launchpad = include('midigrid/lib/devices/generic_device') +--these are LP keys to the sides of our grid +--not necessary for strict grid emulation but handy! +--they are up to down, so 89 is the auxkey to row 1 +launchpad.auxcol = {89,79,69,59,49,39,29,19} + +--left to right, 91 is aux key to column 1 +launchpad.auxrow = {91,92,93,94,95,96,97,98,99} + launchpad.grid_notes= { {81,82,83,84,85,86,87,88}, {71,72,73,74,75,76,77,78}, From 06d0ae3cb16a5c093ce59f59da866b516853042c Mon Sep 17 00:00:00 2001 From: robmckinnon Date: Sun, 27 Sep 2020 10:00:18 +0100 Subject: [PATCH 10/10] Configure LP mini mk3 quad_leds auxrow/auxcol keys --- lib/devices/launchpad_minimk3.lua | 3 ++- lib/devices/launchpad_minimk3_128.lua | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/devices/launchpad_minimk3.lua b/lib/devices/launchpad_minimk3.lua index 234ba91..2bb5534 100644 --- a/lib/devices/launchpad_minimk3.lua +++ b/lib/devices/launchpad_minimk3.lua @@ -6,7 +6,8 @@ local launchpad = include('midigrid/lib/devices/generic_device') launchpad.auxcol = {89,79,69,59,49,39,29,19} --left to right, 91 is aux key to column 1 -launchpad.auxrow = {91,92,93,94,95,96,97,98,99} +launchpad.auxrow = {91,92,93,94,95,96,97,98} +launchpad.quad_leds = {notes = {91,92,93,94}} launchpad.grid_notes= { {81,82,83,84,85,86,87,88}, diff --git a/lib/devices/launchpad_minimk3_128.lua b/lib/devices/launchpad_minimk3_128.lua index 1285033..ed40e2b 100644 --- a/lib/devices/launchpad_minimk3_128.lua +++ b/lib/devices/launchpad_minimk3_128.lua @@ -1,5 +1,14 @@ local launchpad = include('midigrid/lib/devices/launchpad_minimk3') +--Rotate the second LP, by transposing the grid notes. + +--they are up to down, so 98 is the auxkey to row 1 +launchpad.auxcol = {98,97,96,95,94,93,92,91} + +--left to right, 89 is aux key to column 1 +launchpad.auxrow = {89,79,69,59,49,39,29,19} +launchpad.quad_leds = {notes = {89,79,69,59}} + launchpad.grid_notes= { {88,78,68,58,48,38,28,18}, {87,77,67,57,47,37,27,17},