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.8KB

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