Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

carla-base.cpp 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2013-2018 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 "CarlaEngine.hpp"
  18. #include "CarlaNativePlugin.h"
  19. #include "CarlaJuceUtils.hpp"
  20. #include "LinkedList.hpp"
  21. // -----------------------------------------------------------------------
  22. #ifdef CARLA_NATIVE_PLUGIN_LV2
  23. #include "lv2/lv2.h"
  24. // defined in CarlaPluginNative.cpp
  25. std::size_t carla_getNativePluginCount() noexcept;
  26. const NativePluginDescriptor* carla_getNativePluginDescriptor(const std::size_t index) noexcept;
  27. #endif
  28. // -----------------------------------------------------------------------
  29. // Plugin List
  30. struct PluginListManager {
  31. PluginListManager()
  32. : descs()
  33. #ifdef CARLA_NATIVE_PLUGIN_LV2
  34. , lv2Descs()
  35. #endif
  36. {
  37. #ifdef CARLA_NATIVE_PLUGIN_LV2
  38. for (std::size_t i=0, count = carla_getNativePluginCount(); i < count; ++i)
  39. {
  40. const NativePluginDescriptor* const desc(carla_getNativePluginDescriptor(i));
  41. if (std::strcmp(desc->label, "lfo" ) == 0 ||
  42. std::strcmp(desc->label, "midichanfilter" ) == 0 ||
  43. std::strcmp(desc->label, "midichanab" ) == 0 ||
  44. std::strcmp(desc->label, "midigain" ) == 0 ||
  45. std::strcmp(desc->label, "midijoin" ) == 0 ||
  46. std::strcmp(desc->label, "midisplit" ) == 0 ||
  47. std::strcmp(desc->label, "midithrough" ) == 0 ||
  48. std::strcmp(desc->label, "miditranspose" ) == 0 ||
  49. std::strcmp(desc->label, "midipattern" ) == 0 ||
  50. std::strcmp(desc->label, "carlarack" ) == 0 ||
  51. std::strcmp(desc->label, "carlapatchbay" ) == 0 ||
  52. std::strcmp(desc->label, "carlapatchbay3s" ) == 0 ||
  53. std::strcmp(desc->label, "carlapatchbay16" ) == 0 ||
  54. std::strcmp(desc->label, "carlapatchbay32" ) == 0 ||
  55. std::strcmp(desc->label, "bigmeter" ) == 0 /*||
  56. std::strcmp(desc->label, "notes" ) == 0*/)
  57. {
  58. descs.append(desc);
  59. }
  60. }
  61. #else
  62. descs.append(carla_get_native_rack_plugin());
  63. descs.append(carla_get_native_patchbay_plugin());
  64. descs.append(carla_get_native_patchbay16_plugin());
  65. descs.append(carla_get_native_patchbay32_plugin());
  66. #endif
  67. }
  68. ~PluginListManager()
  69. {
  70. #ifdef CARLA_NATIVE_PLUGIN_LV2
  71. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin2(); it.valid(); it.next())
  72. {
  73. const LV2_Descriptor* const lv2Desc(it.getValue(nullptr));
  74. CARLA_SAFE_ASSERT_CONTINUE(lv2Desc != nullptr);
  75. delete[] lv2Desc->URI;
  76. delete lv2Desc;
  77. }
  78. lv2Descs.clear();
  79. #endif
  80. descs.clear();
  81. }
  82. static PluginListManager& getInstance()
  83. {
  84. static PluginListManager plm;
  85. return plm;
  86. }
  87. LinkedList<const NativePluginDescriptor*> descs;
  88. #ifdef CARLA_NATIVE_PLUGIN_LV2
  89. LinkedList<const LV2_Descriptor*> lv2Descs;
  90. #endif
  91. };
  92. // -----------------------------------------------------------------------