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.

1573 lines
46KB

  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2013 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 "CarlaNative.hpp"
  18. #include "juce_core.h"
  19. using namespace juce;
  20. #include "vex/VexArp.h"
  21. #include "vex/VexChorus.h"
  22. #include "vex/VexDelay.h"
  23. #include "vex/VexReverb.h"
  24. #include "vex/VexSyntModule.h"
  25. #include "vex/PeggyViewComponent.h"
  26. #include "vex/lookandfeel/MyLookAndFeel.h"
  27. #include "vex/resources/Resources.h"
  28. #include "vex/resources/Resources.cpp"
  29. // -----------------------------------------------------------------------
  30. class HelperWindow : public DocumentWindow
  31. {
  32. public:
  33. HelperWindow()
  34. : DocumentWindow("PlugWindow", Colour(50, 50, 200), DocumentWindow::closeButton, false),
  35. fClosed(false)
  36. {
  37. setVisible(false);
  38. setAlwaysOnTop(true);
  39. setDropShadowEnabled(false);
  40. setOpaque(true);
  41. //setResizable(false, false);
  42. //setUsingNativeTitleBar(false);
  43. }
  44. void show(Component* const comp)
  45. {
  46. fClosed = false;
  47. const int width = comp->getWidth();
  48. const int height = comp->getHeight()+getTitleBarHeight();
  49. centreWithSize(width, height);
  50. setContentNonOwned(comp, false);
  51. setSize(width, height);
  52. if (! isOnDesktop())
  53. addToDesktop();
  54. setVisible(true);
  55. }
  56. void hide()
  57. {
  58. setVisible(false);
  59. if (isOnDesktop())
  60. removeFromDesktop();
  61. clearContentComponent();
  62. }
  63. bool wasClosedByUser() const
  64. {
  65. return fClosed;
  66. }
  67. protected:
  68. void closeButtonPressed() override
  69. {
  70. fClosed = true;
  71. }
  72. private:
  73. bool fClosed;
  74. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(HelperWindow)
  75. };
  76. // -----------------------------------------------------------------------
  77. class VexEditorComponent : public ComboBox::Listener,
  78. public Slider::Listener,
  79. public Button::Listener,
  80. public ChangeListener,
  81. public Component,
  82. public PeggyViewComponent::Callback
  83. {
  84. public:
  85. VexEditorComponent()
  86. {
  87. internalCachedImage1 = ImageCache::getFromMemory(Resources::vex3_png, Resources::vex3_pngSize);
  88. // Comboboxes, wave selection
  89. addAndMakeVisible(comboBox1 = new ComboBox (String::empty));
  90. comboBox1->setEditableText(false);
  91. comboBox1->setJustificationType(Justification::centredLeft);
  92. comboBox1->setTextWhenNothingSelected(String("silent"));
  93. comboBox1->setTextWhenNoChoicesAvailable(String("silent"));
  94. comboBox1->addListener(this);
  95. comboBox1->setColour(ComboBox::backgroundColourId, Colours::black);
  96. comboBox1->setColour(ComboBox::textColourId, Colours::lightgrey);
  97. comboBox1->setColour(ComboBox::outlineColourId, Colours::grey);
  98. comboBox1->setColour(ComboBox::buttonColourId, Colours::grey);
  99. comboBox1->setWantsKeyboardFocus(false);
  100. comboBox1->setLookAndFeel(&mlaf);
  101. addAndMakeVisible (comboBox2 = new ComboBox (String::empty));
  102. comboBox2->setEditableText (false);
  103. comboBox2->setJustificationType (Justification::centredLeft);
  104. comboBox2->setTextWhenNothingSelected (String("silent"));
  105. comboBox2->setTextWhenNoChoicesAvailable (String("silent"));
  106. comboBox2->addListener (this);
  107. comboBox2->setColour(ComboBox::backgroundColourId, Colours::black);
  108. comboBox2->setColour(ComboBox::textColourId, Colours::lightgrey);
  109. comboBox2->setColour(ComboBox::outlineColourId, Colours::grey);
  110. comboBox2->setColour(ComboBox::buttonColourId, Colours::grey);
  111. comboBox2->setWantsKeyboardFocus(false);
  112. comboBox2->setLookAndFeel(&mlaf);
  113. addAndMakeVisible (comboBox3 = new ComboBox (String::empty));
  114. comboBox3->setEditableText (false);
  115. comboBox3->setJustificationType (Justification::centredLeft);
  116. comboBox3->setTextWhenNothingSelected (String("silent"));
  117. comboBox3->setTextWhenNoChoicesAvailable (String("silent"));
  118. comboBox3->addListener (this);
  119. comboBox3->setColour(ComboBox::backgroundColourId, Colours::black);
  120. comboBox3->setColour(ComboBox::textColourId, Colours::lightgrey);
  121. comboBox3->setColour(ComboBox::outlineColourId, Colours::grey);
  122. comboBox3->setColour(ComboBox::buttonColourId, Colours::grey);
  123. comboBox3->setWantsKeyboardFocus(false);
  124. comboBox3->setLookAndFeel(&mlaf);
  125. for (int i = 0, tableSize = WaveRenderer::getWaveTableSize(); i < tableSize; ++i)
  126. {
  127. String tableName(WaveRenderer::getWaveTableName(i));
  128. comboBox1->addItem(tableName, i + 1);
  129. comboBox2->addItem(tableName, i + 1);
  130. comboBox3->addItem(tableName, i + 1);
  131. }
  132. addChildComponent(p1 = new PeggyViewComponent(1, _d, this));
  133. p1->setLookAndFeel(&mlaf);
  134. addChildComponent(p2 = new PeggyViewComponent(2, _d, this));
  135. p2->setLookAndFeel(&mlaf);
  136. addChildComponent(p3 = new PeggyViewComponent(3, _d, this));
  137. p3->setLookAndFeel(&mlaf);
  138. //ownerFilter->addChangeListener (this);
  139. setSize(800,500);
  140. }
  141. ~VexEditorComponent()
  142. {
  143. removeAllChildren();
  144. }
  145. protected:
  146. void paint(Graphics& g) override
  147. {
  148. g.drawImage(internalCachedImage1,
  149. 0, 0, 800, 500,
  150. 0, 0, internalCachedImage1.getWidth(), internalCachedImage1.getHeight());
  151. }
  152. void resized() override
  153. {
  154. comboBox1->setBounds(13, 38, 173, 23);
  155. comboBox2->setBounds(213, 38, 173, 23);
  156. comboBox3->setBounds(413, 38, 173, 23);
  157. p1->setBounds(10, 20, 207, 280);
  158. p2->setBounds(210, 20, 207, 280);
  159. p3->setBounds(410, 20, 207, 280);
  160. }
  161. void changeListenerCallback(ChangeBroadcaster* source) override
  162. {
  163. }
  164. void comboBoxChanged(ComboBox* comboBoxThatHasChanged) override
  165. {
  166. }
  167. void sliderValueChanged(Slider* sliderThatWasMoved) override
  168. {
  169. }
  170. void buttonClicked(Button* buttonThatWasClicked) override
  171. {
  172. }
  173. void somethingChanged(const uint32_t id) override
  174. {
  175. }
  176. private:
  177. Image internalCachedImage1;
  178. MyLookAndFeel mlaf;
  179. ScopedPointer<ComboBox> comboBox1;
  180. ScopedPointer<ComboBox> comboBox2;
  181. ScopedPointer<ComboBox> comboBox3;
  182. ScopedPointer<PeggyViewComponent> p1;
  183. ScopedPointer<PeggyViewComponent> p2;
  184. ScopedPointer<PeggyViewComponent> p3;
  185. VexArpSettings _d;
  186. };
  187. // -----------------------------------------------------------------------
  188. class VexArpPlugin : public PluginClass,
  189. public PeggyViewComponent::Callback
  190. {
  191. public:
  192. enum Params {
  193. kParamOnOff = 0,
  194. kParamLength,
  195. kParamTimeMode,
  196. kParamSyncMode,
  197. kParamFailMode,
  198. kParamVelMode,
  199. kParamLast,
  200. kParamCount = kParamLast + VexArpSettings::kVelocitiesSize + VexArpSettings::kGridSize
  201. };
  202. VexArpPlugin(const HostDescriptor* const host)
  203. : PluginClass(host),
  204. fArp(&fSettings)
  205. {
  206. fArp.setSampleRate(getSampleRate());
  207. fMidiInBuffer.ensureSize(512*4);
  208. }
  209. protected:
  210. // -------------------------------------------------------------------
  211. // Plugin parameter calls
  212. uint32_t getParameterCount() const override
  213. {
  214. return kParamCount;
  215. }
  216. const Parameter* getParameterInfo(const uint32_t index) const override
  217. {
  218. static Parameter paramInfo;
  219. static ParameterScalePoint scalePoints[4];
  220. static char bufName[24+1];
  221. int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
  222. paramInfo.name = nullptr;
  223. paramInfo.unit = nullptr;
  224. paramInfo.ranges.def = 0.0f;
  225. paramInfo.ranges.min = 0.0f;
  226. paramInfo.ranges.max = 1.0f;
  227. paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
  228. paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
  229. paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
  230. paramInfo.scalePointCount = 0;
  231. paramInfo.scalePoints = nullptr;
  232. if (index < kParamLast)
  233. {
  234. hints |= PARAMETER_IS_INTEGER;
  235. paramInfo.ranges.step = 1.0f;
  236. paramInfo.ranges.stepSmall = 1.0f;
  237. paramInfo.ranges.stepLarge = 1.0f;
  238. switch (index)
  239. {
  240. case kParamOnOff:
  241. hints |= PARAMETER_IS_BOOLEAN;
  242. paramInfo.name = "On/Off";
  243. paramInfo.ranges.def = 0.0f;
  244. paramInfo.ranges.min = 0.0f;
  245. paramInfo.ranges.max = 1.0f;
  246. break;
  247. case kParamLength:
  248. paramInfo.name = "Length";
  249. paramInfo.ranges.def = 8.0f;
  250. paramInfo.ranges.min = 1.0f;
  251. paramInfo.ranges.max = 16.0f;
  252. break;
  253. case kParamTimeMode:
  254. hints |= PARAMETER_USES_SCALEPOINTS;
  255. paramInfo.name = "Time Signature";
  256. paramInfo.ranges.def = 2.0f;
  257. paramInfo.ranges.min = 1.0f;
  258. paramInfo.ranges.max = 3.0f;
  259. paramInfo.scalePointCount = 3;
  260. paramInfo.scalePoints = scalePoints;
  261. scalePoints[0].label = "1/8";
  262. scalePoints[1].label = "1/16";
  263. scalePoints[2].label = "1/32";
  264. scalePoints[0].value = 1.0f;
  265. scalePoints[1].value = 2.0f;
  266. scalePoints[2].value = 3.0f;
  267. break;
  268. case kParamSyncMode:
  269. hints |= PARAMETER_USES_SCALEPOINTS;
  270. paramInfo.name = "Sync Mode";
  271. paramInfo.ranges.def = 1.0f;
  272. paramInfo.ranges.min = 1.0f;
  273. paramInfo.ranges.max = 2.0f;
  274. paramInfo.scalePointCount = 2;
  275. paramInfo.scalePoints = scalePoints;
  276. scalePoints[0].label = "Key Sync";
  277. scalePoints[1].label = "Bar Sync";
  278. scalePoints[0].value = 1.0f;
  279. scalePoints[1].value = 2.0f;
  280. break;
  281. case kParamFailMode:
  282. hints |= PARAMETER_USES_SCALEPOINTS;
  283. paramInfo.name = "Fail Mode";
  284. paramInfo.ranges.def = 1.0f;
  285. paramInfo.ranges.min = 1.0f;
  286. paramInfo.ranges.max = 3.0f;
  287. paramInfo.scalePointCount = 3;
  288. paramInfo.scalePoints = scalePoints;
  289. scalePoints[0].label = "Silent Step";
  290. scalePoints[1].label = "Skip One";
  291. scalePoints[2].label = "Skip Two";
  292. scalePoints[0].value = 1.0f;
  293. scalePoints[1].value = 2.0f;
  294. scalePoints[2].value = 3.0f;
  295. break;
  296. case kParamVelMode:
  297. hints |= PARAMETER_USES_SCALEPOINTS;
  298. paramInfo.name = "Velocity Mode";
  299. paramInfo.ranges.def = 1.0f;
  300. paramInfo.ranges.min = 1.0f;
  301. paramInfo.ranges.max = 3.0f;
  302. paramInfo.scalePointCount = 3;
  303. paramInfo.scalePoints = scalePoints;
  304. scalePoints[0].label = "Pattern Velocity";
  305. scalePoints[1].label = "Input Velocity";
  306. scalePoints[2].label = "Sum Velocities";
  307. scalePoints[0].value = 1.0f;
  308. scalePoints[1].value = 2.0f;
  309. scalePoints[2].value = 3.0f;
  310. break;
  311. }
  312. }
  313. else if (index < kParamLast + VexArpSettings::kVelocitiesSize)
  314. {
  315. carla_zeroChar(bufName, 24+1);
  316. std::snprintf(bufName, 24, "Grid Velocity %i", index - kParamLast);
  317. paramInfo.name = bufName;
  318. }
  319. else
  320. {
  321. carla_zeroChar(bufName, 24+1);
  322. hints |= PARAMETER_IS_BOOLEAN|PARAMETER_IS_INTEGER;
  323. paramInfo.ranges.step = 1.0f;
  324. paramInfo.ranges.stepSmall = 1.0f;
  325. paramInfo.ranges.stepLarge = 1.0f;
  326. carla_zeroChar(bufName, 24+1);
  327. std::snprintf(bufName, 24, "Grid on/off %i", index - (kParamLast + VexArpSettings::kVelocitiesSize));
  328. paramInfo.name = bufName;
  329. }
  330. paramInfo.hints = static_cast<ParameterHints>(hints);
  331. return &paramInfo;
  332. }
  333. float getParameterValue(const uint32_t index) const override
  334. {
  335. if (index < kParamLast)
  336. {
  337. switch (index)
  338. {
  339. case kParamOnOff:
  340. return fSettings.on ? 1.0f : 0.0f;
  341. case kParamLength:
  342. return fSettings.length;
  343. case kParamTimeMode:
  344. return fSettings.timeMode;
  345. case kParamSyncMode:
  346. return fSettings.syncMode;
  347. case kParamFailMode:
  348. return fSettings.failMode;
  349. case kParamVelMode:
  350. return fSettings.velMode;
  351. default:
  352. return 0.0f;
  353. }
  354. }
  355. else if (index < kParamLast + VexArpSettings::kVelocitiesSize)
  356. {
  357. return fSettings.velocities[index-kParamLast];
  358. }
  359. else
  360. {
  361. return fSettings.grid[index-(kParamLast+VexArpSettings::kVelocitiesSize)] ? 1.0f : 0.0f;
  362. }
  363. }
  364. // -------------------------------------------------------------------
  365. // Plugin state calls
  366. void setParameterValue(const uint32_t index, const float value) override
  367. {
  368. if (index < kParamLast)
  369. {
  370. switch (index)
  371. {
  372. case kParamOnOff:
  373. fSettings.on = (value >= 0.5f);
  374. break;
  375. case kParamLength:
  376. fSettings.length = value;
  377. break;
  378. case kParamTimeMode:
  379. fSettings.timeMode = value;
  380. break;
  381. case kParamSyncMode:
  382. fSettings.syncMode = value;
  383. break;
  384. case kParamFailMode:
  385. fSettings.failMode = value;
  386. break;
  387. case kParamVelMode:
  388. fSettings.velMode = value;
  389. break;
  390. }
  391. }
  392. else if (index < kParamLast + VexArpSettings::kVelocitiesSize)
  393. {
  394. fSettings.velocities[index-kParamLast] = value;
  395. }
  396. else
  397. {
  398. fSettings.grid[index-(kParamLast+VexArpSettings::kVelocitiesSize)] = (value >= 0.5f);
  399. }
  400. }
  401. // -------------------------------------------------------------------
  402. // Plugin process calls
  403. void process(float**, float**, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override
  404. {
  405. if (! fSettings.on)
  406. {
  407. for (uint32_t i=0; i < midiEventCount; ++i)
  408. writeMidiEvent(&midiEvents[i]);
  409. return;
  410. }
  411. const TimeInfo* const timeInfo(getTimeInfo());
  412. bool timePlaying = false;
  413. double ppqPos = 0.0;
  414. double barStartPos = 0.0;
  415. double bpm = 120.0;
  416. if (timeInfo != nullptr)
  417. {
  418. timePlaying = timeInfo->playing;
  419. if (timeInfo->bbt.valid)
  420. {
  421. double ppqBar = double(timeInfo->bbt.bar - 1) * timeInfo->bbt.beatsPerBar;
  422. double ppqBeat = double(timeInfo->bbt.beat - 1);
  423. double ppqTick = double(timeInfo->bbt.tick) / timeInfo->bbt.ticksPerBeat;
  424. ppqPos = ppqBar + ppqBeat + ppqTick;
  425. barStartPos = ppqBar;
  426. bpm = timeInfo->bbt.beatsPerMinute;
  427. }
  428. }
  429. fMidiInBuffer.clear();
  430. for (uint32_t i=0; i < midiEventCount; ++i)
  431. {
  432. const MidiEvent* const midiEvent(&midiEvents[i]);
  433. fMidiInBuffer.addEvent(MidiMessage(midiEvent->data, midiEvent->size), midiEvent->time);
  434. }
  435. const MidiBuffer& outMidiBuffer(fArp.processMidi(fMidiInBuffer, timePlaying, ppqPos, barStartPos, bpm, frames));
  436. MidiBuffer::Iterator outBufferIterator(outMidiBuffer);
  437. MidiMessage midiMessage(0xf4);
  438. int sampleNumber;
  439. MidiEvent tmpEvent;
  440. tmpEvent.port = 0;
  441. while (outBufferIterator.getNextEvent(midiMessage, sampleNumber))
  442. {
  443. tmpEvent.size = midiMessage.getRawDataSize();
  444. tmpEvent.time = sampleNumber;
  445. if (tmpEvent.size > 4)
  446. continue;
  447. std::memcpy(tmpEvent.data, midiMessage.getRawData(), sizeof(uint8_t)*tmpEvent.size);
  448. writeMidiEvent(&tmpEvent);
  449. }
  450. }
  451. // -------------------------------------------------------------------
  452. // Plugin UI calls
  453. void uiShow(const bool show) override
  454. {
  455. if (show)
  456. {
  457. if (fWindow == nullptr)
  458. {
  459. fWindow = new HelperWindow();
  460. fWindow->setName(getUiName());
  461. }
  462. if (fView == nullptr)
  463. {
  464. fView = new PeggyViewComponent(1, fSettings, this);
  465. fView->setSize(207, 320);
  466. }
  467. fWindow->show(fView);
  468. }
  469. else if (fWindow != nullptr)
  470. {
  471. fWindow->hide();
  472. fView = nullptr;
  473. fWindow = nullptr;
  474. }
  475. }
  476. void uiIdle() override
  477. {
  478. if (fWindow == nullptr)
  479. return;
  480. if (fWindow->wasClosedByUser())
  481. {
  482. uiShow(false);
  483. uiClosed();
  484. }
  485. }
  486. void uiSetParameterValue(const uint32_t, const float) override
  487. {
  488. if (fView == nullptr)
  489. return;
  490. fView->update();
  491. }
  492. // -------------------------------------------------------------------
  493. // Plugin dispatcher calls
  494. void sampleRateChanged(const double sampleRate) override
  495. {
  496. fArp.setSampleRate(sampleRate);
  497. }
  498. void uiNameChanged(const char* const uiName) override
  499. {
  500. if (fWindow == nullptr)
  501. return;
  502. fWindow->setName(uiName);
  503. }
  504. // -------------------------------------------------------------------
  505. // Peggy callback
  506. void somethingChanged(const uint32_t id) override
  507. {
  508. uiParameterChanged(id, getParameterValue(id));
  509. }
  510. private:
  511. VexArpSettings fSettings;
  512. VexArp fArp;
  513. MidiBuffer fMidiInBuffer;
  514. ScopedPointer<PeggyViewComponent> fView;
  515. ScopedPointer<HelperWindow> fWindow;
  516. PluginClassEND(VexArpPlugin)
  517. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexArpPlugin)
  518. };
  519. // -----------------------------------------------------------------------
  520. class VexChorusPlugin : public PluginClass
  521. {
  522. public:
  523. enum Params {
  524. kParamRate = 0,
  525. kParamDepth,
  526. kParamCount
  527. };
  528. VexChorusPlugin(const HostDescriptor* const host)
  529. : PluginClass(host),
  530. fChorus(fParameters)
  531. {
  532. std::memset(fParameters, 0, sizeof(float)*92);
  533. fParameters[76] = 0.3f;
  534. fParameters[77] = 0.6f;
  535. fChorus.setSampleRate(getSampleRate());
  536. }
  537. protected:
  538. // -------------------------------------------------------------------
  539. // Plugin parameter calls
  540. uint32_t getParameterCount() const override
  541. {
  542. return kParamCount;
  543. }
  544. const Parameter* getParameterInfo(const uint32_t index) const override
  545. {
  546. static Parameter paramInfo;
  547. int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
  548. paramInfo.name = nullptr;
  549. paramInfo.unit = nullptr;
  550. paramInfo.ranges.def = 0.0f;
  551. paramInfo.ranges.min = 0.0f;
  552. paramInfo.ranges.max = 1.0f;
  553. paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
  554. paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
  555. paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
  556. paramInfo.scalePointCount = 0;
  557. paramInfo.scalePoints = nullptr;
  558. switch (index)
  559. {
  560. case kParamRate:
  561. paramInfo.name = "Rate";
  562. paramInfo.ranges.def = 0.3f;
  563. paramInfo.ranges.min = 0.0f;
  564. paramInfo.ranges.max = 1.0f;
  565. break;
  566. case kParamDepth:
  567. paramInfo.name = "Depth";
  568. paramInfo.ranges.def = 0.6f;
  569. paramInfo.ranges.min = 0.0f;
  570. paramInfo.ranges.max = 1.0f;
  571. break;
  572. }
  573. paramInfo.hints = static_cast<ParameterHints>(hints);
  574. return &paramInfo;
  575. }
  576. float getParameterValue(const uint32_t index) const override
  577. {
  578. switch (index)
  579. {
  580. case kParamRate:
  581. return fParameters[76];
  582. case kParamDepth:
  583. return fParameters[77];
  584. default:
  585. return 0.0f;
  586. }
  587. }
  588. // -------------------------------------------------------------------
  589. // Plugin state calls
  590. void setParameterValue(const uint32_t index, const float value) override
  591. {
  592. switch (index)
  593. {
  594. case kParamRate:
  595. fParameters[76] = value;
  596. break;
  597. case kParamDepth:
  598. fParameters[77] = value;
  599. break;
  600. default:
  601. break;
  602. }
  603. }
  604. // -------------------------------------------------------------------
  605. // Plugin process calls
  606. void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
  607. {
  608. if (inBuffer[0] != outBuffer[0])
  609. carla_copyFloat(outBuffer[0], inBuffer[0], frames);
  610. if (inBuffer[1] != outBuffer[1])
  611. carla_copyFloat(outBuffer[1], inBuffer[1], frames);
  612. fChorus.processBlock(outBuffer[0], outBuffer[1], frames);
  613. }
  614. // -------------------------------------------------------------------
  615. // Plugin dispatcher calls
  616. void sampleRateChanged(const double sampleRate) override
  617. {
  618. fChorus.setSampleRate(sampleRate);
  619. }
  620. private:
  621. VexChorus fChorus;
  622. float fParameters[92];
  623. PluginClassEND(VexChorusPlugin)
  624. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexChorusPlugin)
  625. };
  626. // -----------------------------------------------------------------------
  627. class VexDelayPlugin : public PluginClass
  628. {
  629. public:
  630. enum Params {
  631. kParamTime = 0,
  632. kParamFeedback,
  633. kParamCount
  634. };
  635. VexDelayPlugin(const HostDescriptor* const host)
  636. : PluginClass(host),
  637. fDelay(fParameters)
  638. {
  639. std::memset(fParameters, 0, sizeof(float)*92);
  640. fParameters[73] = 0.5f * 8.0f;
  641. fParameters[74] = 0.4f * 100.0f;
  642. fDelay.setSampleRate(getSampleRate());
  643. }
  644. protected:
  645. // -------------------------------------------------------------------
  646. // Plugin parameter calls
  647. uint32_t getParameterCount() const override
  648. {
  649. return kParamCount;
  650. }
  651. const Parameter* getParameterInfo(const uint32_t index) const override
  652. {
  653. static Parameter paramInfo;
  654. int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
  655. paramInfo.name = nullptr;
  656. paramInfo.unit = nullptr;
  657. paramInfo.ranges.def = 0.0f;
  658. paramInfo.ranges.min = 0.0f;
  659. paramInfo.ranges.max = 1.0f;
  660. paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
  661. paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
  662. paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
  663. paramInfo.scalePointCount = 0;
  664. paramInfo.scalePoints = nullptr;
  665. switch (index)
  666. {
  667. case kParamTime:
  668. hints |= PARAMETER_IS_INTEGER;
  669. paramInfo.name = "Time";
  670. paramInfo.ranges.def = 4.0f;
  671. paramInfo.ranges.min = 0.0f;
  672. paramInfo.ranges.max = 8.0f;
  673. break;
  674. case kParamFeedback:
  675. paramInfo.name = "Feedback";
  676. paramInfo.unit = "%";
  677. paramInfo.ranges.def = 40.0f;
  678. paramInfo.ranges.min = 0.0f;
  679. paramInfo.ranges.max = 100.0f;
  680. break;
  681. }
  682. paramInfo.hints = static_cast<ParameterHints>(hints);
  683. return &paramInfo;
  684. }
  685. float getParameterValue(const uint32_t index) const override
  686. {
  687. switch (index)
  688. {
  689. case kParamTime:
  690. return fParameters[73] * 8.0f;
  691. case kParamFeedback:
  692. return fParameters[74] * 100.0f;
  693. default:
  694. return 0.0f;
  695. }
  696. }
  697. // -------------------------------------------------------------------
  698. // Plugin state calls
  699. void setParameterValue(const uint32_t index, const float value) override
  700. {
  701. switch (index)
  702. {
  703. case kParamTime:
  704. fParameters[73] = value/8.0f;
  705. break;
  706. case kParamFeedback:
  707. fParameters[74] = value/100.0f;
  708. break;
  709. default:
  710. break;
  711. }
  712. }
  713. // -------------------------------------------------------------------
  714. // Plugin process calls
  715. void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
  716. {
  717. if (inBuffer[0] != outBuffer[0])
  718. carla_copyFloat(outBuffer[0], inBuffer[0], frames);
  719. if (inBuffer[1] != outBuffer[1])
  720. carla_copyFloat(outBuffer[1], inBuffer[1], frames);
  721. const TimeInfo* const timeInfo(getTimeInfo());
  722. const double bpm((timeInfo != nullptr && timeInfo->bbt.valid) ? timeInfo->bbt.beatsPerMinute : 120.0);
  723. fDelay.processBlock(outBuffer[0], outBuffer[1], frames, bpm);
  724. }
  725. // -------------------------------------------------------------------
  726. // Plugin dispatcher calls
  727. void sampleRateChanged(const double sampleRate) override
  728. {
  729. fDelay.setSampleRate(sampleRate);
  730. }
  731. private:
  732. VexDelay fDelay;
  733. float fParameters[92];
  734. PluginClassEND(VexDelayPlugin)
  735. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexDelayPlugin)
  736. };
  737. // -----------------------------------------------------------------------
  738. class VexReverbPlugin : public PluginClass
  739. {
  740. public:
  741. enum Params {
  742. kParamSize = 0,
  743. kParamWidth,
  744. kParamDamp,
  745. kParamCount
  746. };
  747. VexReverbPlugin(const HostDescriptor* const host)
  748. : PluginClass(host),
  749. fReverb(fParameters)
  750. {
  751. std::memset(fParameters, 0, sizeof(float)*92);
  752. // FIXME?
  753. fParameters[79] = 0.6f;
  754. fParameters[80] = 0.6f;
  755. fParameters[81] = 0.7f;
  756. }
  757. protected:
  758. // -------------------------------------------------------------------
  759. // Plugin parameter calls
  760. uint32_t getParameterCount() const override
  761. {
  762. return kParamCount;
  763. }
  764. const Parameter* getParameterInfo(const uint32_t index) const override
  765. {
  766. static Parameter paramInfo;
  767. int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
  768. paramInfo.name = nullptr;
  769. paramInfo.unit = nullptr;
  770. paramInfo.ranges.def = 0.0f;
  771. paramInfo.ranges.min = 0.0f;
  772. paramInfo.ranges.max = 1.0f;
  773. paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
  774. paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
  775. paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
  776. paramInfo.scalePointCount = 0;
  777. paramInfo.scalePoints = nullptr;
  778. switch (index)
  779. {
  780. case kParamSize:
  781. paramInfo.name = "Size";
  782. paramInfo.ranges.def = 0.6f;
  783. paramInfo.ranges.min = 0.0f;
  784. paramInfo.ranges.max = 1.0f;
  785. break;
  786. case kParamWidth:
  787. paramInfo.name = "Width";
  788. paramInfo.ranges.def = 0.7f;
  789. paramInfo.ranges.min = 0.0f;
  790. paramInfo.ranges.max = 1.0f;
  791. break;
  792. case kParamDamp:
  793. paramInfo.name = "Damp";
  794. paramInfo.ranges.def = 0.6f;
  795. paramInfo.ranges.min = 0.0f;
  796. paramInfo.ranges.max = 1.0f;
  797. break;
  798. }
  799. paramInfo.hints = static_cast<ParameterHints>(hints);
  800. return &paramInfo;
  801. }
  802. float getParameterValue(const uint32_t index) const override
  803. {
  804. switch (index)
  805. {
  806. case kParamSize:
  807. return fParameters[79];
  808. case kParamWidth:
  809. return fParameters[80];
  810. case kParamDamp:
  811. return fParameters[81];
  812. default:
  813. return 0.0f;
  814. }
  815. }
  816. // -------------------------------------------------------------------
  817. // Plugin state calls
  818. void setParameterValue(const uint32_t index, const float value) override
  819. {
  820. switch (index)
  821. {
  822. case kParamSize:
  823. fParameters[79] = value;
  824. break;
  825. case kParamWidth:
  826. fParameters[80] = value;
  827. break;
  828. case kParamDamp:
  829. fParameters[81] = value;
  830. break;
  831. default:
  832. break;
  833. }
  834. }
  835. // -------------------------------------------------------------------
  836. // Plugin process calls
  837. void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override
  838. {
  839. for (uint32_t i=0; i< frames; ++i)
  840. outBuffer[0][i] = inBuffer[0][i]/2.0f;
  841. for (uint32_t i=0; i< frames; ++i)
  842. outBuffer[1][i] = inBuffer[1][i]/2.0f;
  843. fReverb.processBlock(outBuffer[0], outBuffer[1], frames);
  844. }
  845. private:
  846. VexReverb fReverb;
  847. float fParameters[92];
  848. PluginClassEND(VexReverbPlugin)
  849. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexReverbPlugin)
  850. };
  851. // -----------------------------------------------------------------------
  852. class VexSynthPlugin : public PluginClass
  853. {
  854. public:
  855. static const unsigned int kParamCount = 92;
  856. VexSynthPlugin(const HostDescriptor* const host)
  857. : PluginClass(host),
  858. obf(nullptr),
  859. abf(nullptr),
  860. dbf1(nullptr),
  861. dbf2(nullptr),
  862. dbf3(nullptr),
  863. fChorus(fParameters),
  864. fDelay(fParameters),
  865. fReverb(fParameters),
  866. fSynth(fParameters)
  867. {
  868. std::memset(fParameters, 0, sizeof(float)*92);
  869. fParameters[0] = 1.0f; // main volume
  870. for (int i = 0; i < 3; ++i)
  871. {
  872. const int offset = i * 24;
  873. fParameters[offset + 1] = 0.5f;
  874. fParameters[offset + 2] = 0.5f;
  875. fParameters[offset + 3] = 0.5f;
  876. fParameters[offset + 4] = 0.5f;
  877. fParameters[offset + 5] = 0.9f;
  878. fParameters[offset + 6] = 0.0f;
  879. fParameters[offset + 7] = 1.0f;
  880. fParameters[offset + 8] = 0.5f;
  881. fParameters[offset + 9] = 0.0f;
  882. fParameters[offset + 10] = 0.2f;
  883. fParameters[offset + 11] = 0.0f;
  884. fParameters[offset + 12] = 0.5f;
  885. fParameters[offset + 13] = 0.5f;
  886. fParameters[offset + 14] = 0.0f;
  887. fParameters[offset + 15] = 0.3f;
  888. fParameters[offset + 16] = 0.7f;
  889. fParameters[offset + 17] = 0.1f;
  890. fParameters[offset + 18] = 0.5f;
  891. fParameters[offset + 19] = 0.5f;
  892. fParameters[offset + 20] = 0.0f;
  893. fParameters[offset + 21] = 0.0f;
  894. fParameters[offset + 22] = 0.5f;
  895. fParameters[offset + 23] = 0.5f;
  896. fParameters[offset + 24] = 0.5f;
  897. }
  898. // ^1 - 72
  899. fParameters[73] = 0.5f; // Delay Time
  900. fParameters[74] = 0.4f; // Delay Feedback
  901. fParameters[75] = 0.0f; // Delay Volume
  902. fParameters[76] = 0.3f; // Chorus Rate
  903. fParameters[77] = 0.6f; // Chorus Depth
  904. fParameters[78] = 0.5f; // Chorus Volume
  905. fParameters[79] = 0.6f; // Reverb Size
  906. fParameters[80] = 0.7f; // Reverb Width
  907. fParameters[81] = 0.6f; // Reverb Damp
  908. fParameters[82] = 0.0f; // Reverb Volume
  909. fParameters[83] = 0.5f; // wave1 panning
  910. fParameters[84] = 0.5f; // wave2 panning
  911. fParameters[85] = 0.5f; // wave3 panning
  912. fParameters[86] = 0.5f; // wave1 volume
  913. fParameters[87] = 0.5f; // wave2 volume
  914. fParameters[88] = 0.5f; // wave3 volume
  915. fParameters[89] = 1.0f; // wave1 on/off
  916. fParameters[90] = 1.0f; // wave2 on/off
  917. fParameters[91] = 1.0f; // wave3 on/off
  918. bufferSizeChanged(getBufferSize());
  919. sampleRateChanged(getSampleRate());
  920. }
  921. ~VexSynthPlugin()
  922. {
  923. delete obf;
  924. delete abf;
  925. delete dbf1;
  926. delete dbf2;
  927. delete dbf3;
  928. }
  929. protected:
  930. // -------------------------------------------------------------------
  931. // Plugin parameter calls
  932. uint32_t getParameterCount() const override
  933. {
  934. return kParamCount;
  935. }
  936. const Parameter* getParameterInfo(const uint32_t index) const override
  937. {
  938. static Parameter paramInfo;
  939. int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE;
  940. paramInfo.name = nullptr;
  941. paramInfo.unit = nullptr;
  942. paramInfo.ranges.def = 0.0f;
  943. paramInfo.ranges.min = 0.0f;
  944. paramInfo.ranges.max = 1.0f;
  945. paramInfo.ranges.step = PARAMETER_RANGES_DEFAULT_STEP;
  946. paramInfo.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL;
  947. paramInfo.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE;
  948. paramInfo.scalePointCount = 0;
  949. paramInfo.scalePoints = nullptr;
  950. if (index >= 1 && index <= 72)
  951. {
  952. uint32_t ri = index % 24;
  953. switch (ri)
  954. {
  955. case 1:
  956. paramInfo.name = "oct";
  957. break;
  958. case 2:
  959. paramInfo.name = "cent";
  960. break;
  961. case 3:
  962. paramInfo.name = "phaseOffset";
  963. break;
  964. case 4:
  965. paramInfo.name = "phaseIncOffset";
  966. break;
  967. case 5:
  968. paramInfo.name = "filter";
  969. break;
  970. case 6:
  971. paramInfo.name = "filter";
  972. break;
  973. case 7:
  974. paramInfo.name = "filter";
  975. break;
  976. case 8:
  977. paramInfo.name = "filter";
  978. break;
  979. case 9:
  980. paramInfo.name = "F ADSR";
  981. break;
  982. case 10:
  983. paramInfo.name = "F ADSR";
  984. break;
  985. case 11:
  986. paramInfo.name = "F ADSR";
  987. break;
  988. case 12:
  989. paramInfo.name = "F ADSR";
  990. break;
  991. case 13:
  992. paramInfo.name = "F velocity";
  993. break;
  994. case 14:
  995. paramInfo.name = "A ADSR";
  996. break;
  997. case 15:
  998. paramInfo.name = "A ADSR";
  999. break;
  1000. case 16:
  1001. paramInfo.name = "A ADSR";
  1002. break;
  1003. case 17:
  1004. paramInfo.name = "A ADSR";
  1005. break;
  1006. case 18:
  1007. paramInfo.name = "A velocity";
  1008. break;
  1009. case 19:
  1010. paramInfo.name = "lfoC";
  1011. break;
  1012. case 20:
  1013. paramInfo.name = "lfoA";
  1014. break;
  1015. case 21:
  1016. paramInfo.name = "lfoF";
  1017. break;
  1018. case 22:
  1019. paramInfo.name = "fx vol D";
  1020. break;
  1021. case 23:
  1022. paramInfo.name = "fx vol C";
  1023. break;
  1024. case 24:
  1025. case 0:
  1026. paramInfo.name = "fx vol R";
  1027. break;
  1028. default:
  1029. paramInfo.name = "unknown2";
  1030. break;
  1031. }
  1032. paramInfo.hints = static_cast<ParameterHints>(hints);
  1033. return &paramInfo;
  1034. }
  1035. switch (index)
  1036. {
  1037. case 0:
  1038. paramInfo.name = "Main volume";
  1039. break;
  1040. case 73:
  1041. paramInfo.name = "Delay Time";
  1042. break;
  1043. case 74:
  1044. paramInfo.name = "Delay Feedback";
  1045. break;
  1046. case 75:
  1047. paramInfo.name = "Delay Volume";
  1048. break;
  1049. case 76:
  1050. paramInfo.name = "Chorus Rate";
  1051. break;
  1052. case 77:
  1053. paramInfo.name = "Chorus Depth";
  1054. break;
  1055. case 78:
  1056. paramInfo.name = "Chorus Volume";
  1057. break;
  1058. case 79:
  1059. paramInfo.name = "Reverb Size";
  1060. break;
  1061. case 80:
  1062. paramInfo.name = "Reverb Width";
  1063. break;
  1064. case 81:
  1065. paramInfo.name = "Reverb Damp";
  1066. break;
  1067. case 82:
  1068. paramInfo.name = "Reverb Volume";
  1069. break;
  1070. case 83:
  1071. paramInfo.name = "Wave1 Panning";
  1072. break;
  1073. case 84:
  1074. paramInfo.name = "Wave2 Panning";
  1075. break;
  1076. case 85:
  1077. paramInfo.name = "Wave3 Panning";
  1078. break;
  1079. case 86:
  1080. paramInfo.name = "Wave1 Volume";
  1081. break;
  1082. case 87:
  1083. paramInfo.name = "Wave2 Volume";
  1084. break;
  1085. case 88:
  1086. paramInfo.name = "Wave3 Volume";
  1087. break;
  1088. case 89:
  1089. paramInfo.name = "Wave1 on/off";
  1090. break;
  1091. case 90:
  1092. paramInfo.name = "Wave2 on/off";
  1093. break;
  1094. case 91:
  1095. paramInfo.name = "Wave3 on/off";
  1096. break;
  1097. default:
  1098. paramInfo.name = "unknown";
  1099. break;
  1100. }
  1101. paramInfo.hints = static_cast<ParameterHints>(hints);
  1102. return &paramInfo;
  1103. }
  1104. float getParameterValue(const uint32_t index) const override
  1105. {
  1106. return (index < kParamCount) ? fParameters[index] : 0.0f;
  1107. }
  1108. // -------------------------------------------------------------------
  1109. // Plugin state calls
  1110. void setParameterValue(const uint32_t index, const float value) override
  1111. {
  1112. if (index < kParamCount)
  1113. {
  1114. fParameters[index] = value;
  1115. fSynth.update(index);
  1116. }
  1117. }
  1118. // -------------------------------------------------------------------
  1119. // Plugin process calls
  1120. void process(float**, float** outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override
  1121. {
  1122. const TimeInfo* const timeInfo(getTimeInfo());
  1123. const double bpm((timeInfo != nullptr && timeInfo->bbt.valid) ? timeInfo->bbt.beatsPerMinute : 120.0);
  1124. for (uint32_t i=0; i < midiEventCount; ++i)
  1125. {
  1126. const MidiEvent* const midiEvent(&midiEvents[i]);
  1127. const uint8_t status(MIDI_GET_STATUS_FROM_DATA(midiEvent->data));
  1128. if (status == MIDI_STATUS_NOTE_ON)
  1129. {
  1130. fSynth.playNote(midiEvent->data[1], midiEvent->data[2], 0, 1);
  1131. }
  1132. else if (status == MIDI_STATUS_NOTE_OFF)
  1133. {
  1134. fSynth.releaseNote(midiEvent->data[1], 0, 1);
  1135. }
  1136. else if (status == MIDI_STATUS_CONTROL_CHANGE)
  1137. {
  1138. const uint8_t control(midiEvent->data[1]);
  1139. if (control == MIDI_CONTROL_ALL_SOUND_OFF)
  1140. fSynth.kill();
  1141. else if (control == MIDI_CONTROL_ALL_NOTES_OFF)
  1142. fSynth.releaseAll(1);
  1143. }
  1144. }
  1145. if (obf->getNumSamples() != (int)frames)
  1146. {
  1147. obf->setSize(2, frames, 0, 0, 1);
  1148. abf->setSize(2, frames, 0, 0, 1);
  1149. dbf1->setSize(2, frames, 0, 0, 1);
  1150. dbf2->setSize(2, frames, 0, 0, 1);
  1151. dbf3->setSize(2, frames, 0, 0, 1);
  1152. }
  1153. obf ->clear();
  1154. dbf1->clear();
  1155. dbf2->clear();
  1156. dbf3->clear();
  1157. fSynth.doProcess(*obf, *abf, *dbf1, *dbf2, *dbf3);
  1158. if (fParameters[75] > 0.001f) fDelay.processBlock(dbf1, bpm);
  1159. if (fParameters[78] > 0.001f) fChorus.processBlock(dbf2);
  1160. if (fParameters[82] > 0.001f) fReverb.processBlock(dbf3);
  1161. AudioSampleBuffer output(outBuffer, 2, 0, frames);
  1162. output.clear();
  1163. obf->addFrom(0, 0, *dbf1, 0, 0, frames, fParameters[75]);
  1164. obf->addFrom(1, 0, *dbf1, 1, 0, frames, fParameters[75]);
  1165. obf->addFrom(0, 0, *dbf2, 0, 0, frames, fParameters[78]);
  1166. obf->addFrom(1, 0, *dbf2, 1, 0, frames, fParameters[78]);
  1167. obf->addFrom(0, 0, *dbf3, 0, 0, frames, fParameters[82]);
  1168. obf->addFrom(1, 0, *dbf3, 1, 0, frames, fParameters[82]);
  1169. output.addFrom(0, 0, *obf, 0, 0, frames, fParameters[0]);
  1170. output.addFrom(1, 0, *obf, 1, 0, frames, fParameters[0]);
  1171. }
  1172. // -------------------------------------------------------------------
  1173. // Plugin UI calls
  1174. void uiShow(const bool show) override
  1175. {
  1176. if (show)
  1177. {
  1178. if (fWindow == nullptr)
  1179. {
  1180. fWindow = new HelperWindow();
  1181. fWindow->setName(getUiName());
  1182. }
  1183. if (fView == nullptr)
  1184. fView = new VexEditorComponent();
  1185. fWindow->show(fView);
  1186. }
  1187. else if (fWindow != nullptr)
  1188. {
  1189. fWindow->hide();
  1190. fView = nullptr;
  1191. fWindow = nullptr;
  1192. }
  1193. }
  1194. void uiIdle() override
  1195. {
  1196. if (fWindow == nullptr)
  1197. return;
  1198. if (fWindow->wasClosedByUser())
  1199. {
  1200. uiShow(false);
  1201. uiClosed();
  1202. }
  1203. }
  1204. void uiSetParameterValue(const uint32_t, const float) override
  1205. {
  1206. if (fView == nullptr)
  1207. return;
  1208. //fView->update();
  1209. }
  1210. // -------------------------------------------------------------------
  1211. // Plugin dispatcher calls
  1212. void bufferSizeChanged(const uint32_t bufferSize) override
  1213. {
  1214. delete obf;
  1215. delete abf;
  1216. delete dbf1;
  1217. delete dbf2;
  1218. delete dbf3;
  1219. obf = new AudioSampleBuffer(2, bufferSize);
  1220. abf = new AudioSampleBuffer(2, bufferSize);
  1221. dbf1 = new AudioSampleBuffer(2, bufferSize);
  1222. dbf2 = new AudioSampleBuffer(2, bufferSize);
  1223. dbf3 = new AudioSampleBuffer(2, bufferSize);
  1224. }
  1225. void sampleRateChanged(const double sampleRate) override
  1226. {
  1227. fChorus.setSampleRate(sampleRate);
  1228. fDelay.setSampleRate(sampleRate);
  1229. fSynth.setSampleRate(sampleRate);
  1230. }
  1231. void uiNameChanged(const char* const uiName) override
  1232. {
  1233. if (fWindow == nullptr)
  1234. return;
  1235. fWindow->setName(uiName);
  1236. }
  1237. private:
  1238. float fParameters[92];
  1239. AudioSampleBuffer* obf;
  1240. AudioSampleBuffer* abf;
  1241. AudioSampleBuffer* dbf1; // delay
  1242. AudioSampleBuffer* dbf2; // chorus
  1243. AudioSampleBuffer* dbf3; // reverb
  1244. VexChorus fChorus;
  1245. VexDelay fDelay;
  1246. VexReverb fReverb;
  1247. VexSyntModule fSynth;
  1248. ScopedPointer<VexEditorComponent> fView;
  1249. ScopedPointer<HelperWindow> fWindow;
  1250. PluginClassEND(VexSynthPlugin)
  1251. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexSynthPlugin)
  1252. };
  1253. // -----------------------------------------------------------------------
  1254. static const PluginDescriptor vexArpDesc = {
  1255. /* category */ PLUGIN_CATEGORY_UTILITY,
  1256. /* hints */ static_cast<PluginHints>(PLUGIN_HAS_GUI|PLUGIN_NEEDS_SINGLE_THREAD|PLUGIN_USES_TIME),
  1257. /* supports */ static_cast<PluginSupports>(PLUGIN_SUPPORTS_EVERYTHING),
  1258. /* audioIns */ 0,
  1259. /* audioOuts */ 0,
  1260. /* midiIns */ 1,
  1261. /* midiOuts */ 1,
  1262. /* paramIns */ VexArpPlugin::kParamCount,
  1263. /* paramOuts */ 0,
  1264. /* name */ "VexArp",
  1265. /* label */ "vexArp",
  1266. /* maker */ "falkTX",
  1267. /* copyright */ "GNU GPL v2+",
  1268. PluginDescriptorFILL(VexArpPlugin)
  1269. };
  1270. static const PluginDescriptor vexChorusDesc = {
  1271. /* category */ PLUGIN_CATEGORY_MODULATOR,
  1272. /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE),
  1273. /* supports */ static_cast<PluginSupports>(0x0),
  1274. /* audioIns */ 2,
  1275. /* audioOuts */ 2,
  1276. /* midiIns */ 0,
  1277. /* midiOuts */ 0,
  1278. /* paramIns */ VexChorusPlugin::kParamCount,
  1279. /* paramOuts */ 0,
  1280. /* name */ "VexChorus",
  1281. /* label */ "vexChorus",
  1282. /* maker */ "falkTX",
  1283. /* copyright */ "GNU GPL v2+",
  1284. PluginDescriptorFILL(VexChorusPlugin)
  1285. };
  1286. static const PluginDescriptor vexDelayDesc = {
  1287. /* category */ PLUGIN_CATEGORY_DELAY,
  1288. /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_TIME),
  1289. /* supports */ static_cast<PluginSupports>(0x0),
  1290. /* audioIns */ 2,
  1291. /* audioOuts */ 2,
  1292. /* midiIns */ 0,
  1293. /* midiOuts */ 0,
  1294. /* paramIns */ VexDelayPlugin::kParamCount,
  1295. /* paramOuts */ 0,
  1296. /* name */ "VexDelay",
  1297. /* label */ "vexDelay",
  1298. /* maker */ "falkTX",
  1299. /* copyright */ "GNU GPL v2+",
  1300. PluginDescriptorFILL(VexDelayPlugin)
  1301. };
  1302. static const PluginDescriptor vexReverbDesc = {
  1303. /* category */ PLUGIN_CATEGORY_DELAY,
  1304. /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE),
  1305. /* supports */ static_cast<PluginSupports>(0x0),
  1306. /* audioIns */ 2,
  1307. /* audioOuts */ 2,
  1308. /* midiIns */ 0,
  1309. /* midiOuts */ 0,
  1310. /* paramIns */ VexReverbPlugin::kParamCount,
  1311. /* paramOuts */ 0,
  1312. /* name */ "VexReverb",
  1313. /* label */ "vexReverb",
  1314. /* maker */ "falkTX",
  1315. /* copyright */ "GNU GPL v2+",
  1316. PluginDescriptorFILL(VexReverbPlugin)
  1317. };
  1318. static const PluginDescriptor vexSynthDesc = {
  1319. /* category */ PLUGIN_CATEGORY_SYNTH,
  1320. /* hints */ static_cast<PluginHints>(PLUGIN_HAS_GUI|PLUGIN_NEEDS_SINGLE_THREAD|PLUGIN_USES_TIME),
  1321. /* supports */ static_cast<PluginSupports>(0x0),
  1322. /* audioIns */ 0,
  1323. /* audioOuts */ 2,
  1324. /* midiIns */ 1,
  1325. /* midiOuts */ 0,
  1326. /* paramIns */ VexSynthPlugin::kParamCount,
  1327. /* paramOuts */ 0,
  1328. /* name */ "VexSynth",
  1329. /* label */ "vexSynth",
  1330. /* maker */ "falkTX",
  1331. /* copyright */ "GNU GPL v2+",
  1332. PluginDescriptorFILL(VexSynthPlugin)
  1333. };
  1334. // -----------------------------------------------------------------------
  1335. CARLA_EXPORT
  1336. void carla_register_native_plugin_vex()
  1337. {
  1338. carla_register_native_plugin(&vexArpDesc);
  1339. carla_register_native_plugin(&vexChorusDesc);
  1340. carla_register_native_plugin(&vexDelayDesc);
  1341. carla_register_native_plugin(&vexReverbDesc);
  1342. carla_register_native_plugin(&vexSynthDesc);
  1343. }
  1344. // -----------------------------------------------------------------------