lppro: reorder x,y <-> note to put upper left at 0,0

This seems like more work than it should be
This commit is contained in:
Paul Davis
2023-08-19 22:37:03 -06:00
parent 8209cb0ab5
commit 1d1ba186b9

View File

@@ -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;
}
}