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.

ZaMultiCompUI.cpp 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. /*
  2. * ZaMultiComp mono multiband compressor
  3. * Copyright (C) 2014 Damien Zammit <damien@zamaudio.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 "ZaMultiCompPlugin.hpp"
  18. #include "ZaMultiCompUI.hpp"
  19. using DGL::Point;
  20. START_NAMESPACE_DISTRHO
  21. // -----------------------------------------------------------------------
  22. ZaMultiCompUI::ZaMultiCompUI()
  23. : UI()
  24. {
  25. // background
  26. fImgBackground = Image(ZaMultiCompArtwork::zamulticompData, ZaMultiCompArtwork::zamulticompWidth, ZaMultiCompArtwork::zamulticompHeight, GL_BGR);
  27. // led images
  28. fLedRedImg = Image(ZaMultiCompArtwork::ledredData, ZaMultiCompArtwork::ledredWidth, ZaMultiCompArtwork::ledredHeight);
  29. fLedYellowImg = Image(ZaMultiCompArtwork::ledyellowData, ZaMultiCompArtwork::ledyellowWidth, ZaMultiCompArtwork::ledyellowHeight);
  30. // led values
  31. fLedRedValue1 = 0.0f;
  32. fLedRedValue2 = 0.0f;
  33. fLedRedValue3 = 0.0f;
  34. fLedYellowValue = 0.0f;
  35. // knob
  36. Image knobImage(ZaMultiCompArtwork::knobData, ZaMultiCompArtwork::knobWidth, ZaMultiCompArtwork::knobHeight);
  37. // knob
  38. fKnobAttack = new ImageKnob(this, knobImage);
  39. fKnobAttack->setAbsolutePos(24, 43);
  40. fKnobAttack->setRange(0.1f, 200.0f);
  41. fKnobAttack->setStep(0.1f);
  42. fKnobAttack->setUsingLogScale(true);
  43. fKnobAttack->setDefault(10.0f);
  44. fKnobAttack->setRotationAngle(240);
  45. fKnobAttack->setCallback(this);
  46. fKnobRelease = new ImageKnob(this, knobImage);
  47. fKnobRelease->setAbsolutePos(108, 43);
  48. fKnobRelease->setRange(50.0f, 500.0f);
  49. fKnobRelease->setStep(1.0f);
  50. fKnobRelease->setDefault(80.0f);
  51. fKnobRelease->setRotationAngle(240);
  52. fKnobRelease->setCallback(this);
  53. fKnobThresh = new ImageKnob(this, knobImage);
  54. fKnobThresh->setAbsolutePos(191.5, 43);
  55. fKnobThresh->setRange(-60.0f, 0.0f);
  56. fKnobThresh->setStep(1.0f);
  57. fKnobThresh->setDefault(0.0f);
  58. fKnobThresh->setRotationAngle(240);
  59. fKnobThresh->setCallback(this);
  60. fKnobRatio = new ImageKnob(this, knobImage);
  61. fKnobRatio->setAbsolutePos(270, 43);
  62. fKnobRatio->setRange(1.0f, 20.0f);
  63. fKnobRatio->setStep(0.1f);
  64. fKnobRatio->setDefault(4.0f);
  65. fKnobRatio->setRotationAngle(240);
  66. fKnobRatio->setCallback(this);
  67. fKnobKnee = new ImageKnob(this, knobImage);
  68. fKnobKnee->setAbsolutePos(348.5, 43);
  69. fKnobKnee->setRange(0.0f, 8.0f);
  70. fKnobKnee->setStep(0.1f);
  71. fKnobKnee->setDefault(0.0f);
  72. fKnobKnee->setRotationAngle(240);
  73. fKnobKnee->setCallback(this);
  74. fKnobGlobalGain = new ImageKnob(this, knobImage);
  75. fKnobGlobalGain->setAbsolutePos(427.3, 43);
  76. fKnobGlobalGain->setRange(-30.0f, 30.0f);
  77. fKnobGlobalGain->setStep(1.0f);
  78. fKnobGlobalGain->setDefault(0.0f);
  79. fKnobGlobalGain->setRotationAngle(240);
  80. fKnobGlobalGain->setCallback(this);
  81. fKnobXover2 = new ImageKnob(this, knobImage);
  82. fKnobXover2->setAbsolutePos(84, 121);
  83. fKnobXover2->setRange(1400.f, 14000.f);
  84. fKnobXover2->setStep(1.0f);
  85. fKnobXover2->setUsingLogScale(true);
  86. fKnobXover2->setDefault(1400.f);
  87. fKnobXover2->setRotationAngle(240);
  88. fKnobXover2->setCallback(this);
  89. fKnobXover1 = new ImageKnob(this, knobImage);
  90. fKnobXover1->setAbsolutePos(84, 176);
  91. fKnobXover1->setRange(20.0f, 1400.0f);
  92. fKnobXover1->setStep(1.0f);
  93. fKnobXover1->setUsingLogScale(true);
  94. fKnobXover1->setDefault(250.0f);
  95. fKnobXover1->setRotationAngle(240);
  96. fKnobXover1->setCallback(this);
  97. fKnobMakeup3 = new ImageKnob(this, knobImage);
  98. fKnobMakeup3->setAbsolutePos(167.75, 99.5);
  99. fKnobMakeup3->setRange(0.0f, 30.0f);
  100. fKnobMakeup3->setStep(0.1f);
  101. fKnobMakeup3->setDefault(0.0f);
  102. fKnobMakeup3->setRotationAngle(240);
  103. fKnobMakeup3->setCallback(this);
  104. fKnobMakeup2 = new ImageKnob(this, knobImage);
  105. fKnobMakeup2->setAbsolutePos(167.75, 150.25);
  106. fKnobMakeup2->setRange(0.0f, 30.0f);
  107. fKnobMakeup2->setStep(0.1f);
  108. fKnobMakeup2->setDefault(0.0f);
  109. fKnobMakeup2->setRotationAngle(240);
  110. fKnobMakeup2->setCallback(this);
  111. fKnobMakeup1 = new ImageKnob(this, knobImage);
  112. fKnobMakeup1->setAbsolutePos(167.75, 201.4);
  113. fKnobMakeup1->setRange(0.0f, 30.0f);
  114. fKnobMakeup1->setStep(0.1f);
  115. fKnobMakeup1->setDefault(0.0f);
  116. fKnobMakeup1->setRotationAngle(240);
  117. fKnobMakeup1->setCallback(this);
  118. Image toggleonImage(ZaMultiCompArtwork::toggleonData, ZaMultiCompArtwork::toggleonWidth, ZaMultiCompArtwork::toggleonHeight);
  119. Image toggleoffImage(ZaMultiCompArtwork::toggleoffData, ZaMultiCompArtwork::toggleoffWidth, ZaMultiCompArtwork::toggleoffHeight);
  120. Image toggleonhImage(ZaMultiCompArtwork::toggleonhorizData, ZaMultiCompArtwork::toggleonhorizWidth, ZaMultiCompArtwork::toggleonhorizHeight);
  121. Image toggleoffhImage(ZaMultiCompArtwork::toggleoffhorizData, ZaMultiCompArtwork::toggleoffhorizWidth, ZaMultiCompArtwork::toggleoffhorizHeight);
  122. Point<int> togglePosStart(247,109);
  123. fToggleBypass3 = new ImageToggle(this, toggleoffImage, toggleonImage);
  124. fToggleBypass3->setAbsolutePos(togglePosStart);
  125. fToggleBypass3->setCallback(this);
  126. togglePosStart.setY(158);
  127. fToggleBypass2 = new ImageToggle(this, toggleoffImage, toggleonImage);
  128. fToggleBypass2->setAbsolutePos(togglePosStart);
  129. fToggleBypass2->setCallback(this);
  130. togglePosStart.setY(209);
  131. fToggleBypass1 = new ImageToggle(this, toggleoffImage, toggleonImage);
  132. fToggleBypass1->setAbsolutePos(togglePosStart);
  133. fToggleBypass1->setCallback(this);
  134. togglePosStart.setX(278);
  135. togglePosStart.setY(113);
  136. fToggleListen3 = new ImageToggle(this, toggleoffhImage, toggleonhImage);
  137. fToggleListen3->setAbsolutePos(togglePosStart);
  138. fToggleListen3->setCallback(this);
  139. togglePosStart.setY(164);
  140. fToggleListen2 = new ImageToggle(this, toggleoffhImage, toggleonhImage);
  141. fToggleListen2->setAbsolutePos(togglePosStart);
  142. fToggleListen2->setCallback(this);
  143. togglePosStart.setY(214);
  144. fToggleListen1 = new ImageToggle(this, toggleoffhImage, toggleonhImage);
  145. fToggleListen1->setAbsolutePos(togglePosStart);
  146. fToggleListen1->setCallback(this);
  147. // set default values
  148. d_programChanged(0);
  149. }
  150. // -----------------------------------------------------------------------
  151. // DSP Callbacks
  152. void ZaMultiCompUI::d_parameterChanged(uint32_t index, float value)
  153. {
  154. switch (index)
  155. {
  156. case ZaMultiCompPlugin::paramAttack:
  157. fKnobAttack->setValue(value);
  158. break;
  159. case ZaMultiCompPlugin::paramRelease:
  160. fKnobRelease->setValue(value);
  161. break;
  162. case ZaMultiCompPlugin::paramThresh:
  163. fKnobThresh->setValue(value);
  164. break;
  165. case ZaMultiCompPlugin::paramRatio:
  166. fKnobRatio->setValue(value);
  167. break;
  168. case ZaMultiCompPlugin::paramKnee:
  169. fKnobKnee->setValue(value);
  170. break;
  171. case ZaMultiCompPlugin::paramGlobalGain:
  172. fKnobGlobalGain->setValue(value);
  173. break;
  174. case ZaMultiCompPlugin::paramGainR1:
  175. if (fLedRedValue1 != value)
  176. {
  177. fLedRedValue1 = value;
  178. repaint();
  179. }
  180. break;
  181. case ZaMultiCompPlugin::paramGainR2:
  182. if (fLedRedValue2 != value)
  183. {
  184. fLedRedValue2 = value;
  185. repaint();
  186. }
  187. break;
  188. case ZaMultiCompPlugin::paramGainR3:
  189. if (fLedRedValue3 != value)
  190. {
  191. fLedRedValue3 = value;
  192. repaint();
  193. }
  194. break;
  195. case ZaMultiCompPlugin::paramOutputLevel:
  196. if (fLedYellowValue != value)
  197. {
  198. fLedYellowValue = value;
  199. repaint();
  200. }
  201. break;
  202. case ZaMultiCompPlugin::paramMakeup1:
  203. fKnobMakeup1->setValue(value);
  204. break;
  205. case ZaMultiCompPlugin::paramMakeup2:
  206. fKnobMakeup2->setValue(value);
  207. break;
  208. case ZaMultiCompPlugin::paramMakeup3:
  209. fKnobMakeup3->setValue(value);
  210. break;
  211. case ZaMultiCompPlugin::paramToggle1:
  212. //fToggleBypass1->setValue(value);
  213. break;
  214. case ZaMultiCompPlugin::paramToggle2:
  215. //fToggleBypass2->setValue(value);
  216. break;
  217. case ZaMultiCompPlugin::paramToggle3:
  218. //fToggleBypass3->setValue(value);
  219. break;
  220. case ZaMultiCompPlugin::paramListen1:
  221. //fToggleListen1->setValue(value);
  222. break;
  223. case ZaMultiCompPlugin::paramListen2:
  224. //fToggleListen2->setValue(value);
  225. break;
  226. case ZaMultiCompPlugin::paramListen3:
  227. //fToggleListen3->setValue(value);
  228. break;
  229. }
  230. }
  231. void ZaMultiCompUI::d_programChanged(uint32_t index)
  232. {
  233. if (index != 0)
  234. return;
  235. // Default values
  236. fKnobAttack->setValue(10.0f);
  237. fKnobRelease->setValue(80.0f);
  238. fKnobThresh->setValue(0.0f);
  239. fKnobRatio->setValue(4.0f);
  240. fKnobKnee->setValue(0.0f);
  241. fKnobGlobalGain->setValue(0.0f);
  242. fKnobMakeup1->setValue(0.0f);
  243. fKnobMakeup2->setValue(0.0f);
  244. fKnobMakeup3->setValue(0.0f);
  245. fKnobXover1->setValue(250.0f);
  246. fKnobXover2->setValue(1400.0f);
  247. fToggleBypass1->setValue(1.0f);
  248. fToggleBypass2->setValue(1.0f);
  249. fToggleBypass3->setValue(1.0f);
  250. fToggleListen1->setValue(1.0f);
  251. fToggleListen2->setValue(1.0f);
  252. fToggleListen3->setValue(1.0f);
  253. }
  254. // -----------------------------------------------------------------------
  255. // Widget Callbacks
  256. void ZaMultiCompUI::imageKnobDragStarted(ImageKnob* knob)
  257. {
  258. if (knob == fKnobAttack)
  259. d_editParameter(ZaMultiCompPlugin::paramAttack, true);
  260. else if (knob == fKnobRelease)
  261. d_editParameter(ZaMultiCompPlugin::paramRelease, true);
  262. else if (knob == fKnobThresh)
  263. d_editParameter(ZaMultiCompPlugin::paramThresh, true);
  264. else if (knob == fKnobRatio)
  265. d_editParameter(ZaMultiCompPlugin::paramRatio, true);
  266. else if (knob == fKnobKnee)
  267. d_editParameter(ZaMultiCompPlugin::paramKnee, true);
  268. else if (knob == fKnobGlobalGain)
  269. d_editParameter(ZaMultiCompPlugin::paramGlobalGain, true);
  270. else if (knob == fKnobMakeup1)
  271. d_editParameter(ZaMultiCompPlugin::paramMakeup1, true);
  272. else if (knob == fKnobMakeup2)
  273. d_editParameter(ZaMultiCompPlugin::paramMakeup2, true);
  274. else if (knob == fKnobMakeup3)
  275. d_editParameter(ZaMultiCompPlugin::paramMakeup3, true);
  276. else if (knob == fKnobXover1)
  277. d_editParameter(ZaMultiCompPlugin::paramXover1, true);
  278. else if (knob == fKnobXover2)
  279. d_editParameter(ZaMultiCompPlugin::paramXover2, true);
  280. }
  281. void ZaMultiCompUI::imageKnobDragFinished(ImageKnob* knob)
  282. {
  283. if (knob == fKnobAttack)
  284. d_editParameter(ZaMultiCompPlugin::paramAttack, false);
  285. else if (knob == fKnobRelease)
  286. d_editParameter(ZaMultiCompPlugin::paramRelease, false);
  287. else if (knob == fKnobThresh)
  288. d_editParameter(ZaMultiCompPlugin::paramThresh, false);
  289. else if (knob == fKnobRatio)
  290. d_editParameter(ZaMultiCompPlugin::paramRatio, false);
  291. else if (knob == fKnobKnee)
  292. d_editParameter(ZaMultiCompPlugin::paramKnee, false);
  293. else if (knob == fKnobGlobalGain)
  294. d_editParameter(ZaMultiCompPlugin::paramGlobalGain, false);
  295. else if (knob == fKnobMakeup1)
  296. d_editParameter(ZaMultiCompPlugin::paramMakeup1, false);
  297. else if (knob == fKnobMakeup2)
  298. d_editParameter(ZaMultiCompPlugin::paramMakeup2, false);
  299. else if (knob == fKnobMakeup3)
  300. d_editParameter(ZaMultiCompPlugin::paramMakeup3, false);
  301. else if (knob == fKnobXover1)
  302. d_editParameter(ZaMultiCompPlugin::paramXover1, false);
  303. else if (knob == fKnobXover2)
  304. d_editParameter(ZaMultiCompPlugin::paramXover2, false);
  305. }
  306. void ZaMultiCompUI::imageKnobValueChanged(ImageKnob* knob, float value)
  307. {
  308. if (knob == fKnobAttack)
  309. d_setParameterValue(ZaMultiCompPlugin::paramAttack, value);
  310. else if (knob == fKnobRelease)
  311. d_setParameterValue(ZaMultiCompPlugin::paramRelease, value);
  312. else if (knob == fKnobThresh)
  313. d_setParameterValue(ZaMultiCompPlugin::paramThresh, value);
  314. else if (knob == fKnobRatio)
  315. d_setParameterValue(ZaMultiCompPlugin::paramRatio, value);
  316. else if (knob == fKnobKnee)
  317. d_setParameterValue(ZaMultiCompPlugin::paramKnee, value);
  318. else if (knob == fKnobGlobalGain)
  319. d_setParameterValue(ZaMultiCompPlugin::paramGlobalGain, value);
  320. else if (knob == fKnobMakeup1)
  321. d_setParameterValue(ZaMultiCompPlugin::paramMakeup1, value);
  322. else if (knob == fKnobMakeup2)
  323. d_setParameterValue(ZaMultiCompPlugin::paramMakeup2, value);
  324. else if (knob == fKnobMakeup3)
  325. d_setParameterValue(ZaMultiCompPlugin::paramMakeup3, value);
  326. else if (knob == fKnobXover1)
  327. d_setParameterValue(ZaMultiCompPlugin::paramXover1, value);
  328. else if (knob == fKnobXover2)
  329. d_setParameterValue(ZaMultiCompPlugin::paramXover2, value);
  330. }
  331. void ZaMultiCompUI::imageToggleClicked(ImageToggle* toggle, int)
  332. {
  333. float v = toggle->getValue();
  334. if (toggle == fToggleBypass1)
  335. d_setParameterValue(ZaMultiCompPlugin::paramToggle1, v);
  336. else if (toggle == fToggleBypass2)
  337. d_setParameterValue(ZaMultiCompPlugin::paramToggle2, v);
  338. else if (toggle == fToggleBypass3)
  339. d_setParameterValue(ZaMultiCompPlugin::paramToggle3, v);
  340. else if (toggle == fToggleListen1)
  341. d_setParameterValue(ZaMultiCompPlugin::paramListen1, v);
  342. else if (toggle == fToggleListen2)
  343. d_setParameterValue(ZaMultiCompPlugin::paramListen2, v);
  344. else if (toggle == fToggleListen3)
  345. d_setParameterValue(ZaMultiCompPlugin::paramListen3, v);
  346. }
  347. void ZaMultiCompUI::onDisplay()
  348. {
  349. fImgBackground.draw();
  350. // draw leds
  351. static const float sLedSpacing = 15.5f;
  352. static const int sLedInitialX = 343;
  353. static const int sYellowLedStaticY = 265;
  354. static const int sRedLed1StaticY = 215;
  355. static const int sRedLed2StaticY = 164;
  356. static const int sRedLed3StaticY = 113;
  357. int numRedLeds1;
  358. int numRedLeds2;
  359. int numRedLeds3;
  360. int numYellowLeds;
  361. if (fLedRedValue1 >= 40.f)
  362. numRedLeds1 = 12;
  363. else if (fLedRedValue1 >= 30.f)
  364. numRedLeds1 = 11;
  365. else if (fLedRedValue1 >= 20.f)
  366. numRedLeds1 = 10;
  367. else if (fLedRedValue1 >= 15.f)
  368. numRedLeds1 = 9;
  369. else if (fLedRedValue1 >= 10.f)
  370. numRedLeds1 = 8;
  371. else if (fLedRedValue1 >= 8.f)
  372. numRedLeds1 = 7;
  373. else if (fLedRedValue1 >= 6.f)
  374. numRedLeds1 = 6;
  375. else if (fLedRedValue1 >= 5.f)
  376. numRedLeds1 = 5;
  377. else if (fLedRedValue1 >= 4.f)
  378. numRedLeds1 = 4;
  379. else if (fLedRedValue1 >= 3.f)
  380. numRedLeds1 = 3;
  381. else if (fLedRedValue1 >= 2.f)
  382. numRedLeds1 = 2;
  383. else if (fLedRedValue1 >= 1.f)
  384. numRedLeds1 = 1;
  385. else numRedLeds1 = 0;
  386. if (fLedRedValue2 >= 40.f)
  387. numRedLeds2 = 12;
  388. else if (fLedRedValue2 >= 30.f)
  389. numRedLeds2 = 11;
  390. else if (fLedRedValue2 >= 20.f)
  391. numRedLeds2 = 10;
  392. else if (fLedRedValue2 >= 15.f)
  393. numRedLeds2 = 9;
  394. else if (fLedRedValue2 >= 10.f)
  395. numRedLeds2 = 8;
  396. else if (fLedRedValue2 >= 8.f)
  397. numRedLeds2 = 7;
  398. else if (fLedRedValue2 >= 6.f)
  399. numRedLeds2 = 6;
  400. else if (fLedRedValue2 >= 5.f)
  401. numRedLeds2 = 5;
  402. else if (fLedRedValue2 >= 4.f)
  403. numRedLeds2 = 4;
  404. else if (fLedRedValue2 >= 3.f)
  405. numRedLeds2 = 3;
  406. else if (fLedRedValue2 >= 2.f)
  407. numRedLeds2 = 2;
  408. else if (fLedRedValue2 >= 1.f)
  409. numRedLeds2 = 1;
  410. else numRedLeds2 = 0;
  411. if (fLedRedValue3 >= 40.f)
  412. numRedLeds3 = 12;
  413. else if (fLedRedValue3 >= 30.f)
  414. numRedLeds3 = 11;
  415. else if (fLedRedValue3 >= 20.f)
  416. numRedLeds3 = 10;
  417. else if (fLedRedValue3 >= 15.f)
  418. numRedLeds3 = 9;
  419. else if (fLedRedValue3 >= 10.f)
  420. numRedLeds3 = 8;
  421. else if (fLedRedValue3 >= 8.f)
  422. numRedLeds3 = 7;
  423. else if (fLedRedValue3 >= 6.f)
  424. numRedLeds3 = 6;
  425. else if (fLedRedValue3 >= 5.f)
  426. numRedLeds3 = 5;
  427. else if (fLedRedValue3 >= 4.f)
  428. numRedLeds3 = 4;
  429. else if (fLedRedValue3 >= 3.f)
  430. numRedLeds3 = 3;
  431. else if (fLedRedValue3 >= 2.f)
  432. numRedLeds3 = 2;
  433. else if (fLedRedValue3 >= 1.f)
  434. numRedLeds3 = 1;
  435. else numRedLeds3 = 0;
  436. for (int i=numRedLeds1; i>0; --i)
  437. fLedRedImg.drawAt(sLedInitialX + (12 - i)*sLedSpacing, sRedLed1StaticY);
  438. for (int i=numRedLeds2; i>0; --i)
  439. fLedRedImg.drawAt(sLedInitialX + (12 - i)*sLedSpacing, sRedLed2StaticY);
  440. for (int i=numRedLeds3; i>0; --i)
  441. fLedRedImg.drawAt(sLedInitialX + (12 - i)*sLedSpacing, sRedLed3StaticY);
  442. if (fLedYellowValue >= 20.f)
  443. numYellowLeds = 19;
  444. else if (fLedYellowValue >= 10.f)
  445. numYellowLeds = 18;
  446. else if (fLedYellowValue >= 8.f)
  447. numYellowLeds = 17;
  448. else if (fLedYellowValue >= 4.f)
  449. numYellowLeds = 16;
  450. else if (fLedYellowValue >= 2.f)
  451. numYellowLeds = 15;
  452. else if (fLedYellowValue >= 1.f)
  453. numYellowLeds = 14;
  454. else if (fLedYellowValue >= 0.f)
  455. numYellowLeds = 13;
  456. else if (fLedYellowValue >= -1.f)
  457. numYellowLeds = 12;
  458. else if (fLedYellowValue >= -2.f)
  459. numYellowLeds = 11;
  460. else if (fLedYellowValue >= -3.f)
  461. numYellowLeds = 10;
  462. else if (fLedYellowValue >= -4.f)
  463. numYellowLeds = 9;
  464. else if (fLedYellowValue >= -5.f)
  465. numYellowLeds = 8;
  466. else if (fLedYellowValue >= -6.f)
  467. numYellowLeds = 7;
  468. else if (fLedYellowValue >= -8.f)
  469. numYellowLeds = 6;
  470. else if (fLedYellowValue >= -10.f)
  471. numYellowLeds = 5;
  472. else if (fLedYellowValue >= -15.f)
  473. numYellowLeds = 4;
  474. else if (fLedYellowValue >= -20.f)
  475. numYellowLeds = 3;
  476. else if (fLedYellowValue >= -30.f)
  477. numYellowLeds = 2;
  478. else if (fLedYellowValue >= -40.f)
  479. numYellowLeds = 1;
  480. else numYellowLeds = 0;
  481. if (numYellowLeds > 12) {
  482. for (int i=12; i<numYellowLeds; ++i)
  483. fLedRedImg.drawAt(sLedInitialX + i*sLedSpacing, sYellowLedStaticY);
  484. for (int i=0; i<12; ++i)
  485. fLedYellowImg.drawAt(sLedInitialX + i*sLedSpacing, sYellowLedStaticY);
  486. } else {
  487. for (int i=0; i<numYellowLeds; ++i)
  488. fLedYellowImg.drawAt(sLedInitialX + i*sLedSpacing, sYellowLedStaticY);
  489. }
  490. }
  491. // -----------------------------------------------------------------------
  492. UI* createUI()
  493. {
  494. return new ZaMultiCompUI();
  495. }
  496. // -----------------------------------------------------------------------
  497. END_NAMESPACE_DISTRHO