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

11 years ago
9 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2013-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. #include "CarlaEngine.hpp"
  18. #include "CarlaPlugin.hpp"
  19. #include "CarlaHost.h"
  20. #include "CarlaNative.h"
  21. #include "CarlaBackendUtils.hpp"
  22. #include "LinkedList.hpp"
  23. #ifdef CARLA_NATIVE_PLUGIN_DSSI
  24. # include "dssi/dssi.h"
  25. #endif
  26. #ifdef CARLA_NATIVE_PLUGIN_LV2
  27. # include "lv2/lv2.h"
  28. #endif
  29. using CarlaBackend::CarlaPlugin;
  30. // -----------------------------------------------------------------------
  31. CARLA_EXTERN_C
  32. std::size_t carla_getNativePluginCount() noexcept;
  33. CARLA_EXTERN_C
  34. const NativePluginDescriptor* carla_getNativePluginDescriptor(const std::size_t index) noexcept;
  35. // -----------------------------------------------------------------------
  36. // Plugin List
  37. struct PluginListManager {
  38. PluginListManager()
  39. #ifdef CARLA_NATIVE_PLUGIN_DSSI
  40. : dssiDescs(),
  41. #endif
  42. #ifdef CARLA_NATIVE_PLUGIN_LV2
  43. : lv2Descs(),
  44. #endif
  45. #ifdef CARLA_NATIVE_PLUGIN_VST
  46. : _dummy(0),
  47. #endif
  48. descs()
  49. {
  50. for (std::size_t i=0, count = carla_getNativePluginCount(); i < count; ++i)
  51. {
  52. const NativePluginDescriptor* const desc(carla_getNativePluginDescriptor(i));
  53. // Open/Save not possible in plugins
  54. if (desc->hints & NATIVE_PLUGIN_NEEDS_UI_OPEN_SAVE)
  55. continue;
  56. // skip some plugins
  57. if (std::strcmp(desc->label, "bypass" ) == 0 ||
  58. std::strcmp(desc->label, "3bandeq" ) == 0 ||
  59. std::strcmp(desc->label, "3bandsplitter") == 0 ||
  60. std::strcmp(desc->label, "mverb" ) == 0 ||
  61. std::strcmp(desc->label, "nekobi" ) == 0 ||
  62. std::strcmp(desc->label, "pingpongpan" ) == 0 ||
  63. std::strcmp(desc->label, "prom" ) == 0 ||
  64. std::strstr(desc->label, "juice" ) != nullptr ||
  65. std::strstr(desc->label, "Zam" ) != nullptr)
  66. {
  67. continue;
  68. }
  69. descs.append(desc);
  70. }
  71. }
  72. ~PluginListManager()
  73. {
  74. #ifdef CARLA_NATIVE_PLUGIN_DSSI
  75. for (LinkedList<const DSSI_Descriptor*>::Itenerator it = dssiDescs.begin2(); it.valid(); it.next())
  76. {
  77. const DSSI_Descriptor* const dssiDesc(it.getValue());
  78. //delete[] lv2Desc->URI;
  79. delete dssiDesc;
  80. }
  81. dssiDescs.clear();
  82. #endif
  83. #ifdef CARLA_NATIVE_PLUGIN_LV2
  84. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin2(); it.valid(); it.next())
  85. {
  86. const LV2_Descriptor* const lv2Desc(it.getValue());
  87. delete[] lv2Desc->URI;
  88. delete lv2Desc;
  89. }
  90. lv2Descs.clear();
  91. #endif
  92. descs.clear();
  93. }
  94. static PluginListManager& getInstance()
  95. {
  96. static PluginListManager plm;
  97. return plm;
  98. }
  99. #ifdef CARLA_NATIVE_PLUGIN_DSSI
  100. LinkedList<const DSSI_Descriptor*> dssiDescs;
  101. #endif
  102. #ifdef CARLA_NATIVE_PLUGIN_LV2
  103. LinkedList<const LV2_Descriptor*> lv2Descs;
  104. #endif
  105. #ifdef CARLA_NATIVE_PLUGIN_VST
  106. char _dummy;
  107. #endif
  108. LinkedList<const NativePluginDescriptor*> descs;
  109. };
  110. // -----------------------------------------------------------------------