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.

292 lines
12KB

  1. /*
  2. * Carla widgets code
  3. * Copyright (C) 2011-2019 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. #include "carla_widgets.hpp"
  18. //---------------------------------------------------------------------------------------------------------------------
  19. // Imports (Global)
  20. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  21. # pragma GCC diagnostic push
  22. # pragma GCC diagnostic ignored "-Wconversion"
  23. # pragma GCC diagnostic ignored "-Weffc++"
  24. # pragma GCC diagnostic ignored "-Wsign-conversion"
  25. #endif
  26. //---------------------------------------------------------------------------------------------------------------------
  27. #include <QtWidgets/QDialog>
  28. //---------------------------------------------------------------------------------------------------------------------
  29. #include "ui_carla_about.hpp"
  30. #include "ui_carla_about_juce.hpp"
  31. #include "ui_carla_parameter.hpp"
  32. //---------------------------------------------------------------------------------------------------------------------
  33. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  34. # pragma GCC diagnostic pop
  35. #endif
  36. //---------------------------------------------------------------------------------------------------------------------
  37. // Imports (Custom)
  38. #include "carla_host.hpp"
  39. #include "CarlaHost.h"
  40. #include "CarlaUtils.h"
  41. // --------------------------------------------------------------------------------------------------------------------
  42. // Carla About dialog
  43. struct CarlaAboutW::PrivateData {
  44. Ui::CarlaAboutW ui;
  45. PrivateData(CarlaAboutW* const aboutWindow, const CarlaHost& host)
  46. : ui()
  47. {
  48. ui.setupUi(aboutWindow);
  49. QString extraInfo;
  50. if (host.isControl)
  51. extraInfo = QString(" - <b>%1</b>").arg(tr("OSC Bridge Version"));
  52. else if (host.isPlugin)
  53. extraInfo = QString(" - <b>%1</b>").arg(tr("Plugin Version"));
  54. ui.l_about->setText(tr("<br>Version %1"
  55. "<br>Carla is a fully-featured audio plugin host%2.<br>"
  56. "<br>Copyright (C) 2011-2019 falkTX<br>"
  57. "").arg(CARLA_VERSION_STRING).arg(extraInfo));
  58. if (ui.about->palette().color(QPalette::Background).blackF() < 0.5)
  59. {
  60. ui.l_icons->setPixmap(QPixmap(":/bitmaps/carla_about_black.png"));
  61. ui.ico_example_edit->setPixmap(QPixmap(":/bitmaps/button_file-black.png"));
  62. ui.ico_example_file->setPixmap(QPixmap(":/bitmaps/button_edit-black.png"));
  63. ui.ico_example_gui->setPixmap(QPixmap(":/bitmaps/button_gui-black.png"));
  64. }
  65. if (host.isControl)
  66. {
  67. ui.l_extended->hide();
  68. ui.tabWidget->removeTab(3);
  69. ui.tabWidget->removeTab(2);
  70. }
  71. ui.l_extended->setText(carla_get_complete_license_text());
  72. if (carla_is_engine_running(host.handle) && ! host.isControl)
  73. {
  74. ui.le_osc_url_tcp->setText(carla_get_host_osc_url_tcp(host.handle));
  75. ui.le_osc_url_udp->setText(carla_get_host_osc_url_udp(host.handle));
  76. }
  77. else
  78. {
  79. ui.le_osc_url_tcp->setText(tr("(Engine not running)"));
  80. ui.le_osc_url_udp->setText(tr("(Engine not running)"));
  81. }
  82. ui.l_osc_cmds->setText("<table>"
  83. "<tr><td>" "/set_active" "&nbsp;</td><td>&lt;i-value&gt;</td></tr>"
  84. "<tr><td>" "/set_drywet" "&nbsp;</td><td>&lt;f-value&gt;</td></tr>"
  85. "<tr><td>" "/set_volume" "&nbsp;</td><td>&lt;f-value&gt;</td></tr>"
  86. "<tr><td>" "/set_balance_left" "&nbsp;</td><td>&lt;f-value&gt;</td></tr>"
  87. "<tr><td>" "/set_balance_right" "&nbsp;</td><td>&lt;f-value&gt;</td></tr>"
  88. "<tr><td>" "/set_panning" "&nbsp;</td><td>&lt;f-value&gt;</td></tr>"
  89. "<tr><td>" "/set_parameter_value" "&nbsp;</td><td>&lt;i-index&gt; &lt;f-value&gt;</td></tr>"
  90. "<tr><td>" "/set_parameter_midi_cc" "&nbsp;</td><td>&lt;i-index&gt; &lt;i-cc&gt;</td></tr>"
  91. "<tr><td>" "/set_parameter_midi_channel" "&nbsp;</td><td>&lt;i-index&gt; &lt;i-channel&gt;</td></tr>"
  92. "<tr><td>" "/set_program" "&nbsp;</td><td>&lt;i-index&gt;</td></tr>"
  93. "<tr><td>" "/set_midi_program" "&nbsp;</td><td>&lt;i-index&gt;</td></tr>"
  94. "<tr><td>" "/note_on" "&nbsp;</td><td>&lt;i-channel&gt; &lt;i-note&gt; &lt;i-velo&gt;</td></tr>"
  95. "<tr><td>" "/note_off" "&nbsp;</td><td>&lt;i-channel&gt; &lt;i-note</td></tr>"
  96. "</table>");
  97. ui.l_example->setText("/Carla/2/set_parameter_value 5 1.0");
  98. ui.l_example_help->setText("<i>(as in this example, \"2\" is the plugin number and \"5\" the parameter)</i>");
  99. ui.l_ladspa->setText(tr("Everything! (Including LRDF)"));
  100. ui.l_dssi->setText(tr("Everything! (Including CustomData/Chunks)"));
  101. ui.l_lv2->setText(tr("About 110&#37; complete (using custom extensions)<br/>"
  102. "Implemented Feature/Extensions:"
  103. "<ul>"
  104. "<li>http://lv2plug.in/ns/ext/atom</li>"
  105. "<li>http://lv2plug.in/ns/ext/buf-size</li>"
  106. "<li>http://lv2plug.in/ns/ext/data-access</li>"
  107. // "<li>http://lv2plug.in/ns/ext/dynmanifest</li>"
  108. "<li>http://lv2plug.in/ns/ext/event</li>"
  109. "<li>http://lv2plug.in/ns/ext/instance-access</li>"
  110. "<li>http://lv2plug.in/ns/ext/log</li>"
  111. "<li>http://lv2plug.in/ns/ext/midi</li>"
  112. // "<li>http://lv2plug.in/ns/ext/morph</li>"
  113. "<li>http://lv2plug.in/ns/ext/options</li>"
  114. "<li>http://lv2plug.in/ns/ext/parameters</li>"
  115. // "<li>http://lv2plug.in/ns/ext/patch</li>"
  116. // "<li>http://lv2plug.in/ns/ext/port-groups</li>"
  117. "<li>http://lv2plug.in/ns/ext/port-props</li>"
  118. "<li>http://lv2plug.in/ns/ext/presets</li>"
  119. "<li>http://lv2plug.in/ns/ext/resize-port</li>"
  120. "<li>http://lv2plug.in/ns/ext/state</li>"
  121. "<li>http://lv2plug.in/ns/ext/time</li>"
  122. "<li>http://lv2plug.in/ns/ext/uri-map</li>"
  123. "<li>http://lv2plug.in/ns/ext/urid</li>"
  124. "<li>http://lv2plug.in/ns/ext/worker</li>"
  125. "<li>http://lv2plug.in/ns/extensions/ui</li>"
  126. "<li>http://lv2plug.in/ns/extensions/units</li>"
  127. "<li>http://home.gna.org/lv2dynparam/rtmempool/v1</li>"
  128. "<li>http://kxstudio.sf.net/ns/lv2ext/external-ui</li>"
  129. "<li>http://kxstudio.sf.net/ns/lv2ext/programs</li>"
  130. "<li>http://kxstudio.sf.net/ns/lv2ext/props</li>"
  131. "<li>http://kxstudio.sf.net/ns/lv2ext/rtmempool</li>"
  132. "<li>http://ll-plugins.nongnu.org/lv2/ext/midimap</li>"
  133. "<li>http://ll-plugins.nongnu.org/lv2/ext/miditype</li>"
  134. "</ul>"));
  135. #ifdef USING_JUCE
  136. ui.l_vst2->setText(tr("Using Juce host"));
  137. ui.l_vst3->setText(tr("Using Juce host"));
  138. #else
  139. ui.l_vst2->setText(tr("About 85% complete (missing vst bank/presets and some minor stuff)"));
  140. ui.line_vst2->hide();
  141. ui.l_vst3->hide();
  142. ui.lid_vst3->hide();
  143. #endif
  144. #ifdef CARLA_OS_MAC
  145. ui.l_au->setText(tr("Using Juce host"));
  146. #else
  147. ui.line_vst3->hide();
  148. ui.l_au->hide();
  149. ui.lid_au->hide();
  150. #endif
  151. // 3rd tab is usually longer than the 1st, adjust appropriately
  152. ui.tabWidget->setCurrentIndex(2);
  153. aboutWindow->adjustSize();
  154. ui.tabWidget->setCurrentIndex(0);
  155. }
  156. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData)
  157. };
  158. CarlaAboutW::CarlaAboutW(QWidget* parent, const CarlaHost& host)
  159. : QDialog(parent),
  160. self(new PrivateData(this, host))
  161. {
  162. setFixedSize(size());
  163. Qt::WindowFlags flags = windowFlags();
  164. flags &= ~Qt::WindowContextHelpButtonHint;
  165. #ifdef CARLA_OS_WIN
  166. flags |= Qt::MSWindowsFixedSizeDialogHint;
  167. #endif
  168. setWindowFlags(flags);
  169. }
  170. CarlaAboutW::~CarlaAboutW()
  171. {
  172. delete self;
  173. }
  174. // --------------------------------------------------------------------------------------------------------------------
  175. // JUCE About dialog
  176. struct JuceAboutW::PrivateData {
  177. Ui::JuceAboutW ui;
  178. PrivateData(JuceAboutW* const self)
  179. : ui()
  180. {
  181. ui.setupUi(self);
  182. ui.l_text2->setText(tr("This program uses JUCE version %1.").arg(carla_get_juce_version()));
  183. }
  184. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData)
  185. };
  186. JuceAboutW::JuceAboutW(QWidget* const parent)
  187. : QDialog(parent),
  188. self(new PrivateData(this))
  189. {
  190. adjustSize();
  191. setFixedSize(size());
  192. Qt::WindowFlags flags = windowFlags();
  193. flags &= ~Qt::WindowContextHelpButtonHint;
  194. #ifdef CARLA_OS_WIN
  195. flags |= Qt::MSWindowsFixedSizeDialogHint;
  196. #endif
  197. setWindowFlags(flags);
  198. }
  199. JuceAboutW::~JuceAboutW()
  200. {
  201. delete self;
  202. }
  203. // --------------------------------------------------------------------------------------------------------------------
  204. // Settings Dialog
  205. struct PluginParameter::PrivateData {
  206. Ui::PluginParameter ui;
  207. PrivateData(PluginParameter* const self, const CarlaHost& /*host*/)
  208. : ui()
  209. {
  210. ui.setupUi(self);
  211. }
  212. /*
  213. const char* _textCallBack()
  214. {
  215. return carla_get_parameter_text(fPluginId, fParameterId);
  216. }
  217. void _valueCallBack(const float value)
  218. {
  219. parameterWidget->valueChanged.emit(fParameterId, value);
  220. }
  221. */
  222. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData)
  223. };
  224. PluginParameter::PluginParameter(QWidget* const parent, const CarlaHost& host)
  225. : QWidget(parent),
  226. self(new PrivateData(this, host))
  227. {
  228. }
  229. PluginParameter::~PluginParameter()
  230. {
  231. delete self;
  232. }
  233. // --------------------------------------------------------------------------------------------------------------------
  234. void PluginParameter::slot_optionsCustomMenu()
  235. {
  236. }
  237. void PluginParameter::slot_parameterDragStateChanged(const bool /*touch*/)
  238. {
  239. }
  240. //---------------------------------------------------------------------------------------------------------------------