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.

94 lines
2.8KB

  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. const char* carla_file_callback(FileCallbackOpcode action, bool isDir, const char* title, const char* filter)
  28. {
  29. CARLA_SAFE_ASSERT_RETURN(title != nullptr && title[0] != '\0', nullptr);
  30. CARLA_SAFE_ASSERT_RETURN(filter != nullptr && filter[0] != '\0', nullptr);
  31. carla_debug("carla_file_callback(%i:%s, %s, \"%s\", \"%s\")", action, CarlaBackend::FileCallbackOpcode2Str(action), bool2str(isDir), title, filter);
  32. return nullptr;
  33. // unused
  34. (void)action;
  35. (void)isDir;
  36. }
  37. // -----------------------------------------------------------------------
  38. // Plugin List
  39. struct PluginListManager {
  40. PluginListManager()
  41. {
  42. for (size_t i=0, count = CarlaBackend::CarlaPlugin::getNativePluginCount(); i < count; ++i)
  43. {
  44. const NativePluginDescriptor* const desc(CarlaBackend::CarlaPlugin::getNativePluginDescriptor(i));
  45. carla_stderr2("PLM: %i/%i : %s", i+1, count, desc->name);
  46. #ifdef CARLA_NATIVE_PLUGIN_LV2
  47. // LV2 MIDI Out and Open/Save are not implemented yet
  48. if (desc->midiOuts > 0 || (desc->hints & PLUGIN_NEEDS_UI_OPEN_SAVE) != 0)
  49. continue;
  50. #endif
  51. descs.append(desc);
  52. }
  53. }
  54. ~PluginListManager()
  55. {
  56. #ifdef CARLA_NATIVE_PLUGIN_LV2
  57. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
  58. {
  59. const LV2_Descriptor*& lv2Desc(it.getValue());
  60. delete[] lv2Desc->URI;
  61. delete lv2Desc;
  62. }
  63. lv2Descs.clear();
  64. #endif
  65. descs.clear();
  66. }
  67. static PluginListManager& getInstance()
  68. {
  69. static PluginListManager plm;
  70. return plm;
  71. }
  72. #ifdef CARLA_NATIVE_PLUGIN_LV2
  73. LinkedList<const LV2_Descriptor*> lv2Descs;
  74. #endif
  75. LinkedList<const NativePluginDescriptor*> descs;
  76. };
  77. // -----------------------------------------------------------------------