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.

1987 lines
61KB

  1. /*
  2. * Carla Plugin discovery
  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. // if using juce, don't build UI stuff
  18. #define JUCE_PLUGIN_HOST_NO_UI
  19. #include "CarlaBackendUtils.hpp"
  20. #include "CarlaLibUtils.hpp"
  21. #include "CarlaMathUtils.hpp"
  22. #include "CarlaMIDI.h"
  23. #ifdef HAVE_JUCE
  24. # include "juce_audio_processors.h"
  25. #else
  26. # undef WANT_CSOUND
  27. #endif
  28. #ifdef WANT_LADSPA
  29. # include "CarlaLadspaUtils.hpp"
  30. #endif
  31. #ifdef WANT_DSSI
  32. # include "CarlaDssiUtils.hpp"
  33. #endif
  34. #ifdef WANT_LV2
  35. # include "CarlaLv2Utils.hpp"
  36. #endif
  37. #ifdef WANT_VST
  38. # include "CarlaVstUtils.hpp"
  39. #endif
  40. #ifdef WANT_CSOUND
  41. # include <csound/csound.hpp>
  42. #endif
  43. #ifdef WANT_FLUIDSYNTH
  44. # include <fluidsynth.h>
  45. #endif
  46. #ifdef WANT_LINUXSAMPLER
  47. # include "linuxsampler/EngineFactory.h"
  48. #endif
  49. #include <iostream>
  50. #include <QtCore/QDir>
  51. #include <QtCore/QFileInfo>
  52. #include <QtCore/QUrl>
  53. #define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl;
  54. CARLA_BACKEND_USE_NAMESPACE
  55. // --------------------------------------------------------------------------
  56. // Dummy values to test plugins with
  57. static const uint32_t kBufferSize = 512;
  58. static const double kSampleRate = 44100.0;
  59. static const float kSampleRatef = 44100.0f;
  60. // --------------------------------------------------------------------------
  61. // Don't print ELF/EXE related errors since discovery can find multi-architecture binaries
  62. static void print_lib_error(const char* const filename)
  63. {
  64. const char* const error(lib_error(filename));
  65. if (error != nullptr && std::strstr(error, "wrong ELF class") == nullptr && std::strstr(error, "Bad EXE format") == nullptr)
  66. DISCOVERY_OUT("error", error);
  67. }
  68. #ifdef WANT_VST
  69. // --------------------------------------------------------------------------
  70. // VST stuff
  71. // Check if plugin is currently processing
  72. static bool gVstIsProcessing = false;
  73. // Check if plugin needs idle
  74. static bool gVstNeedsIdle = false;
  75. // Check if plugin wants midi
  76. static bool gVstWantsMidi = false;
  77. // Check if plugin wants time
  78. static bool gVstWantsTime = false;
  79. // Current uniqueId for VST shell plugins
  80. static intptr_t gVstCurrentUniqueId = 0;
  81. // Supported Carla features
  82. static intptr_t vstHostCanDo(const char* const feature)
  83. {
  84. carla_debug("vstHostCanDo(\"%s\")", feature);
  85. if (std::strcmp(feature, "supplyIdle") == 0)
  86. return 1;
  87. if (std::strcmp(feature, "sendVstEvents") == 0)
  88. return 1;
  89. if (std::strcmp(feature, "sendVstMidiEvent") == 0)
  90. return 1;
  91. if (std::strcmp(feature, "sendVstMidiEventFlagIsRealtime") == 0)
  92. return 1;
  93. if (std::strcmp(feature, "sendVstTimeInfo") == 0)
  94. {
  95. gVstWantsTime = true;
  96. return 1;
  97. }
  98. if (std::strcmp(feature, "receiveVstEvents") == 0)
  99. return 1;
  100. if (std::strcmp(feature, "receiveVstMidiEvent") == 0)
  101. return 1;
  102. if (std::strcmp(feature, "receiveVstTimeInfo") == 0)
  103. return -1;
  104. if (std::strcmp(feature, "reportConnectionChanges") == 0)
  105. return -1;
  106. if (std::strcmp(feature, "acceptIOChanges") == 0)
  107. return 1;
  108. if (std::strcmp(feature, "sizeWindow") == 0)
  109. return 1;
  110. if (std::strcmp(feature, "offline") == 0)
  111. return -1;
  112. if (std::strcmp(feature, "openFileSelector") == 0)
  113. return -1;
  114. if (std::strcmp(feature, "closeFileSelector") == 0)
  115. return -1;
  116. if (std::strcmp(feature, "startStopProcess") == 0)
  117. return 1;
  118. if (std::strcmp(feature, "supportShell") == 0)
  119. return 1;
  120. if (std::strcmp(feature, "shellCategory") == 0)
  121. return 1;
  122. // non-official features found in some plugins:
  123. // "asyncProcessing"
  124. // "editFile"
  125. // unimplemented
  126. carla_stderr("vstHostCanDo(\"%s\") - unknown feature", feature);
  127. return 0;
  128. }
  129. // Host-side callback
  130. static intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
  131. {
  132. carla_debug("vstHostCallback(%p, %i:%s, %i, " P_INTPTR ", %p, %f)", effect, opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt);
  133. static VstTimeInfo_R timeInfo;
  134. intptr_t ret = 0;
  135. switch (opcode)
  136. {
  137. case audioMasterAutomate:
  138. ret = 1;
  139. break;
  140. case audioMasterVersion:
  141. ret = kVstVersion;
  142. break;
  143. case audioMasterCurrentId:
  144. if (gVstCurrentUniqueId == 0) DISCOVERY_OUT("warning", "plugin asked for uniqueId, but it's currently 0");
  145. ret = gVstCurrentUniqueId;
  146. break;
  147. case DECLARE_VST_DEPRECATED(audioMasterWantMidi):
  148. if (gVstWantsMidi) DISCOVERY_OUT("warning", "plugin requested MIDI more than once");
  149. gVstWantsMidi = true;
  150. ret = 1;
  151. break;
  152. case audioMasterGetTime:
  153. if (! gVstIsProcessing) DISCOVERY_OUT("warning", "plugin requested timeInfo out of process");
  154. if (! gVstWantsTime) DISCOVERY_OUT("warning", "plugin requested timeInfo but didn't ask if host could do \"sendVstTimeInfo\"");
  155. carla_zeroStruct<VstTimeInfo_R>(timeInfo);
  156. timeInfo.sampleRate = kSampleRate;
  157. // Tempo
  158. timeInfo.tempo = 120.0;
  159. timeInfo.flags |= kVstTempoValid;
  160. // Time Signature
  161. timeInfo.timeSigNumerator = 4;
  162. timeInfo.timeSigDenominator = 4;
  163. timeInfo.flags |= kVstTimeSigValid;
  164. ret = (intptr_t)&timeInfo;
  165. break;
  166. case DECLARE_VST_DEPRECATED(audioMasterTempoAt):
  167. ret = 120 * 10000;
  168. break;
  169. case DECLARE_VST_DEPRECATED(audioMasterGetNumAutomatableParameters):
  170. ret = carla_min<intptr_t>(effect->numParams, MAX_DEFAULT_PARAMETERS, 0);
  171. break;
  172. case DECLARE_VST_DEPRECATED(audioMasterGetParameterQuantization):
  173. ret = 1; // full single float precision
  174. break;
  175. case DECLARE_VST_DEPRECATED(audioMasterNeedIdle):
  176. if (gVstNeedsIdle) DISCOVERY_OUT("warning", "plugin requested idle more than once");
  177. gVstNeedsIdle = true;
  178. ret = 1;
  179. break;
  180. case audioMasterGetSampleRate:
  181. ret = kSampleRate;
  182. break;
  183. case audioMasterGetBlockSize:
  184. ret = kBufferSize;
  185. break;
  186. case DECLARE_VST_DEPRECATED(audioMasterWillReplaceOrAccumulate):
  187. ret = 1; // replace
  188. break;
  189. case audioMasterGetCurrentProcessLevel:
  190. ret = gVstIsProcessing ? kVstProcessLevelRealtime : kVstProcessLevelUser;
  191. break;
  192. case audioMasterGetAutomationState:
  193. ret = kVstAutomationOff;
  194. break;
  195. case audioMasterGetVendorString:
  196. CARLA_SAFE_ASSERT_BREAK(ptr != nullptr);
  197. std::strcpy((char*)ptr, "falkTX");
  198. ret = 1;
  199. break;
  200. case audioMasterGetProductString:
  201. CARLA_SAFE_ASSERT_BREAK(ptr != nullptr);
  202. std::strcpy((char*)ptr, "Carla-Discovery");
  203. ret = 1;
  204. break;
  205. case audioMasterGetVendorVersion:
  206. ret = CARLA_VERSION_HEX;
  207. break;
  208. case audioMasterCanDo:
  209. CARLA_SAFE_ASSERT_BREAK(ptr != nullptr);
  210. ret = vstHostCanDo((const char*)ptr);
  211. break;
  212. case audioMasterGetLanguage:
  213. ret = kVstLangEnglish;
  214. break;
  215. default:
  216. carla_stdout("vstHostCallback(%p, %i:%s, %i, " P_INTPTR ", %p, %f)", effect, opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt);
  217. break;
  218. }
  219. return ret;
  220. }
  221. #endif
  222. #ifdef WANT_CSOUND
  223. // --------------------------------------------------------------------------
  224. // Csound stuff
  225. static int csound_midiInOpen(CSOUND*, void**, const char*) { return 0; }
  226. static int csound_midiRead(CSOUND*, void*, unsigned char*, int) { return 0; }
  227. static int csound_midiInClose(CSOUND*, void*) { return 0; }
  228. static int csound_midiOutOpen(CSOUND*, void**, const char*) { return 0; }
  229. static int csound_midiWrite(CSOUND*, void*, const unsigned char*, int) { return 0; }
  230. static int csound_midiOutClose(CSOUND*, void*) { return 0; }
  231. # ifndef DEBUG
  232. static void csound_silence(CSOUND*, int, const char*, va_list) {}
  233. # endif
  234. #endif
  235. #ifdef WANT_LINUXSAMPLER
  236. // --------------------------------------------------------------------------
  237. // LinuxSampler stuff
  238. class LinuxSamplerScopedEngine
  239. {
  240. public:
  241. LinuxSamplerScopedEngine(const char* const filename, const char* const stype)
  242. : fEngine(nullptr)
  243. {
  244. using namespace LinuxSampler;
  245. try {
  246. fEngine = EngineFactory::Create(stype);
  247. }
  248. catch (const Exception& e)
  249. {
  250. DISCOVERY_OUT("error", e.what());
  251. return;
  252. }
  253. if (fEngine == nullptr)
  254. return;
  255. InstrumentManager* const insMan(fEngine->GetInstrumentManager());
  256. if (insMan == nullptr)
  257. {
  258. DISCOVERY_OUT("error", "Failed to get LinuxSampler instrument manager");
  259. return;
  260. }
  261. std::vector<InstrumentManager::instrument_id_t> ids;
  262. try {
  263. ids = insMan->GetInstrumentFileContent(filename);
  264. }
  265. catch (const InstrumentManagerException& e)
  266. {
  267. DISCOVERY_OUT("error", e.what());
  268. return;
  269. }
  270. if (ids.size() == 0)
  271. {
  272. DISCOVERY_OUT("error", "Failed to find any instruments");
  273. return;
  274. }
  275. InstrumentManager::instrument_info_t info;
  276. try {
  277. info = insMan->GetInstrumentInfo(ids[0]);
  278. }
  279. catch (const InstrumentManagerException& e)
  280. {
  281. DISCOVERY_OUT("error", e.what());
  282. return;
  283. }
  284. outputInfo(&info, ids.size());
  285. }
  286. ~LinuxSamplerScopedEngine()
  287. {
  288. if (fEngine != nullptr)
  289. {
  290. LinuxSampler::EngineFactory::Destroy(fEngine);
  291. fEngine = nullptr;
  292. }
  293. }
  294. static void outputInfo(const LinuxSampler::InstrumentManager::instrument_info_t* const info, const size_t programs, const char* const basename = nullptr)
  295. {
  296. CarlaString name;
  297. const char* label;
  298. if (info != nullptr)
  299. {
  300. name = info->InstrumentName.c_str();
  301. label = info->Product.c_str();
  302. }
  303. else
  304. {
  305. name = basename;
  306. label = basename;
  307. }
  308. // 2 channels
  309. DISCOVERY_OUT("init", "-----------");
  310. DISCOVERY_OUT("name", (const char*)name);
  311. DISCOVERY_OUT("label", label);
  312. if (info != nullptr)
  313. {
  314. DISCOVERY_OUT("maker", info->Artists);
  315. DISCOVERY_OUT("copyright", info->Artists);
  316. }
  317. DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH);
  318. DISCOVERY_OUT("audio.outs", 2);
  319. DISCOVERY_OUT("midi.ins", 1);
  320. DISCOVERY_OUT("programs", programs);
  321. DISCOVERY_OUT("build", BINARY_NATIVE);
  322. DISCOVERY_OUT("end", "------------");
  323. if (name.isEmpty() || programs <= 1)
  324. return;
  325. name += " (16 outputs)";
  326. // 16 channels
  327. DISCOVERY_OUT("init", "-----------");
  328. DISCOVERY_OUT("name", (const char*)name);
  329. DISCOVERY_OUT("label", label);
  330. if (info != nullptr)
  331. {
  332. DISCOVERY_OUT("maker", info->Artists);
  333. DISCOVERY_OUT("copyright", info->Artists);
  334. }
  335. DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH);
  336. DISCOVERY_OUT("audio.outs", 2);
  337. DISCOVERY_OUT("midi.ins", 1);
  338. DISCOVERY_OUT("programs", programs);
  339. DISCOVERY_OUT("build", BINARY_NATIVE);
  340. DISCOVERY_OUT("end", "------------");
  341. }
  342. private:
  343. LinuxSampler::Engine* fEngine;
  344. CARLA_PREVENT_HEAP_ALLOCATION
  345. CARLA_DECLARE_NON_COPY_CLASS(LinuxSamplerScopedEngine)
  346. };
  347. #endif
  348. // ------------------------------ Plugin Checks -----------------------------
  349. static void do_ladspa_check(void*& libHandle, const char* const filename, const bool init)
  350. {
  351. #ifdef WANT_LADSPA
  352. LADSPA_Descriptor_Function descFn = (LADSPA_Descriptor_Function)lib_symbol(libHandle, "ladspa_descriptor");
  353. if (descFn == nullptr)
  354. {
  355. DISCOVERY_OUT("error", "Not a LADSPA plugin");
  356. return;
  357. }
  358. const LADSPA_Descriptor* descriptor;
  359. {
  360. descriptor = descFn(0);
  361. if (descriptor == nullptr)
  362. {
  363. DISCOVERY_OUT("error", "Binary doesn't contain any plugins");
  364. return;
  365. }
  366. if (init && descriptor->instantiate != nullptr && descriptor->cleanup != nullptr)
  367. {
  368. LADSPA_Handle handle = descriptor->instantiate(descriptor, kSampleRate);
  369. if (handle == nullptr)
  370. {
  371. DISCOVERY_OUT("error", "Failed to init first LADSPA plugin");
  372. return;
  373. }
  374. descriptor->cleanup(handle);
  375. lib_close(libHandle);
  376. libHandle = lib_open(filename);
  377. if (libHandle == nullptr)
  378. {
  379. print_lib_error(filename);
  380. return;
  381. }
  382. descFn = (LADSPA_Descriptor_Function)lib_symbol(libHandle, "ladspa_descriptor");
  383. if (descFn == nullptr)
  384. {
  385. DISCOVERY_OUT("error", "Not a LADSPA plugin (#2)");
  386. return;
  387. }
  388. }
  389. }
  390. unsigned long i = 0;
  391. while ((descriptor = descFn(i++)) != nullptr)
  392. {
  393. if (descriptor->instantiate == nullptr)
  394. {
  395. DISCOVERY_OUT("error", "Plugin '" << descriptor->Name << "' has no instantiate()");
  396. continue;
  397. }
  398. if (descriptor->cleanup == nullptr)
  399. {
  400. DISCOVERY_OUT("error", "Plugin '" << descriptor->Name << "' has no cleanup()");
  401. continue;
  402. }
  403. if (descriptor->run == nullptr)
  404. {
  405. DISCOVERY_OUT("error", "Plugin '" << descriptor->Name << "' has no run()");
  406. continue;
  407. }
  408. if (! LADSPA_IS_HARD_RT_CAPABLE(descriptor->Properties))
  409. {
  410. DISCOVERY_OUT("warning", "Plugin '" << descriptor->Name << "' is not hard real-time capable");
  411. }
  412. uint hints = 0x0;
  413. int audioIns = 0;
  414. int audioOuts = 0;
  415. int audioTotal = 0;
  416. int parametersIns = 0;
  417. int parametersOuts = 0;
  418. int parametersTotal = 0;
  419. if (LADSPA_IS_HARD_RT_CAPABLE(descriptor->Properties))
  420. hints |= PLUGIN_IS_RTSAFE;
  421. for (unsigned long j=0; j < descriptor->PortCount; ++j)
  422. {
  423. CARLA_ASSERT(descriptor->PortNames[j] != nullptr);
  424. const LADSPA_PortDescriptor portDescriptor = descriptor->PortDescriptors[j];
  425. if (LADSPA_IS_PORT_AUDIO(portDescriptor))
  426. {
  427. if (LADSPA_IS_PORT_INPUT(portDescriptor))
  428. audioIns += 1;
  429. else if (LADSPA_IS_PORT_OUTPUT(portDescriptor))
  430. audioOuts += 1;
  431. audioTotal += 1;
  432. }
  433. else if (LADSPA_IS_PORT_CONTROL(portDescriptor))
  434. {
  435. if (LADSPA_IS_PORT_INPUT(portDescriptor))
  436. parametersIns += 1;
  437. else if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && std::strcmp(descriptor->PortNames[j], "latency") != 0 && std::strcmp(descriptor->PortNames[j], "_latency") != 0)
  438. parametersOuts += 1;
  439. parametersTotal += 1;
  440. }
  441. }
  442. if (init)
  443. {
  444. // -----------------------------------------------------------------------
  445. // start crash-free plugin test
  446. LADSPA_Handle handle = descriptor->instantiate(descriptor, kSampleRate);
  447. if (handle == nullptr)
  448. {
  449. DISCOVERY_OUT("error", "Failed to init LADSPA plugin");
  450. continue;
  451. }
  452. // Test quick init and cleanup
  453. descriptor->cleanup(handle);
  454. handle = descriptor->instantiate(descriptor, kSampleRate);
  455. if (handle == nullptr)
  456. {
  457. DISCOVERY_OUT("error", "Failed to init LADSPA plugin (#2)");
  458. continue;
  459. }
  460. LADSPA_Data bufferAudio[kBufferSize][audioTotal];
  461. LADSPA_Data bufferParams[parametersTotal];
  462. LADSPA_Data min, max, def;
  463. for (unsigned long j=0, iA=0, iC=0; j < descriptor->PortCount; ++j)
  464. {
  465. const LADSPA_PortDescriptor portDescriptor = descriptor->PortDescriptors[j];
  466. const LADSPA_PortRangeHint portRangeHints = descriptor->PortRangeHints[j];
  467. const char* const portName = descriptor->PortNames[j];
  468. if (LADSPA_IS_PORT_AUDIO(portDescriptor))
  469. {
  470. carla_zeroFloat(bufferAudio[iA], kBufferSize);
  471. descriptor->connect_port(handle, j, bufferAudio[iA++]);
  472. }
  473. else if (LADSPA_IS_PORT_CONTROL(portDescriptor))
  474. {
  475. // min value
  476. if (LADSPA_IS_HINT_BOUNDED_BELOW(portRangeHints.HintDescriptor))
  477. min = portRangeHints.LowerBound;
  478. else
  479. min = 0.0f;
  480. // max value
  481. if (LADSPA_IS_HINT_BOUNDED_ABOVE(portRangeHints.HintDescriptor))
  482. max = portRangeHints.UpperBound;
  483. else
  484. max = 1.0f;
  485. if (min > max)
  486. {
  487. DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max");
  488. max = min + 0.1f;
  489. }
  490. else if (max - min == 0.0f)
  491. {
  492. DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max - min == 0");
  493. max = min + 0.1f;
  494. }
  495. // default value
  496. def = get_default_ladspa_port_value(portRangeHints.HintDescriptor, min, max);
  497. if (LADSPA_IS_HINT_SAMPLE_RATE(portRangeHints.HintDescriptor))
  498. {
  499. min *= kSampleRatef;
  500. max *= kSampleRatef;
  501. def *= kSampleRatef;
  502. }
  503. if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && (std::strcmp(portName, "latency") == 0 || std::strcmp(portName, "_latency") == 0))
  504. {
  505. // latency parameter
  506. def = 0.0f;
  507. }
  508. else
  509. {
  510. if (def < min)
  511. def = min;
  512. else if (def > max)
  513. def = max;
  514. }
  515. bufferParams[iC] = def;
  516. descriptor->connect_port(handle, j, &bufferParams[iC++]);
  517. }
  518. }
  519. if (descriptor->activate != nullptr)
  520. descriptor->activate(handle);
  521. descriptor->run(handle, kBufferSize);
  522. if (descriptor->deactivate != nullptr)
  523. descriptor->deactivate(handle);
  524. descriptor->cleanup(handle);
  525. // end crash-free plugin test
  526. // -----------------------------------------------------------------------
  527. }
  528. DISCOVERY_OUT("init", "-----------");
  529. DISCOVERY_OUT("name", descriptor->Name);
  530. DISCOVERY_OUT("label", descriptor->Label);
  531. DISCOVERY_OUT("maker", descriptor->Maker);
  532. DISCOVERY_OUT("copyright", descriptor->Copyright);
  533. DISCOVERY_OUT("uniqueId", descriptor->UniqueID);
  534. DISCOVERY_OUT("hints", hints);
  535. DISCOVERY_OUT("audio.ins", audioIns);
  536. DISCOVERY_OUT("audio.outs", audioOuts);
  537. DISCOVERY_OUT("parameters.ins", parametersIns);
  538. DISCOVERY_OUT("parameters.outs", parametersOuts);
  539. DISCOVERY_OUT("build", BINARY_NATIVE);
  540. DISCOVERY_OUT("end", "------------");
  541. }
  542. #else
  543. DISCOVERY_OUT("error", "LADSPA support not available");
  544. return;
  545. // unused
  546. (void)libHandle;
  547. (void)filename;
  548. (void)init;
  549. #endif
  550. }
  551. static void do_dssi_check(void*& libHandle, const char* const filename, const bool init)
  552. {
  553. #ifdef WANT_DSSI
  554. DSSI_Descriptor_Function descFn = (DSSI_Descriptor_Function)lib_symbol(libHandle, "dssi_descriptor");
  555. if (descFn == nullptr)
  556. {
  557. DISCOVERY_OUT("error", "Not a DSSI plugin");
  558. return;
  559. }
  560. const DSSI_Descriptor* descriptor;
  561. {
  562. descriptor = descFn(0);
  563. if (descriptor == nullptr)
  564. {
  565. DISCOVERY_OUT("error", "Binary doesn't contain any plugins");
  566. return;
  567. }
  568. const LADSPA_Descriptor* const ldescriptor(descriptor->LADSPA_Plugin);
  569. if (ldescriptor == nullptr)
  570. {
  571. DISCOVERY_OUT("error", "DSSI plugin doesn't provide the LADSPA interface");
  572. return;
  573. }
  574. if (init && ldescriptor->instantiate != nullptr && ldescriptor->cleanup != nullptr)
  575. {
  576. LADSPA_Handle handle = ldescriptor->instantiate(ldescriptor, kSampleRate);
  577. if (handle == nullptr)
  578. {
  579. DISCOVERY_OUT("error", "Failed to init first LADSPA plugin");
  580. return;
  581. }
  582. ldescriptor->cleanup(handle);
  583. lib_close(libHandle);
  584. libHandle = lib_open(filename);
  585. if (libHandle == nullptr)
  586. {
  587. print_lib_error(filename);
  588. return;
  589. }
  590. descFn = (DSSI_Descriptor_Function)lib_symbol(libHandle, "dssi_descriptor");
  591. if (descFn == nullptr)
  592. {
  593. DISCOVERY_OUT("error", "Not a DSSI plugin (#2)");
  594. return;
  595. }
  596. }
  597. }
  598. unsigned long i = 0;
  599. while ((descriptor = descFn(i++)) != nullptr)
  600. {
  601. const LADSPA_Descriptor* const ldescriptor(descriptor->LADSPA_Plugin);
  602. if (ldescriptor == nullptr)
  603. {
  604. DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no LADSPA interface");
  605. continue;
  606. }
  607. if (descriptor->DSSI_API_Version != DSSI_VERSION_MAJOR)
  608. {
  609. DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' uses an unsupported DSSI spec version " << descriptor->DSSI_API_Version);
  610. continue;
  611. }
  612. if (ldescriptor->instantiate == nullptr)
  613. {
  614. DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no instantiate()");
  615. continue;
  616. }
  617. if (ldescriptor->cleanup == nullptr)
  618. {
  619. DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no cleanup()");
  620. continue;
  621. }
  622. if (ldescriptor->run == nullptr && descriptor->run_synth == nullptr && descriptor->run_multiple_synths == nullptr)
  623. {
  624. DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no run(), run_synth() or run_multiple_synths()");
  625. continue;
  626. }
  627. if (! LADSPA_IS_HARD_RT_CAPABLE(ldescriptor->Properties))
  628. {
  629. DISCOVERY_OUT("warning", "Plugin '" << ldescriptor->Name << "' is not hard real-time capable");
  630. }
  631. uint hints = 0x0;
  632. int audioIns = 0;
  633. int audioOuts = 0;
  634. int audioTotal = 0;
  635. int midiIns = 0;
  636. int parametersIns = 0;
  637. int parametersOuts = 0;
  638. int parametersTotal = 0;
  639. ulong programs = 0;
  640. if (LADSPA_IS_HARD_RT_CAPABLE(ldescriptor->Properties))
  641. hints |= PLUGIN_IS_RTSAFE;
  642. for (unsigned long j=0; j < ldescriptor->PortCount; ++j)
  643. {
  644. CARLA_ASSERT(ldescriptor->PortNames[j] != nullptr);
  645. const LADSPA_PortDescriptor portDescriptor = ldescriptor->PortDescriptors[j];
  646. if (LADSPA_IS_PORT_AUDIO(portDescriptor))
  647. {
  648. if (LADSPA_IS_PORT_INPUT(portDescriptor))
  649. audioIns += 1;
  650. else if (LADSPA_IS_PORT_OUTPUT(portDescriptor))
  651. audioOuts += 1;
  652. audioTotal += 1;
  653. }
  654. else if (LADSPA_IS_PORT_CONTROL(portDescriptor))
  655. {
  656. if (LADSPA_IS_PORT_INPUT(portDescriptor))
  657. parametersIns += 1;
  658. else if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && std::strcmp(ldescriptor->PortNames[j], "latency") != 0 && std::strcmp(ldescriptor->PortNames[j], "_latency") != 0)
  659. parametersOuts += 1;
  660. parametersTotal += 1;
  661. }
  662. }
  663. if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr)
  664. midiIns = 1;
  665. if (midiIns > 0 && audioIns == 0 && audioOuts > 0)
  666. hints |= PLUGIN_IS_SYNTH;
  667. if (const char* const ui = find_dssi_ui(filename, ldescriptor->Label))
  668. {
  669. hints |= PLUGIN_HAS_CUSTOM_UI;
  670. delete[] ui;
  671. }
  672. if (init)
  673. {
  674. // -----------------------------------------------------------------------
  675. // start crash-free plugin test
  676. LADSPA_Handle handle = ldescriptor->instantiate(ldescriptor, kSampleRate);
  677. if (handle == nullptr)
  678. {
  679. DISCOVERY_OUT("error", "Failed to init DSSI plugin");
  680. continue;
  681. }
  682. // Test quick init and cleanup
  683. ldescriptor->cleanup(handle);
  684. handle = ldescriptor->instantiate(ldescriptor, kSampleRate);
  685. if (handle == nullptr)
  686. {
  687. DISCOVERY_OUT("error", "Failed to init DSSI plugin (#2)");
  688. continue;
  689. }
  690. if (descriptor->get_program != nullptr && descriptor->select_program != nullptr)
  691. {
  692. for (; descriptor->get_program(handle, programs) != nullptr;)
  693. ++programs;
  694. }
  695. LADSPA_Data bufferAudio[kBufferSize][audioTotal];
  696. LADSPA_Data bufferParams[parametersTotal];
  697. LADSPA_Data min, max, def;
  698. for (unsigned long j=0, iA=0, iC=0; j < ldescriptor->PortCount; ++j)
  699. {
  700. const LADSPA_PortDescriptor portDescriptor = ldescriptor->PortDescriptors[j];
  701. const LADSPA_PortRangeHint portRangeHints = ldescriptor->PortRangeHints[j];
  702. const char* const portName = ldescriptor->PortNames[j];
  703. if (LADSPA_IS_PORT_AUDIO(portDescriptor))
  704. {
  705. carla_zeroFloat(bufferAudio[iA], kBufferSize);
  706. ldescriptor->connect_port(handle, j, bufferAudio[iA++]);
  707. }
  708. else if (LADSPA_IS_PORT_CONTROL(portDescriptor))
  709. {
  710. // min value
  711. if (LADSPA_IS_HINT_BOUNDED_BELOW(portRangeHints.HintDescriptor))
  712. min = portRangeHints.LowerBound;
  713. else
  714. min = 0.0f;
  715. // max value
  716. if (LADSPA_IS_HINT_BOUNDED_ABOVE(portRangeHints.HintDescriptor))
  717. max = portRangeHints.UpperBound;
  718. else
  719. max = 1.0f;
  720. if (min > max)
  721. {
  722. DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max");
  723. max = min + 0.1f;
  724. }
  725. else if (max - min == 0.0f)
  726. {
  727. DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max - min == 0");
  728. max = min + 0.1f;
  729. }
  730. // default value
  731. def = get_default_ladspa_port_value(portRangeHints.HintDescriptor, min, max);
  732. if (LADSPA_IS_HINT_SAMPLE_RATE(portRangeHints.HintDescriptor))
  733. {
  734. min *= kSampleRatef;
  735. max *= kSampleRatef;
  736. def *= kSampleRatef;
  737. }
  738. if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && (std::strcmp(portName, "latency") == 0 || std::strcmp(portName, "_latency") == 0))
  739. {
  740. // latency parameter
  741. def = 0.0f;
  742. }
  743. else
  744. {
  745. if (def < min)
  746. def = min;
  747. else if (def > max)
  748. def = max;
  749. }
  750. bufferParams[iC] = def;
  751. ldescriptor->connect_port(handle, j, &bufferParams[iC++]);
  752. }
  753. }
  754. // select first midi-program if available
  755. if (programs > 0)
  756. {
  757. if (const DSSI_Program_Descriptor* const pDesc = descriptor->get_program(handle, 0))
  758. descriptor->select_program(handle, pDesc->Bank, pDesc->Program);
  759. }
  760. if (ldescriptor->activate != nullptr)
  761. ldescriptor->activate(handle);
  762. if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr)
  763. {
  764. snd_seq_event_t midiEvents[2];
  765. carla_zeroStruct<snd_seq_event_t>(midiEvents, 2);
  766. const unsigned long midiEventCount = 2;
  767. midiEvents[0].type = SND_SEQ_EVENT_NOTEON;
  768. midiEvents[0].data.note.note = 64;
  769. midiEvents[0].data.note.velocity = 100;
  770. midiEvents[1].type = SND_SEQ_EVENT_NOTEOFF;
  771. midiEvents[1].data.note.note = 64;
  772. midiEvents[1].data.note.velocity = 0;
  773. midiEvents[1].time.tick = kBufferSize/2;
  774. if (descriptor->run_multiple_synths != nullptr && descriptor->run_synth == nullptr)
  775. {
  776. LADSPA_Handle handlePtr[1] = { handle };
  777. snd_seq_event_t* midiEventsPtr[1] = { midiEvents };
  778. unsigned long midiEventCountPtr[1] = { midiEventCount };
  779. descriptor->run_multiple_synths(1, handlePtr, kBufferSize, midiEventsPtr, midiEventCountPtr);
  780. }
  781. else
  782. descriptor->run_synth(handle, kBufferSize, midiEvents, midiEventCount);
  783. }
  784. else
  785. ldescriptor->run(handle, kBufferSize);
  786. if (ldescriptor->deactivate != nullptr)
  787. ldescriptor->deactivate(handle);
  788. ldescriptor->cleanup(handle);
  789. // end crash-free plugin test
  790. // -----------------------------------------------------------------------
  791. }
  792. DISCOVERY_OUT("init", "-----------");
  793. DISCOVERY_OUT("name", ldescriptor->Name);
  794. DISCOVERY_OUT("label", ldescriptor->Label);
  795. DISCOVERY_OUT("maker", ldescriptor->Maker);
  796. DISCOVERY_OUT("copyright", ldescriptor->Copyright);
  797. DISCOVERY_OUT("uniqueId", ldescriptor->UniqueID);
  798. DISCOVERY_OUT("hints", hints);
  799. DISCOVERY_OUT("audio.ins", audioIns);
  800. DISCOVERY_OUT("audio.outs", audioOuts);
  801. DISCOVERY_OUT("midi.ins", midiIns);
  802. DISCOVERY_OUT("parameters.ins", parametersIns);
  803. DISCOVERY_OUT("parameters.outs", parametersOuts);
  804. DISCOVERY_OUT("programs", programs);
  805. DISCOVERY_OUT("build", BINARY_NATIVE);
  806. DISCOVERY_OUT("end", "------------");
  807. }
  808. #else
  809. DISCOVERY_OUT("error", "DSSI support not available");
  810. return;
  811. // unused
  812. (void)libHandle;
  813. (void)filename;
  814. (void)init;
  815. #endif
  816. }
  817. static void do_lv2_check(const char* const bundle, const bool init)
  818. {
  819. #ifdef WANT_LV2
  820. Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());
  821. // Convert bundle filename to URI
  822. QString qBundle(QUrl::fromLocalFile(bundle).toString());
  823. if (! qBundle.endsWith(OS_SEP_STR))
  824. qBundle += OS_SEP_STR;
  825. // Load bundle
  826. Lilv::Node lilvBundle(lv2World.new_uri(qBundle.toUtf8().constData()));
  827. lv2World.load_bundle(lilvBundle);
  828. // Load plugins in this bundle
  829. const Lilv::Plugins lilvPlugins(lv2World.get_all_plugins());
  830. // Get all plugin URIs in this bundle
  831. QStringList URIs;
  832. LILV_FOREACH(plugins, it, lilvPlugins)
  833. {
  834. Lilv::Plugin lilvPlugin(lilv_plugins_get(lilvPlugins, it));
  835. if (const char* const uri = lilvPlugin.get_uri().as_string())
  836. URIs.append(QString(uri));
  837. }
  838. if (URIs.count() == 0)
  839. {
  840. DISCOVERY_OUT("warning", "LV2 Bundle doesn't provide any plugins");
  841. return;
  842. }
  843. // Get & check every plugin-instance
  844. for (int i=0, count=URIs.count(); i < count; ++i)
  845. {
  846. const LV2_RDF_Descriptor* const rdfDescriptor(lv2_rdf_new(URIs.at(i).toUtf8().constData(), false));
  847. if (rdfDescriptor == nullptr || rdfDescriptor->URI == nullptr)
  848. {
  849. DISCOVERY_OUT("error", "Failed to find LV2 plugin '" << URIs.at(i).toUtf8().constData() << "'");
  850. continue;
  851. }
  852. if (init)
  853. {
  854. // test if DLL is loadable, twice
  855. void* const libHandle1 = lib_open(rdfDescriptor->Binary);
  856. if (libHandle1 == nullptr)
  857. {
  858. print_lib_error(rdfDescriptor->Binary);
  859. delete rdfDescriptor;
  860. continue;
  861. }
  862. lib_close(libHandle1);
  863. void* const libHandle2 = lib_open(rdfDescriptor->Binary);
  864. if (libHandle2 == nullptr)
  865. {
  866. print_lib_error(rdfDescriptor->Binary);
  867. delete rdfDescriptor;
  868. continue;
  869. }
  870. lib_close(libHandle2);
  871. }
  872. // test if we support all required ports and features
  873. {
  874. bool supported = true;
  875. for (uint32_t j=0; j < rdfDescriptor->PortCount && supported; ++j)
  876. {
  877. const LV2_RDF_Port* const rdfPort(&rdfDescriptor->Ports[j]);
  878. if (is_lv2_port_supported(rdfPort->Types))
  879. {
  880. pass();
  881. }
  882. else if (! LV2_IS_PORT_OPTIONAL(rdfPort->Properties))
  883. {
  884. DISCOVERY_OUT("error", "Plugin '" << rdfDescriptor->URI << "' requires a non-supported port type (portName: '" << rdfPort->Name << "')");
  885. supported = false;
  886. break;
  887. }
  888. }
  889. for (uint32_t j=0; j < rdfDescriptor->FeatureCount && supported; ++j)
  890. {
  891. const LV2_RDF_Feature* const rdfFeature(&rdfDescriptor->Features[j]);
  892. if (is_lv2_feature_supported(rdfFeature->URI))
  893. {
  894. pass();
  895. }
  896. else if (LV2_IS_FEATURE_REQUIRED(rdfFeature->Type))
  897. {
  898. DISCOVERY_OUT("error", "Plugin '" << rdfDescriptor->URI << "' requires a non-supported feature '" << rdfFeature->URI << "'");
  899. supported = false;
  900. break;
  901. }
  902. }
  903. if (! supported)
  904. {
  905. delete rdfDescriptor;
  906. continue;
  907. }
  908. }
  909. uint hints = 0x0;
  910. int audioIns = 0;
  911. int audioOuts = 0;
  912. int midiIns = 0;
  913. int midiOuts = 0;
  914. int parametersIns = 0;
  915. int parametersOuts = 0;
  916. uint programs = rdfDescriptor->PresetCount;
  917. for (uint32_t j=0; j < rdfDescriptor->FeatureCount; ++j)
  918. {
  919. const LV2_RDF_Feature* const rdfFeature(&rdfDescriptor->Features[j]);
  920. if (std::strcmp(rdfFeature->URI, LV2_CORE__hardRTCapable) == 0)
  921. hints |= PLUGIN_IS_RTSAFE;
  922. }
  923. for (uint32_t j=0; j < rdfDescriptor->PortCount; ++j)
  924. {
  925. const LV2_RDF_Port* const rdfPort(&rdfDescriptor->Ports[j]);
  926. if (LV2_IS_PORT_AUDIO(rdfPort->Types))
  927. {
  928. if (LV2_IS_PORT_INPUT(rdfPort->Types))
  929. audioIns += 1;
  930. else if (LV2_IS_PORT_OUTPUT(rdfPort->Types))
  931. audioOuts += 1;
  932. }
  933. else if (LV2_IS_PORT_CONTROL(rdfPort->Types))
  934. {
  935. if (LV2_IS_PORT_DESIGNATION_LATENCY(rdfPort->Designation))
  936. {
  937. pass();
  938. }
  939. else if (LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(rdfPort->Designation))
  940. {
  941. pass();
  942. }
  943. else if (LV2_IS_PORT_DESIGNATION_FREEWHEELING(rdfPort->Designation))
  944. {
  945. pass();
  946. }
  947. else if (LV2_IS_PORT_DESIGNATION_TIME(rdfPort->Designation))
  948. {
  949. pass();
  950. }
  951. else
  952. {
  953. if (LV2_IS_PORT_INPUT(rdfPort->Types))
  954. parametersIns += 1;
  955. else if (LV2_IS_PORT_OUTPUT(rdfPort->Types))
  956. parametersOuts += 1;
  957. }
  958. }
  959. else if (LV2_PORT_SUPPORTS_MIDI_EVENT(rdfPort->Types))
  960. {
  961. if (LV2_IS_PORT_INPUT(rdfPort->Types))
  962. midiIns += 1;
  963. else if (LV2_IS_PORT_OUTPUT(rdfPort->Types))
  964. midiOuts += 1;
  965. }
  966. }
  967. if (LV2_IS_GENERATOR(rdfDescriptor->Type[0], rdfDescriptor->Type[1]))
  968. hints |= PLUGIN_IS_SYNTH;
  969. if (rdfDescriptor->UICount > 0)
  970. hints |= PLUGIN_HAS_CUSTOM_UI;
  971. DISCOVERY_OUT("init", "-----------");
  972. DISCOVERY_OUT("uri", rdfDescriptor->URI);
  973. if (rdfDescriptor->Name != nullptr)
  974. DISCOVERY_OUT("name", rdfDescriptor->Name);
  975. if (rdfDescriptor->Author != nullptr)
  976. DISCOVERY_OUT("maker", rdfDescriptor->Author);
  977. if (rdfDescriptor->License != nullptr)
  978. DISCOVERY_OUT("copyright", rdfDescriptor->License);
  979. DISCOVERY_OUT("uniqueId", rdfDescriptor->UniqueID);
  980. DISCOVERY_OUT("hints", hints);
  981. DISCOVERY_OUT("audio.ins", audioIns);
  982. DISCOVERY_OUT("audio.outs", audioOuts);
  983. DISCOVERY_OUT("midi.ins", midiIns);
  984. DISCOVERY_OUT("midi.outs", midiOuts);
  985. DISCOVERY_OUT("parameters.ins", parametersIns);
  986. DISCOVERY_OUT("parameters.outs", parametersOuts);
  987. DISCOVERY_OUT("programs", programs);
  988. DISCOVERY_OUT("build", BINARY_NATIVE);
  989. DISCOVERY_OUT("end", "------------");
  990. delete rdfDescriptor;
  991. }
  992. #else
  993. DISCOVERY_OUT("error", "LV2 support not available");
  994. return;
  995. // unused
  996. (void)bundle;
  997. (void)init;
  998. #endif
  999. }
  1000. static void do_vst_check(void*& libHandle, const bool init)
  1001. {
  1002. #ifdef WANT_VST
  1003. VST_Function vstFn = (VST_Function)lib_symbol(libHandle, "VSTPluginMain");
  1004. if (vstFn == nullptr)
  1005. {
  1006. vstFn = (VST_Function)lib_symbol(libHandle, "main");
  1007. if (vstFn == nullptr)
  1008. {
  1009. DISCOVERY_OUT("error", "Not a VST plugin");
  1010. return;
  1011. }
  1012. }
  1013. AEffect* const effect = vstFn(vstHostCallback);
  1014. if (effect == nullptr || effect->magic != kEffectMagic)
  1015. {
  1016. DISCOVERY_OUT("error", "Failed to init VST plugin, or VST magic failed");
  1017. return;
  1018. }
  1019. if (effect->uniqueID == 0)
  1020. {
  1021. DISCOVERY_OUT("error", "Plugin doesn't have an Unique ID");
  1022. effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
  1023. return;
  1024. }
  1025. gVstCurrentUniqueId = effect->uniqueID;
  1026. effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdentify), 0, 0, nullptr, 0.0f);
  1027. effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effSetBlockSizeAndSampleRate), 0, kBufferSize, nullptr, kSampleRate);
  1028. effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, kSampleRate);
  1029. effect->dispatcher(effect, effSetBlockSize, 0, kBufferSize, nullptr, 0.0f);
  1030. effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f);
  1031. effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f);
  1032. effect->dispatcher(effect, effSetProgram, 0, 0, nullptr, 0.0f);
  1033. char strBuf[STR_MAX+1];
  1034. CarlaString cName;
  1035. CarlaString cProduct;
  1036. CarlaString cVendor;
  1037. const intptr_t vstCategory = effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f);
  1038. //for (int32_t i = effect->numInputs; --i >= 0;) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effConnectInput), i, 1, 0, 0);
  1039. //for (int32_t i = effect->numOutputs; --i >= 0;) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effConnectOutput), i, 1, 0, 0);
  1040. carla_zeroChar(strBuf, STR_MAX+1);
  1041. if (effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f) == 1)
  1042. cVendor = strBuf;
  1043. carla_zeroChar(strBuf, STR_MAX+1);
  1044. if (vstCategory == kPlugCategShell)
  1045. {
  1046. gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f);
  1047. CARLA_SAFE_ASSERT_RETURN(gVstCurrentUniqueId != 0,);
  1048. cName = strBuf;
  1049. }
  1050. else
  1051. {
  1052. if (effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f) == 1)
  1053. cName = strBuf;
  1054. }
  1055. for (;;)
  1056. {
  1057. carla_zeroChar(strBuf, STR_MAX+1);
  1058. if (effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f) == 1)
  1059. cProduct = strBuf;
  1060. else
  1061. cProduct.clear();
  1062. uint hints = 0x0;
  1063. int audioIns = effect->numInputs;
  1064. int audioOuts = effect->numOutputs;
  1065. int midiIns = 0;
  1066. int midiOuts = 0;
  1067. int parameters = effect->numParams;
  1068. int programs = effect->numPrograms;
  1069. if (effect->flags & effFlagsHasEditor)
  1070. hints |= PLUGIN_HAS_CUSTOM_UI;
  1071. if (effect->flags & effFlagsIsSynth)
  1072. hints |= PLUGIN_IS_SYNTH;
  1073. if (vstPluginCanDo(effect, "receiveVstEvents") || vstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) != 0)
  1074. midiIns = 1;
  1075. if (vstPluginCanDo(effect, "sendVstEvents") || vstPluginCanDo(effect, "sendVstMidiEvent"))
  1076. midiOuts = 1;
  1077. // -----------------------------------------------------------------------
  1078. // start crash-free plugin test
  1079. if (init)
  1080. {
  1081. if (gVstNeedsIdle)
  1082. effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f);
  1083. effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
  1084. effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
  1085. if (gVstNeedsIdle)
  1086. effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f);
  1087. // Plugin might call wantMidi() during resume
  1088. if (midiIns == 0 && gVstWantsMidi)
  1089. {
  1090. midiIns = 1;
  1091. }
  1092. float* bufferAudioIn[audioIns];
  1093. for (int j=0; j < audioIns; ++j)
  1094. {
  1095. bufferAudioIn[j] = new float[kBufferSize];
  1096. carla_zeroFloat(bufferAudioIn[j], kBufferSize);
  1097. }
  1098. float* bufferAudioOut[audioOuts];
  1099. for (int j=0; j < audioOuts; ++j)
  1100. {
  1101. bufferAudioOut[j] = new float[kBufferSize];
  1102. carla_zeroFloat(bufferAudioOut[j], kBufferSize);
  1103. }
  1104. struct VstEventsFixed {
  1105. int32_t numEvents;
  1106. intptr_t reserved;
  1107. VstEvent* data[2];
  1108. VstEventsFixed()
  1109. : numEvents(0),
  1110. reserved(0)
  1111. {
  1112. data[0] = data[1] = nullptr;
  1113. }
  1114. } events;
  1115. VstMidiEvent midiEvents[2];
  1116. carla_zeroStruct<VstMidiEvent>(midiEvents, 2);
  1117. midiEvents[0].type = kVstMidiType;
  1118. midiEvents[0].byteSize = sizeof(VstMidiEvent);
  1119. midiEvents[0].midiData[0] = char(MIDI_STATUS_NOTE_ON);
  1120. midiEvents[0].midiData[1] = 64;
  1121. midiEvents[0].midiData[2] = 100;
  1122. midiEvents[1].type = kVstMidiType;
  1123. midiEvents[1].byteSize = sizeof(VstMidiEvent);
  1124. midiEvents[1].midiData[0] = char(MIDI_STATUS_NOTE_OFF);
  1125. midiEvents[1].midiData[1] = 64;
  1126. midiEvents[1].deltaFrames = kBufferSize/2;
  1127. events.numEvents = 2;
  1128. events.data[0] = (VstEvent*)&midiEvents[0];
  1129. events.data[1] = (VstEvent*)&midiEvents[1];
  1130. // processing
  1131. gVstIsProcessing = true;
  1132. if (midiIns > 0)
  1133. effect->dispatcher(effect, effProcessEvents, 0, 0, &events, 0.0f);
  1134. if ((effect->flags & effFlagsCanReplacing) > 0 && effect->processReplacing != nullptr && effect->processReplacing != effect->DECLARE_VST_DEPRECATED(process))
  1135. effect->processReplacing(effect, bufferAudioIn, bufferAudioOut, kBufferSize);
  1136. else if (effect->DECLARE_VST_DEPRECATED(process) != nullptr)
  1137. effect->DECLARE_VST_DEPRECATED(process)(effect, bufferAudioIn, bufferAudioOut, kBufferSize);
  1138. else
  1139. DISCOVERY_OUT("error", "Plugin doesn't have a process function");
  1140. gVstIsProcessing = false;
  1141. effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
  1142. effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
  1143. if (gVstNeedsIdle)
  1144. effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f);
  1145. for (int j=0; j < audioIns; ++j)
  1146. delete[] bufferAudioIn[j];
  1147. for (int j=0; j < audioOuts; ++j)
  1148. delete[] bufferAudioOut[j];
  1149. }
  1150. // end crash-free plugin test
  1151. // -----------------------------------------------------------------------
  1152. DISCOVERY_OUT("init", "-----------");
  1153. DISCOVERY_OUT("name", (const char*)cName);
  1154. DISCOVERY_OUT("label", (const char*)cProduct);
  1155. DISCOVERY_OUT("maker", (const char*)cVendor);
  1156. DISCOVERY_OUT("copyright", (const char*)cVendor);
  1157. DISCOVERY_OUT("uniqueId", gVstCurrentUniqueId);
  1158. DISCOVERY_OUT("hints", hints);
  1159. DISCOVERY_OUT("audio.ins", audioIns);
  1160. DISCOVERY_OUT("audio.outs", audioOuts);
  1161. DISCOVERY_OUT("midi.ins", midiIns);
  1162. DISCOVERY_OUT("midi.outs", midiOuts);
  1163. DISCOVERY_OUT("parameters.ins", parameters);
  1164. DISCOVERY_OUT("programs", programs);
  1165. DISCOVERY_OUT("build", BINARY_NATIVE);
  1166. DISCOVERY_OUT("end", "------------");
  1167. if (vstCategory != kPlugCategShell)
  1168. break;
  1169. gVstWantsMidi = false;
  1170. gVstWantsTime = false;
  1171. carla_zeroChar(strBuf, STR_MAX+1);
  1172. gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f);
  1173. if (gVstCurrentUniqueId != 0)
  1174. cName = strBuf;
  1175. else
  1176. break;
  1177. }
  1178. if (gVstNeedsIdle)
  1179. effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f);
  1180. effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
  1181. #else
  1182. DISCOVERY_OUT("error", "VST support not available");
  1183. return;
  1184. // unused
  1185. (void)libHandle;
  1186. (void)init;
  1187. #endif
  1188. }
  1189. #ifdef HAVE_JUCE
  1190. static void do_juce_check(const char* const filename, const char* const stype, const bool init)
  1191. {
  1192. using namespace juce;
  1193. ScopedPointer<AudioPluginFormat> pluginFormat;
  1194. if (stype == nullptr)
  1195. return;
  1196. else if (std::strcmp(stype, "LADSPA") == 0)
  1197. {
  1198. #if defined(WANT_LADSPA) && JUCE_PLUGINHOST_LADSPA && defined(JUCE_LINUX)
  1199. pluginFormat = new LADSPAPluginFormat();
  1200. #else
  1201. DISCOVERY_OUT("error", "LADSPA support not available");
  1202. #endif
  1203. }
  1204. else if (std::strcmp(stype, "VST") == 0)
  1205. {
  1206. #if defined(WANT_VST) && JUCE_PLUGINHOST_VST
  1207. pluginFormat = new VSTPluginFormat();
  1208. #else
  1209. DISCOVERY_OUT("error", "VST support not available");
  1210. #endif
  1211. }
  1212. else if (std::strcmp(stype, "VST3") == 0)
  1213. {
  1214. #if defined(WANT_VST3) && JUCE_PLUGINHOST_VST3
  1215. pluginFormat = new VSTPluginFormat();
  1216. #else
  1217. DISCOVERY_OUT("error", "VST3 support not available");
  1218. #endif
  1219. }
  1220. else if (std::strcmp(stype, "AU") == 0)
  1221. {
  1222. #if defined(WANT_AU) && JUCE_PLUGINHOST_AU && defined(JUCE_MAC)
  1223. pluginFormat = new AudioUnitPluginFormat();
  1224. #else
  1225. DISCOVERY_OUT("error", "AU support not available");
  1226. #endif
  1227. }
  1228. if (pluginFormat == nullptr)
  1229. {
  1230. DISCOVERY_OUT("error", stype << " support not available");
  1231. return;
  1232. }
  1233. OwnedArray<PluginDescription> results;
  1234. pluginFormat->findAllTypesForFile(results, filename);
  1235. for (PluginDescription **it = results.begin(), **end = results.end(); it != end; ++it)
  1236. {
  1237. static int iv=0;
  1238. carla_stderr2("LOOKING FOR PLUGIN %i", iv++);
  1239. PluginDescription* const desc(*it);
  1240. uint hints = 0x0;
  1241. int audioIns = desc->numInputChannels;
  1242. int audioOuts = desc->numOutputChannels;
  1243. int midiIns = 0;
  1244. int midiOuts = 0;
  1245. int parameters = 0;
  1246. int programs = 0;
  1247. if (desc->isInstrument)
  1248. hints |= PLUGIN_IS_SYNTH;
  1249. if (init)
  1250. {
  1251. if (AudioPluginInstance* const instance = pluginFormat->createInstanceFromDescription(*desc, kSampleRate, kBufferSize))
  1252. {
  1253. instance->refreshParameterList();
  1254. parameters = instance->getNumParameters();
  1255. programs = instance->getNumPrograms();
  1256. if (instance->hasEditor())
  1257. hints |= PLUGIN_HAS_CUSTOM_UI;
  1258. if (instance->acceptsMidi())
  1259. midiIns = 1;
  1260. if (instance->producesMidi())
  1261. midiOuts = 1;
  1262. delete instance;
  1263. }
  1264. }
  1265. DISCOVERY_OUT("init", "-----------");
  1266. DISCOVERY_OUT("name", desc->name);
  1267. DISCOVERY_OUT("label", desc->descriptiveName);
  1268. DISCOVERY_OUT("maker", desc->manufacturerName);
  1269. DISCOVERY_OUT("copyright", desc->manufacturerName);
  1270. DISCOVERY_OUT("uniqueId", desc->uid);
  1271. DISCOVERY_OUT("hints", hints);
  1272. DISCOVERY_OUT("audio.ins", audioIns);
  1273. DISCOVERY_OUT("audio.outs", audioOuts);
  1274. DISCOVERY_OUT("midi.ins", midiIns);
  1275. DISCOVERY_OUT("midi.outs", midiOuts);
  1276. DISCOVERY_OUT("parameters.ins", parameters);
  1277. DISCOVERY_OUT("programs", programs);
  1278. DISCOVERY_OUT("build", BINARY_NATIVE);
  1279. DISCOVERY_OUT("end", "------------");
  1280. }
  1281. }
  1282. #endif
  1283. static void do_csound_check(const char* const filename, const bool init)
  1284. {
  1285. #ifdef WANT_CSOUND
  1286. Csound csound;
  1287. # ifndef DEBUG
  1288. csound.SetMessageCallback(csound_silence);
  1289. # endif
  1290. csound.SetHostImplementedAudioIO(true, kBufferSize);
  1291. csound.SetHostImplementedMIDIIO(true);
  1292. csound.Reset();
  1293. csound.SetExternalMidiInOpenCallback(csound_midiInOpen);
  1294. csound.SetExternalMidiReadCallback(csound_midiRead);
  1295. csound.SetExternalMidiInCloseCallback(csound_midiInClose);
  1296. csound.SetExternalMidiOutOpenCallback(csound_midiOutOpen);
  1297. csound.SetExternalMidiWriteCallback(csound_midiWrite);
  1298. csound.SetExternalMidiOutCloseCallback(csound_midiOutClose);
  1299. if (csound.Compile(const_cast<char*>(filename)) != 0)
  1300. {
  1301. DISCOVERY_OUT("error", "csound failed to compile");
  1302. return;
  1303. }
  1304. csound.PerformKsmps();
  1305. csound.SetScoreOffsetSeconds(0);
  1306. csound.RewindScore();
  1307. int hints = 0x0;
  1308. int audioIns = 0;
  1309. int audioOuts = 0;
  1310. int midiIns = 0;
  1311. int midiOuts = 0;
  1312. int parametersIns = 0;
  1313. int parametersOuts = 0;
  1314. int programs = 0;
  1315. int numChannels;
  1316. controlChannelInfo_t* channelList;
  1317. numChannels = csound.ListChannels(channelList);
  1318. carla_stderr2("Num chan %i", numChannels);
  1319. if (numChannels != 0 && channelList != nullptr)
  1320. {
  1321. for (int i=0; i < numChannels; ++i)
  1322. {
  1323. const controlChannelInfo_t& channel(channelList[i]);
  1324. carla_stderr2("chan @%i, type %i", i, channel.type);
  1325. if (channel.type & CSOUND_AUDIO_CHANNEL)
  1326. {
  1327. if (channel.type & CSOUND_INPUT_CHANNEL)
  1328. audioIns += 1;
  1329. else if (channel.type & CSOUND_OUTPUT_CHANNEL)
  1330. audioOuts += 1;
  1331. }
  1332. else if (channel.type & CSOUND_CONTROL_CHANNEL)
  1333. {
  1334. if (channel.type & CSOUND_INPUT_CHANNEL)
  1335. parametersIns += 1;
  1336. else if (channel.type & CSOUND_OUTPUT_CHANNEL)
  1337. parametersOuts += 1;
  1338. }
  1339. }
  1340. csound.DeleteChannelList(channelList);
  1341. }
  1342. // TODO
  1343. csound.Cleanup();
  1344. csound.Reset();
  1345. DISCOVERY_OUT("init", "-----------");
  1346. // DISCOVERY_OUT("name", (const char*)name);
  1347. // DISCOVERY_OUT("label", (const char*)label);
  1348. // DISCOVERY_OUT("maker", "");
  1349. // DISCOVERY_OUT("copyright", "");
  1350. DISCOVERY_OUT("hints", hints);
  1351. DISCOVERY_OUT("audio.ins", audioIns);
  1352. DISCOVERY_OUT("audio.outs", audioOuts);
  1353. DISCOVERY_OUT("midi.ins", midiIns);
  1354. DISCOVERY_OUT("midi.outs", midiOuts);
  1355. DISCOVERY_OUT("parameters.ins", parametersIns);
  1356. DISCOVERY_OUT("parameters.outs", parametersOuts);
  1357. DISCOVERY_OUT("programs", programs);
  1358. DISCOVERY_OUT("build", BINARY_NATIVE);
  1359. DISCOVERY_OUT("end", "------------");
  1360. #else
  1361. DISCOVERY_OUT("error", "csound support not available");
  1362. return;
  1363. // unused
  1364. (void)filename;
  1365. (void)init;
  1366. #endif
  1367. }
  1368. static void do_fluidsynth_check(const char* const filename, const bool init)
  1369. {
  1370. #ifdef WANT_FLUIDSYNTH
  1371. if (! fluid_is_soundfont(filename))
  1372. {
  1373. DISCOVERY_OUT("error", "Not a SF2 file");
  1374. return;
  1375. }
  1376. int programs = 0;
  1377. if (init)
  1378. {
  1379. fluid_settings_t* const f_settings = new_fluid_settings();
  1380. fluid_synth_t* const f_synth = new_fluid_synth(f_settings);
  1381. const int f_id = fluid_synth_sfload(f_synth, filename, 0);
  1382. if (f_id < 0)
  1383. {
  1384. DISCOVERY_OUT("error", "Failed to load SF2 file");
  1385. return;
  1386. }
  1387. fluid_sfont_t* f_sfont;
  1388. fluid_preset_t f_preset;
  1389. f_sfont = fluid_synth_get_sfont_by_id(f_synth, static_cast<uint>(f_id));
  1390. f_sfont->iteration_start(f_sfont);
  1391. while (f_sfont->iteration_next(f_sfont, &f_preset))
  1392. programs += 1;
  1393. delete_fluid_synth(f_synth);
  1394. delete_fluid_settings(f_settings);
  1395. }
  1396. CarlaString name;
  1397. if (const char* const shortname = std::strrchr(filename, OS_SEP))
  1398. name = shortname+1;
  1399. else
  1400. name = filename;
  1401. name.truncate(name.rfind('.'));
  1402. CarlaString label(name);
  1403. // 2 channels
  1404. DISCOVERY_OUT("init", "-----------");
  1405. DISCOVERY_OUT("name", (const char*)name);
  1406. DISCOVERY_OUT("label", (const char*)label);
  1407. DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH);
  1408. DISCOVERY_OUT("audio.outs", 2);
  1409. DISCOVERY_OUT("midi.ins", 1);
  1410. DISCOVERY_OUT("programs", programs);
  1411. DISCOVERY_OUT("parameters.ins", 13); // defined in Carla
  1412. DISCOVERY_OUT("parameters.outs", 1);
  1413. DISCOVERY_OUT("build", BINARY_NATIVE);
  1414. DISCOVERY_OUT("end", "------------");
  1415. // 16 channels
  1416. if (name.isEmpty() || programs <= 1)
  1417. return;
  1418. name += " (16 outputs)";
  1419. DISCOVERY_OUT("init", "-----------");
  1420. DISCOVERY_OUT("name", (const char*)name);
  1421. DISCOVERY_OUT("label", (const char*)label);
  1422. DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH);
  1423. DISCOVERY_OUT("audio.outs", 32);
  1424. DISCOVERY_OUT("midi.ins", 1);
  1425. DISCOVERY_OUT("programs", programs);
  1426. DISCOVERY_OUT("parameters.ins", 13); // defined in Carla
  1427. DISCOVERY_OUT("parameters.outs", 1);
  1428. DISCOVERY_OUT("build", BINARY_NATIVE);
  1429. DISCOVERY_OUT("end", "------------");
  1430. #else
  1431. DISCOVERY_OUT("error", "SF2 support not available");
  1432. return;
  1433. // unused
  1434. (void)filename;
  1435. (void)init;
  1436. #endif
  1437. }
  1438. static void do_linuxsampler_check(const char* const filename, const char* const stype, const bool init)
  1439. {
  1440. #ifdef WANT_LINUXSAMPLER
  1441. const QFileInfo file(filename);
  1442. if (! file.exists())
  1443. {
  1444. DISCOVERY_OUT("error", "Requested file does not exist");
  1445. return;
  1446. }
  1447. if (! file.isFile())
  1448. {
  1449. DISCOVERY_OUT("error", "Requested file is not valid");
  1450. return;
  1451. }
  1452. if (! file.isReadable())
  1453. {
  1454. DISCOVERY_OUT("error", "Requested file is not readable");
  1455. return;
  1456. }
  1457. if (init)
  1458. const LinuxSamplerScopedEngine engine(filename, stype);
  1459. else
  1460. LinuxSamplerScopedEngine::outputInfo(nullptr, 0, file.baseName().toUtf8().constData());
  1461. #else
  1462. DISCOVERY_OUT("error", stype << " support not available");
  1463. return;
  1464. // unused
  1465. (void)filename;
  1466. (void)init;
  1467. #endif
  1468. }
  1469. // --------------------------------------------------------------------------
  1470. class ScopedWorkingDirSet
  1471. {
  1472. public:
  1473. ScopedWorkingDirSet(const char* const filename)
  1474. : fPreviousPath(QDir::currentPath())
  1475. {
  1476. QDir dir(filename);
  1477. dir.cdUp();
  1478. QDir::setCurrent(dir.absolutePath());
  1479. }
  1480. ~ScopedWorkingDirSet()
  1481. {
  1482. QDir::setCurrent(fPreviousPath);
  1483. }
  1484. private:
  1485. const QString fPreviousPath;
  1486. };
  1487. // ------------------------------ main entry point ------------------------------
  1488. int main(int argc, char* argv[])
  1489. {
  1490. if (argc != 3)
  1491. {
  1492. carla_stdout("usage: %s <type> </path/to/plugin>", argv[0]);
  1493. return 1;
  1494. }
  1495. const char* const stype = argv[1];
  1496. const char* const filename = argv[2];
  1497. const PluginType type = getPluginTypeFromString(stype);
  1498. const ScopedWorkingDirSet swds(filename);
  1499. CarlaString filenameStr(filename);
  1500. filenameStr.toLower();
  1501. if (filenameStr.contains("fluidsynth", true))
  1502. {
  1503. DISCOVERY_OUT("info", "skipping fluidsynth based plugin");
  1504. return 0;
  1505. }
  1506. if (filenameStr.contains("linuxsampler", true) || filenameStr.endsWith("ls16.so"))
  1507. {
  1508. DISCOVERY_OUT("info", "skipping linuxsampler based plugin");
  1509. return 0;
  1510. }
  1511. bool openLib = false;
  1512. void* handle = nullptr;
  1513. switch (type)
  1514. {
  1515. case PLUGIN_LADSPA:
  1516. case PLUGIN_DSSI:
  1517. case PLUGIN_VST:
  1518. openLib = true;
  1519. default:
  1520. break;
  1521. }
  1522. if (openLib)
  1523. {
  1524. handle = lib_open(filename);
  1525. if (handle == nullptr)
  1526. {
  1527. print_lib_error(filename);
  1528. return 1;
  1529. }
  1530. }
  1531. // never do init for dssi-vst, takes too long and it's crashy
  1532. bool doInit = ! filenameStr.contains("dssi-vst", true);
  1533. if (doInit && getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") != nullptr)
  1534. doInit = false;
  1535. if (doInit && handle != nullptr)
  1536. {
  1537. // test fast loading & unloading DLL without initializing the plugin(s)
  1538. if (! lib_close(handle))
  1539. {
  1540. print_lib_error(filename);
  1541. return 1;
  1542. }
  1543. handle = lib_open(filename);
  1544. if (handle == nullptr)
  1545. {
  1546. print_lib_error(filename);
  1547. return 1;
  1548. }
  1549. }
  1550. switch (type)
  1551. {
  1552. case PLUGIN_LADSPA:
  1553. do_ladspa_check(handle, filename, doInit);
  1554. break;
  1555. case PLUGIN_DSSI:
  1556. do_dssi_check(handle, filename, doInit);
  1557. break;
  1558. case PLUGIN_LV2:
  1559. do_lv2_check(filename, doInit);
  1560. break;
  1561. case PLUGIN_VST:
  1562. do_vst_check(handle, doInit);
  1563. break;
  1564. case PLUGIN_VST3:
  1565. #ifdef HAVE_JUCE
  1566. do_juce_check(filename, "VST3", doInit);
  1567. #else
  1568. DISCOVERY_OUT("error", "VST3 support not available");
  1569. #endif
  1570. break;
  1571. case PLUGIN_AU:
  1572. #ifdef HAVE_JUCE
  1573. do_juce_check(filename, "AU", doInit);
  1574. #else
  1575. DISCOVERY_OUT("error", "AU support not available");
  1576. #endif
  1577. break;
  1578. case PLUGIN_FILE_CSD:
  1579. do_csound_check(filename, doInit);
  1580. break;
  1581. case PLUGIN_FILE_GIG:
  1582. do_linuxsampler_check(filename, "gig", doInit);
  1583. break;
  1584. case PLUGIN_FILE_SF2:
  1585. do_fluidsynth_check(filename, doInit);
  1586. break;
  1587. case PLUGIN_FILE_SFZ:
  1588. do_linuxsampler_check(filename, "sfz", doInit);
  1589. break;
  1590. default:
  1591. break;
  1592. }
  1593. if (openLib && handle != nullptr)
  1594. lib_close(handle);
  1595. return 0;
  1596. }
  1597. // --------------------------------------------------------------------------
  1598. // Extras
  1599. #ifdef WANT_DSSI
  1600. # include "CarlaDssiUtils.cpp"
  1601. #endif
  1602. #ifdef HAVE_JUCE
  1603. // --------------------------------------------------------------------------
  1604. // we want juce_audio_processors but without UI code
  1605. // this is copied from juce_audio_processors.cpp
  1606. #include "juce_core/native/juce_BasicNativeHeaders.h"
  1607. namespace juce
  1608. {
  1609. static inline
  1610. bool arrayContainsPlugin(const OwnedArray<PluginDescription>& list, const PluginDescription& desc)
  1611. {
  1612. for (int i = list.size(); --i >= 0;)
  1613. {
  1614. if (list.getUnchecked(i)->isDuplicateOf(desc))
  1615. return true;
  1616. }
  1617. return false;
  1618. }
  1619. #include "juce_audio_processors/format/juce_AudioPluginFormat.cpp"
  1620. #include "juce_audio_processors/processors/juce_AudioProcessor.cpp"
  1621. #include "juce_audio_processors/processors/juce_PluginDescription.cpp"
  1622. #ifdef WANT_LADSPA
  1623. # include "juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp"
  1624. #endif
  1625. #ifdef WANT_VST
  1626. # include "juce_audio_processors/format_types/juce_VSTPluginFormat.cpp"
  1627. #endif
  1628. #ifdef WANT_VST3
  1629. # include "juce_audio_processors/format_types/juce_VST3PluginFormat.cpp"
  1630. #endif
  1631. #ifdef WANT_AU
  1632. # include "juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm"
  1633. #endif
  1634. }
  1635. #endif
  1636. // --------------------------------------------------------------------------