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.

85 lines
2.7KB

  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_LV2
  24. # include "lv2/lv2.h"
  25. #endif
  26. // -----------------------------------------------------------------------
  27. // Plugin List
  28. struct PluginListManager {
  29. PluginListManager()
  30. {
  31. for (size_t i=0, count = CarlaBackend::CarlaPlugin::getNativePluginCount(); i < count; ++i)
  32. {
  33. const NativePluginDescriptor* const desc(CarlaBackend::CarlaPlugin::getNativePluginDescriptor(i));
  34. // Open/Save not possible in plugins
  35. if (desc->hints & PLUGIN_NEEDS_UI_OPEN_SAVE)
  36. continue;
  37. // skip distrho plugins and Vex
  38. if (std::strcmp(desc->label, "3bandeq") == 0 || std::strcmp(desc->label, "3bandsplitter") == 0 || std::strcmp(desc->label, "nekobi") == 0 ||
  39. std::strcmp(desc->label, "pingpongpan") == 0 || std::strcmp(desc->label, "stereoenhancer") == 0 || std::strcmp(desc->label, "vexsynth") == 0)
  40. continue;
  41. // skip midi plugins, not implemented yet
  42. if (desc->audioIns == 0 && desc->audioOuts == 0 && desc->midiIns == 1 && desc->midiOuts >= 1)
  43. continue;
  44. descs.append(desc);
  45. }
  46. }
  47. ~PluginListManager()
  48. {
  49. #ifdef CARLA_NATIVE_PLUGIN_LV2
  50. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
  51. {
  52. const LV2_Descriptor* const lv2Desc(it.getValue());
  53. delete[] lv2Desc->URI;
  54. delete lv2Desc;
  55. }
  56. lv2Descs.clear();
  57. #endif
  58. descs.clear();
  59. }
  60. static PluginListManager& getInstance()
  61. {
  62. static PluginListManager plm;
  63. return plm;
  64. }
  65. #ifdef CARLA_NATIVE_PLUGIN_LV2
  66. LinkedList<const LV2_Descriptor*> lv2Descs;
  67. #endif
  68. LinkedList<const NativePluginDescriptor*> descs;
  69. };
  70. // -----------------------------------------------------------------------