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-native-base.cpp 2.7KB

11 years ago
11 years ago
11 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #if 0 //def CARLA_NATIVE_PLUGIN_LV2 // TESTING!!!
  46. // LV2 MIDI Out and Open/Save are not implemented yet
  47. if (desc->midiOuts > 0 || (desc->hints & PLUGIN_NEEDS_UI_OPEN_SAVE) != 0)
  48. continue;
  49. #endif
  50. descs.append(desc);
  51. }
  52. }
  53. ~PluginListManager()
  54. {
  55. #ifdef CARLA_NATIVE_PLUGIN_LV2
  56. for (LinkedList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
  57. {
  58. const LV2_Descriptor*& lv2Desc(it.getValue());
  59. delete[] lv2Desc->URI;
  60. delete lv2Desc;
  61. }
  62. lv2Descs.clear();
  63. #endif
  64. descs.clear();
  65. }
  66. static PluginListManager& getInstance()
  67. {
  68. static PluginListManager plm;
  69. return plm;
  70. }
  71. #ifdef CARLA_NATIVE_PLUGIN_LV2
  72. LinkedList<const LV2_Descriptor*> lv2Descs;
  73. #endif
  74. LinkedList<const NativePluginDescriptor*> descs;
  75. };
  76. // -----------------------------------------------------------------------