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.

113 lines
4.1KB

  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "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, "audiofile" ) == 0 ||
  42. std::strcmp(desc->label, "audiogain" ) == 0 ||
  43. std::strcmp(desc->label, "audiogain_s" ) == 0 ||
  44. std::strcmp(desc->label, "lfo" ) == 0 ||
  45. std::strcmp(desc->label, "midichanab" ) == 0 ||
  46. std::strcmp(desc->label, "midichanfilter" ) == 0 ||
  47. std::strcmp(desc->label, "midichannelize" ) == 0 ||
  48. std::strcmp(desc->label, "midifile" ) == 0 ||
  49. std::strcmp(desc->label, "midigain" ) == 0 ||
  50. std::strcmp(desc->label, "midijoin" ) == 0 ||
  51. std::strcmp(desc->label, "midisplit" ) == 0 ||
  52. std::strcmp(desc->label, "miditranspose" ) == 0 ||
  53. std::strcmp(desc->label, "midipattern" ) == 0 ||
  54. std::strcmp(desc->label, "carlarack" ) == 0 ||
  55. std::strcmp(desc->label, "carlapatchbay" ) == 0 ||
  56. std::strcmp(desc->label, "carlapatchbay3s" ) == 0 ||
  57. std::strcmp(desc->label, "carlapatchbay16" ) == 0 ||
  58. std::strcmp(desc->label, "carlapatchbay32" ) == 0 ||
  59. std::strcmp(desc->label, "carlapatchbay64" ) == 0 ||
  60. std::strcmp(desc->label, "carlapatchbaycv" ) == 0 ||
  61. std::strcmp(desc->label, "bigmeter" ) == 0
  62. /*std::strcmp(desc->label, "notes" ) == 0*/)
  63. {
  64. descs.append(desc);
  65. }
  66. }
  67. #else
  68. descs.append(carla_get_native_rack_plugin());
  69. descs.append(carla_get_native_patchbay_plugin());
  70. descs.append(carla_get_native_patchbay16_plugin());
  71. descs.append(carla_get_native_patchbay32_plugin());
  72. descs.append(carla_get_native_patchbay64_plugin());
  73. #endif
  74. }
  75. ~PluginListManager()
  76. {
  77. #ifdef CARLA_NATIVE_PLUGIN_LV2
  78. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin2(); it.valid(); it.next())
  79. {
  80. const LV2_Descriptor* const lv2Desc(it.getValue(nullptr));
  81. CARLA_SAFE_ASSERT_CONTINUE(lv2Desc != nullptr);
  82. delete[] lv2Desc->URI;
  83. delete lv2Desc;
  84. }
  85. lv2Descs.clear();
  86. #endif
  87. descs.clear();
  88. }
  89. static PluginListManager& getInstance()
  90. {
  91. static PluginListManager plm;
  92. return plm;
  93. }
  94. LinkedList<const NativePluginDescriptor*> descs;
  95. #ifdef CARLA_NATIVE_PLUGIN_LV2
  96. LinkedList<const LV2_Descriptor*> lv2Descs;
  97. #endif
  98. };
  99. // -----------------------------------------------------------------------