Collection of tools useful for audio production
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.

160 lines
4.0KB

  1. /*
  2. * Carla (frontend)
  3. * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the COPYING file
  16. */
  17. #ifndef SHARED_HPP
  18. #define SHARED_HPP
  19. #include "carla_backend.hpp"
  20. #include <QtCore/QString>
  21. #include <QtCore/QVector>
  22. #include <QtXml/QDomNode>
  23. CARLA_BACKEND_USE_NAMESPACE
  24. #define VERSION "0.5.0"
  25. // ------------------------------------------------------------------------------------------------
  26. // Carla Host object
  27. struct CarlaHostObject {
  28. void* host;
  29. void* gui;
  30. bool isControl;
  31. ProcessMode processMode;
  32. unsigned int maxParameters;
  33. CarlaHostObject()
  34. : host(nullptr),
  35. gui(nullptr),
  36. isControl(false),
  37. processMode(PROCESS_MODE_CONTINUOUS_RACK),
  38. maxParameters(MAX_PARAMETERS) {}
  39. };
  40. extern CarlaHostObject Carla;
  41. // ------------------------------------------------------------------------------------------------
  42. // Carla GUI stuff
  43. #define ICON_STATE_NULL 0
  44. #define ICON_STATE_WAIT 1
  45. #define ICON_STATE_OFF 2
  46. #define ICON_STATE_ON 3
  47. #define PALETTE_COLOR_NONE 0
  48. #define PALETTE_COLOR_WHITE 1
  49. #define PALETTE_COLOR_RED 2
  50. #define PALETTE_COLOR_GREEN 3
  51. #define PALETTE_COLOR_BLUE 4
  52. #define PALETTE_COLOR_YELLOW 5
  53. #define PALETTE_COLOR_ORANGE 6
  54. #define PALETTE_COLOR_BROWN 7
  55. #define PALETTE_COLOR_PINK 8
  56. struct CarlaStateParameter {
  57. uint32_t index;
  58. QString name;
  59. QString symbol;
  60. double value;
  61. uint8_t midiChannel;
  62. int16_t midiCC;
  63. CarlaStateParameter()
  64. : index(0),
  65. value(0.0),
  66. midiChannel(1),
  67. midiCC(-1) {}
  68. };
  69. struct CarlaStateCustomData {
  70. QString type;
  71. QString key;
  72. QString value;
  73. CarlaStateCustomData() {}
  74. };
  75. struct CarlaSaveState {
  76. QString type;
  77. QString name;
  78. QString label;
  79. QString binary;
  80. long uniqueID;
  81. bool active;
  82. double dryWet;
  83. double volume;
  84. double balanceLeft;
  85. double balanceRight;
  86. QVector<CarlaStateParameter> parameters;
  87. int32_t currentProgramIndex;
  88. QString currentProgramName;
  89. int32_t currentMidiBank;
  90. int32_t currentMidiProgram;
  91. QVector<CarlaStateCustomData> customData;
  92. QString chunk;
  93. CarlaSaveState()
  94. : uniqueID(0),
  95. active(false),
  96. dryWet(1.0),
  97. volume(1.0),
  98. balanceLeft(-1.0),
  99. balanceRight(1.0),
  100. currentProgramIndex(-1),
  101. currentMidiBank(-1),
  102. currentMidiProgram(-1) {}
  103. void reset()
  104. {
  105. type.clear();
  106. name.clear();
  107. label.clear();
  108. binary.clear();
  109. uniqueID = 0;
  110. active = false;
  111. dryWet = 1.0;
  112. volume = 1.0;
  113. balanceLeft = -1.0;
  114. balanceRight = 1.0;
  115. parameters.clear();
  116. currentProgramIndex = -1;
  117. currentProgramName.clear();
  118. currentMidiBank = -1;
  119. currentMidiProgram = -1;
  120. customData.clear();
  121. chunk.clear();
  122. }
  123. };
  124. // ------------------------------------------------------------------------------------------------------------
  125. // Carla XML helpers
  126. const CarlaSaveState* getSaveStateDictFromXML(const QDomNode& xmlNode);
  127. QString xmlSafeString(QString string, const bool toXml);
  128. // ------------------------------------------------------------------------------------------------------------
  129. // Plugin Query (helper functions)
  130. // needs free() afterwars if valid
  131. char* findDSSIGUI(const char* const filename, const char* const name, const char* const label);
  132. // ------------------------------------------------------------------------------------------------------------
  133. #endif // SHARED_HPP