Audio plugin host https://kx.studio/carla
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.

carla_shared.hpp 7.0KB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * Common Carla code
  3. * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or 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 doc/GPL.txt file.
  16. */
  17. #ifndef FRONTEND_CARLA_SHARED_HPP_INCLUDED
  18. #define FRONTEND_CARLA_SHARED_HPP_INCLUDED
  19. // ------------------------------------------------------------------------------------------------------------
  20. // Imports (Global)
  21. #include <QtGui/QIcon>
  22. #include <QtWidgets/QMessageBox>
  23. class QLineEdit;
  24. // ------------------------------------------------------------------------------------------------------------
  25. // Imports (Custom)
  26. #include "CarlaBackendUtils.hpp"
  27. // ------------------------------------------------------------------------------------------------------------
  28. // Set Version
  29. #define VERSION "1.9.4 (2.0-beta2)"
  30. // ------------------------------------------------------------------------------------------------------------
  31. // Set TMP
  32. extern QString TMP;
  33. // ------------------------------------------------------------------------------------------------------------
  34. // Set HOME
  35. extern QString HOME;
  36. // ------------------------------------------------------------------------------------------------------------
  37. // Set PATH
  38. extern QStringList PATH;
  39. // ------------------------------------------------------------------------------------------------------------
  40. // Static MIDI CC list
  41. extern QStringList MIDI_CC_LIST;
  42. // ------------------------------------------------------------------------------------------------------------
  43. // Carla Settings keys
  44. #define CARLA_KEY_MAIN_PROJECT_FOLDER "Main/ProjectFolder" // str
  45. #define CARLA_KEY_MAIN_USE_PRO_THEME "Main/UseProTheme" // bool
  46. #define CARLA_KEY_MAIN_PRO_THEME_COLOR "Main/ProThemeColor" // str
  47. #define CARLA_KEY_MAIN_REFRESH_INTERVAL "Main/RefreshInterval" // int
  48. #define CARLA_KEY_CANVAS_THEME "Canvas/Theme" // str
  49. #define CARLA_KEY_CANVAS_SIZE "Canvas/Size" // str "NxN"
  50. #define CARLA_KEY_CANVAS_USE_BEZIER_LINES "Canvas/UseBezierLines" // bool
  51. #define CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS "Canvas/AutoHideGroups" // bool
  52. #define CARLA_KEY_CANVAS_EYE_CANDY "Canvas/EyeCandy" // enum
  53. #define CARLA_KEY_CANVAS_USE_OPENGL "Canvas/UseOpenGL" // bool
  54. #define CARLA_KEY_CANVAS_ANTIALIASING "Canvas/Antialiasing" // enum
  55. #define CARLA_KEY_CANVAS_HQ_ANTIALIASING "Canvas/HQAntialiasing" // bool
  56. #define CARLA_KEY_CUSTOM_PAINTING "UseCustomPainting" // bool
  57. #define CARLA_KEY_ENGINE_DRIVER_PREFIX "Engine/Driver-"
  58. #define CARLA_KEY_ENGINE_AUDIO_DRIVER "Engine/AudioDriver" // str
  59. #define CARLA_KEY_ENGINE_PROCESS_MODE "Engine/ProcessMode" // enum
  60. #define CARLA_KEY_ENGINE_TRANSPORT_MODE "Engine/TransportMode" // enum
  61. #define CARLA_KEY_ENGINE_FORCE_STEREO "Engine/ForceStereo" // bool
  62. #define CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES "Engine/PreferPluginBridges" // bool
  63. #define CARLA_KEY_ENGINE_PREFER_UI_BRIDGES "Engine/PreferUiBridges" // bool
  64. #define CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP "Engine/UIsAlwaysOnTop" // bool
  65. #define CARLA_KEY_ENGINE_MAX_PARAMETERS "Engine/MaxParameters" // int
  66. #define CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT "Engine/UiBridgesTimeout" // int
  67. #define CARLA_KEY_PATHS_LADSPA "Paths/LADSPA"
  68. #define CARLA_KEY_PATHS_DSSI "Paths/DSSI"
  69. #define CARLA_KEY_PATHS_LV2 "Paths/LV2"
  70. #define CARLA_KEY_PATHS_VST "Paths/VST"
  71. #define CARLA_KEY_PATHS_VST3 "Paths/VST3"
  72. #define CARLA_KEY_PATHS_AU "Paths/AU"
  73. #define CARLA_KEY_PATHS_CSD "Paths/CSD"
  74. #define CARLA_KEY_PATHS_GIG "Paths/GIG"
  75. #define CARLA_KEY_PATHS_SF2 "Paths/SF2"
  76. #define CARLA_KEY_PATHS_SFZ "Paths/SFZ"
  77. // ------------------------------------------------------------------------------------------------------------
  78. // Global Carla object
  79. struct CarlaObject {
  80. // Host library object
  81. void* host;
  82. // Host Window
  83. void* gui;
  84. // is controller
  85. bool isControl;
  86. // is running local
  87. bool isLocal;
  88. // is plugin
  89. bool isPlugin;
  90. // current buffer size
  91. uint32_t bufferSize;
  92. // current sample rate
  93. double sampleRate;
  94. // current process mode
  95. EngineProcessMode processMode;
  96. // check if process mode is forced (rack/patchbay)
  97. bool processModeForced;
  98. // current transport mode
  99. EngineTransportMode transportMode;
  100. // current max parameters
  101. uint maxParameters;
  102. // binary dir
  103. QString pathBinaries;
  104. // resources dir
  105. QString pathResources;
  106. // default paths
  107. QStringList DEFAULT_LADSPA_PATH;
  108. QStringList DEFAULT_DSSI_PATH;
  109. QStringList DEFAULT_LV2_PATH;
  110. QStringList DEFAULT_VST_PATH;
  111. QStringList DEFAULT_VST3_PATH;
  112. QStringList DEFAULT_AU_PATH;
  113. QStringList DEFAULT_CSOUND_PATH;
  114. QStringList DEFAULT_GIG_PATH;
  115. QStringList DEFAULT_SF2_PATH;
  116. QStringList DEFAULT_SFZ_PATH;
  117. };
  118. extern CarlaObject gCarla;
  119. // ------------------------------------------------------------------------------------------------------------
  120. // find tool
  121. QString findTool(const QString& toolName);
  122. // ------------------------------------------------------------------------------------------------------------
  123. // Init host
  124. void initHost(const char* const initName, const char* const libPrefix = nullptr, bool failError = true);
  125. // ------------------------------------------------------------------------------------------------------------
  126. // Get Icon from user theme, using our own as backup (Oxygen)
  127. QIcon getIcon(const QString& icon, const int size = 16);
  128. // ------------------------------------------------------------------------------------------------------------
  129. // Signal handler
  130. void setUpSignals();
  131. // ------------------------------------------------------------------------------------------------------------
  132. // QLineEdit and QPushButton combo
  133. QString getAndSetPath(QWidget* const parent, const QString& currentPath, QLineEdit* const lineEdit);
  134. // ------------------------------------------------------------------------------------------------------------
  135. // Custom MessageBox
  136. int CustomMessageBox(QWidget* const parent, const QMessageBox::Icon icon, const QString& title, const QString& text, const QString& extraText = "",
  137. const QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No,
  138. const QMessageBox::StandardButton defButton = QMessageBox::No);
  139. // ------------------------------------------------------------------------------------------------------------
  140. #endif // FRONTEND_CARLA_SHARED_HPP_INCLUDED