From 1d1ba186b99cfc2eaa598b7bba5bf529f44de286 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 19 Aug 2023 22:37:03 -0600 Subject: [PATCH] lppro: reorder x,y <-> note to put upper left at 0,0 This seems like more work than it should be --- libs/surfaces/launchpad_pro/lppro.cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libs/surfaces/launchpad_pro/lppro.cc b/libs/surfaces/launchpad_pro/lppro.cc index 0238f9eb48..104514d254 100644 --- a/libs/surfaces/launchpad_pro/lppro.cc +++ b/libs/surfaces/launchpad_pro/lppro.cc @@ -701,16 +701,16 @@ LaunchPadPro::build_layout_maps () { static const XY_Note_Map maps[] = { { /* Session */ - { 0xb, 0xc, 0xe, 0xd, 0xf, 0x10, 0x11, 0x12 }, - { 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c }, - { 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 }, - { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30 }, - { 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a }, - { 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44 }, + { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58 }, { 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e }, - { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58 } + { 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44 }, + { 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a }, + { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30 }, + { 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 }, + { 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c }, + { 0xb, 0xc, 0xe, 0xd, 0xf, 0x10, 0x11, 0x12 } }, - +#if 0 { /* Fader */ { 0x0, 0x15, 0x2a, 0x3f, 0x40, 0x55, 0x6a, 0x7f }, { 0x0, 0x15, 0x2a, 0x3f, 0x40, 0x55, 0x6a, 0x7f }, @@ -783,26 +783,30 @@ LaunchPadPro::build_layout_maps () { /* CustomSettings */ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } +#endif }; - const size_t num_layouts = sizeof (AllLayouts) / sizeof (AllLayouts[0]); + const size_t num_layouts = sizeof (maps) / sizeof (maps[0]); + std::cerr << "We got " << num_layouts << " layouts\n"; layout_xy_note_map.resize (num_layouts * 64); - for (auto const layout : AllLayouts) { + for (size_t layout = 0; layout < num_layouts; ++layout) { for (int row = 0; row < 8; ++row) { for (int col = 0; col < 8; ++col) { layout_xy_note_map[xy_note_index (layout, col, row)] = maps[layout][row][col]; + // std::cerr << "IN col " << col << " row " << row << " note 0x" << std::hex << maps[layout][row][col] << std::dec << std::endl; } } } layout_note_xy_map.resize (128 * num_layouts); - for (auto const layout : AllLayouts) { + for (size_t layout = 0; layout < num_layouts; ++layout) { for (int row = 0; row < 8; ++row) { for (int col = 0; col < 8; ++col) { const int note = layout_xy_note_map[xy_note_index (layout, col, row)]; + std::cerr << "OUT layout " << layout << " col " << col << " row " << row << " note " << note << std::endl; layout_note_xy_map[note_xy_index(layout,note)] = row*8 + col; } }