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

  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. // Plugin List
  32. struct PluginListManager {
  33. PluginListManager()
  34. {
  35. for (size_t i=0, count = CarlaPlugin::getNativePluginCount(); i < count; ++i)
  36. {
  37. const NativePluginDescriptor* const desc(CarlaPlugin::getNativePluginDescriptor(i));
  38. // Open/Save not possible in plugins
  39. if (desc->hints & PLUGIN_NEEDS_UI_OPEN_SAVE)
  40. continue;
  41. // skip some plugins
  42. if (std::strcmp(desc->label, "3bandeq" ) == 0 ||
  43. std::strcmp(desc->label, "3bandsplitter" ) == 0 ||
  44. std::strcmp(desc->label, "pingpongpan" ) == 0 ||
  45. std::strcmp(desc->label, "stereoenhancer") == 0 ||
  46. std::strcmp(desc->label, "nekobi" ) == 0 ||
  47. std::strcmp(desc->label, "prom" ) == 0 ||
  48. std::strcmp(desc->label, "vexsynth" ) == 0 ||
  49. std::strstr(desc->label, "juice" ) != nullptr ||
  50. std::strncmp(desc->label, "zam", 3) == 0)
  51. {
  52. continue;
  53. }
  54. // skip midi plugins, not implemented yet
  55. if (desc->audioIns == 0 && desc->audioOuts == 0 && desc->midiIns == 1 && desc->midiOuts >= 1)
  56. continue;
  57. descs.append(desc);
  58. }
  59. }
  60. ~PluginListManager()
  61. {
  62. #ifdef CARLA_NATIVE_PLUGIN_DSSI
  63. for (LinkedList<const DSSI_Descriptor*>::Itenerator it = dssiDescs.begin(); it.valid(); it.next())
  64. {
  65. const DSSI_Descriptor* const dssiDesc(it.getValue());
  66. //delete[] lv2Desc->URI;
  67. delete dssiDesc;
  68. }
  69. dssiDescs.clear();
  70. #endif
  71. #ifdef CARLA_NATIVE_PLUGIN_LV2
  72. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
  73. {
  74. const LV2_Descriptor* const lv2Desc(it.getValue());
  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. #ifdef CARLA_NATIVE_PLUGIN_DSSI
  88. LinkedList<const DSSI_Descriptor*> dssiDescs;
  89. #endif
  90. #ifdef CARLA_NATIVE_PLUGIN_LV2
  91. LinkedList<const LV2_Descriptor*> lv2Descs;
  92. #endif
  93. LinkedList<const NativePluginDescriptor*> descs;
  94. };
  95. // -----------------------------------------------------------------------