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.

131 lines
3.4KB

  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-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 "CarlaHost.h"
  18. #include "juce_core.h"
  19. namespace CB = CarlaBackend;
  20. // -------------------------------------------------------------------------------------------------------------------
  21. // Always return a valid string ptr
  22. static const char* const gNullCharPtr = "";
  23. #ifdef CARLA_COMMON_NEED_CHECKSTRINGPTR
  24. static void checkStringPtr(const char*& charPtr) noexcept
  25. {
  26. if (charPtr == nullptr)
  27. charPtr = gNullCharPtr;
  28. }
  29. #endif
  30. // -------------------------------------------------------------------------------------------------------------------
  31. // Constructors
  32. _CarlaPluginInfo::_CarlaPluginInfo() noexcept
  33. : type(CB::PLUGIN_NONE),
  34. category(CB::PLUGIN_CATEGORY_NONE),
  35. hints(0x0),
  36. optionsAvailable(0x0),
  37. optionsEnabled(0x0),
  38. filename(gNullCharPtr),
  39. name(gNullCharPtr),
  40. label(gNullCharPtr),
  41. maker(gNullCharPtr),
  42. copyright(gNullCharPtr),
  43. iconName(gNullCharPtr),
  44. uniqueId(0) {}
  45. _CarlaPluginInfo::~_CarlaPluginInfo() noexcept
  46. {
  47. if (label != gNullCharPtr)
  48. delete[] label;
  49. if (maker != gNullCharPtr)
  50. delete[] maker;
  51. if (copyright != gNullCharPtr)
  52. delete[] copyright;
  53. }
  54. _CarlaParameterInfo::_CarlaParameterInfo() noexcept
  55. : name(gNullCharPtr),
  56. symbol(gNullCharPtr),
  57. unit(gNullCharPtr),
  58. scalePointCount(0) {}
  59. _CarlaParameterInfo::~_CarlaParameterInfo() noexcept
  60. {
  61. if (name != gNullCharPtr)
  62. delete[] name;
  63. if (symbol != gNullCharPtr)
  64. delete[] symbol;
  65. if (unit != gNullCharPtr)
  66. delete[] unit;
  67. }
  68. _CarlaScalePointInfo::_CarlaScalePointInfo() noexcept
  69. : value(0.0f),
  70. label(gNullCharPtr) {}
  71. _CarlaScalePointInfo::~_CarlaScalePointInfo() noexcept
  72. {
  73. if (label != gNullCharPtr)
  74. delete[] label;
  75. }
  76. _CarlaTransportInfo::_CarlaTransportInfo() noexcept
  77. : playing(false),
  78. frame(0),
  79. bar(0),
  80. beat(0),
  81. tick(0),
  82. bpm(0.0) {}
  83. // -------------------------------------------------------------------------------------------------------------------
  84. const char* carla_get_library_filename()
  85. {
  86. carla_debug("carla_get_library_filename()");
  87. static CarlaString ret;
  88. if (ret.isEmpty())
  89. {
  90. using juce::File;
  91. ret = File(File::getSpecialLocation(File::currentExecutableFile)).getFullPathName().toRawUTF8();
  92. }
  93. return ret;
  94. }
  95. const char* carla_get_library_folder()
  96. {
  97. carla_debug("carla_get_library_folder()");
  98. static CarlaString ret;
  99. if (ret.isEmpty())
  100. {
  101. using juce::File;
  102. ret = File(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()).getFullPathName().toRawUTF8();
  103. }
  104. return ret;
  105. }
  106. // -------------------------------------------------------------------------------------------------------------------