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 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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, "bigmeter" ) == 0
  61. /*std::strcmp(desc->label, "notes" ) == 0*/)
  62. {
  63. descs.append(desc);
  64. }
  65. }
  66. #else
  67. descs.append(carla_get_native_rack_plugin());
  68. descs.append(carla_get_native_patchbay_plugin());
  69. descs.append(carla_get_native_patchbay16_plugin());
  70. descs.append(carla_get_native_patchbay32_plugin());
  71. descs.append(carla_get_native_patchbay64_plugin());
  72. #endif
  73. }
  74. ~PluginListManager()
  75. {
  76. #ifdef CARLA_NATIVE_PLUGIN_LV2
  77. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin2(); it.valid(); it.next())
  78. {
  79. const LV2_Descriptor* const lv2Desc(it.getValue(nullptr));
  80. CARLA_SAFE_ASSERT_CONTINUE(lv2Desc != nullptr);
  81. delete[] lv2Desc->URI;
  82. delete lv2Desc;
  83. }
  84. lv2Descs.clear();
  85. #endif
  86. descs.clear();
  87. }
  88. static PluginListManager& getInstance()
  89. {
  90. static PluginListManager plm;
  91. return plm;
  92. }
  93. LinkedList<const NativePluginDescriptor*> descs;
  94. #ifdef CARLA_NATIVE_PLUGIN_LV2
  95. LinkedList<const LV2_Descriptor*> lv2Descs;
  96. #endif
  97. };
  98. // -----------------------------------------------------------------------