You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8KB

  1. #include "TSOSCCommon.hpp"
  2. #include <string>
  3. // The OSC client labels/strings.
  4. std::string OSCClientStr[NUM_OSC_CLIENTS] = { "Generic", "touchOSC" };// , "Lemur" };
  5. std::string OSCClientAbbr[NUM_OSC_CLIENTS] = { "Gen", "tOSC" };// , "Lemr" };
  6. namespace touchOSC
  7. {
  8. // touchOSC color strings for our channels.
  9. // touchOSC brown or gray is like our Pink
  10. // touchOSC blue is like our cyan
  11. // touchOSC pink is like our purple kinda
  12. const char* ChannelColors[16] = {
  13. "red", // COLOR_TS_RED
  14. "orange", // COLOR_DARK_ORANGE
  15. "yellow", // COLOR_YELLOW
  16. "green", // COLOR_TS_GREEN
  17. "blue", // COLOR_CYAN
  18. "purple", // COLOR_TS_BLUE
  19. "pink", // COLOR_PURPLE
  20. "gray", // COLOR_PINK
  21. "red", // COLOR_TS_RED
  22. "orange", // COLOR_DARK_ORANGE
  23. "yellow", // COLOR_YELLOW
  24. "green", // COLOR_TS_GREEN
  25. "blue", // COLOR_CYAN
  26. "purple", // COLOR_TS_BLUE
  27. "pink", // COLOR_PURPLE
  28. "gray" // COLOR_PINK
  29. };
  30. // Convert the 1-based row, col from a touchOSC multi-push/multi-toggle grid control to a 0-based step index.
  31. int mcRowCol_to_stepIndex(/*in*/ int row, /*in*/ int col, /*in*/ int numRows, /*in*/ int numCols)
  32. {
  33. // In touchOSC, the rows are flipped (i.e. the top row is numRows and the bottom row is 1)
  34. // touchOSC row starts at 1, col starts at 1
  35. return (numRows - row) * numCols + (col - 1);
  36. }
  37. // Convert the 0-based step index to 1-based row, col from a touchOSC multi-push/multi-toggle grid control.
  38. void stepIndex_to_mcRowCol(/*in*/ int stepIx, /*in*/ int numRows, /*in*/ int numCols, /*out*/ int* row, /*out*/ int* col)
  39. {
  40. // In touchOSC, the rows are flipped (i.e. the top row is numRows and the bottom row is 1)
  41. // touchOSC row starts at 1, col starts at 1
  42. *row = numRows - stepIx / numCols; // Should yield 1 to numRows
  43. *col = stepIx % numCols + 1; // Should yield 1 to numCols
  44. return;
  45. }
  46. }