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.

77 lines
2.2KB

  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2013 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. #if 0 //def CARLA_NATIVE_PLUGIN_LV2 // TESTING!!!
  35. // LV2 MIDI Out and Open/Save are not implemented yet
  36. if (desc->midiOuts > 0 || (desc->hints & PLUGIN_NEEDS_UI_OPEN_SAVE) != 0)
  37. continue;
  38. #endif
  39. descs.append(desc);
  40. }
  41. }
  42. ~PluginListManager()
  43. {
  44. #ifdef CARLA_NATIVE_PLUGIN_LV2
  45. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
  46. {
  47. const LV2_Descriptor*& lv2Desc(it.getValue());
  48. delete[] lv2Desc->URI;
  49. delete lv2Desc;
  50. }
  51. lv2Descs.clear();
  52. #endif
  53. descs.clear();
  54. }
  55. static PluginListManager& getInstance()
  56. {
  57. static PluginListManager plm;
  58. return plm;
  59. }
  60. #ifdef CARLA_NATIVE_PLUGIN_LV2
  61. LinkedList<const LV2_Descriptor*> lv2Descs;
  62. #endif
  63. LinkedList<const NativePluginDescriptor*> descs;
  64. };
  65. // -----------------------------------------------------------------------