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.

258 lines
6.5KB

  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2020 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 "CarlaUtils.h"
  19. #include "CarlaString.hpp"
  20. #if defined(HAVE_FLUIDSYNTH) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
  21. # include <fluidsynth.h>
  22. #endif
  23. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  24. # pragma GCC diagnostic push
  25. # pragma GCC diagnostic ignored "-Wconversion"
  26. # pragma GCC diagnostic ignored "-Weffc++"
  27. # pragma GCC diagnostic ignored "-Wsign-conversion"
  28. # pragma GCC diagnostic ignored "-Wundef"
  29. # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
  30. #endif
  31. #ifdef USING_JUCE
  32. # include "AppConfig.h"
  33. # include "juce_core/juce_core.h"
  34. #else
  35. # include "rtaudio/RtAudio.h"
  36. # include "rtmidi/RtMidi.h"
  37. #endif
  38. #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  39. # pragma GCC diagnostic pop
  40. #endif
  41. #include "water/files/File.h"
  42. // -------------------------------------------------------------------------------------------------------------------
  43. const char* carla_get_complete_license_text()
  44. {
  45. carla_debug("carla_get_complete_license_text()");
  46. static CarlaString retText;
  47. if (retText.isEmpty())
  48. {
  49. retText =
  50. "<p>This current Carla build is using the following features and 3rd-party code:</p>"
  51. "<ul>"
  52. // Plugin formats
  53. "<li>LADSPA plugin support</li>"
  54. "<li>DSSI plugin support</li>"
  55. "<li>LV2 plugin support</li>"
  56. #if defined(USING_JUCE) && JUCE_PLUGINHOST_VST
  57. "<li>VST2 plugin support (using JUCE)</li>"
  58. #else
  59. "<li>VST2 plugin support (using VeSTige header by Javier Serrano Polo)</li>"
  60. #endif
  61. #if defined(USING_JUCE) && JUCE_PLUGINHOST_VST3
  62. "<li>VST3 plugin support (using JUCE)</li>"
  63. #endif
  64. #if defined(USING_JUCE) && JUCE_PLUGINHOST_AU
  65. "<li>AU plugin support (using JUCE)</li>"
  66. #endif
  67. // Sample kit libraries
  68. #if defined(HAVE_FLUIDSYNTH) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
  69. "<li>FluidSynth library v" FLUIDSYNTH_VERSION " for SF2/3 support</li>"
  70. #endif
  71. "<li>SFZero module for SFZ support</li>"
  72. // misc libs
  73. "<li>base64 utilities based on code by Ren\u00E9 Nyffenegger</li>"
  74. "<li>liblo library for OSC support</li>"
  75. "<li>rtmempool library by Nedko Arnaudov"
  76. "<li>serd, sord, sratom and lilv libraries for LV2 discovery</li>"
  77. #ifndef USING_JUCE
  78. "<li>RtAudio v" RTAUDIO_VERSION " and RtMidi v" RTMIDI_VERSION " for native Audio and MIDI support</li>"
  79. #endif
  80. // Internal plugins
  81. "<li>MIDI Sequencer UI code by Perry Nguyen</li>"
  82. // External plugins
  83. #ifdef HAVE_EXTERNAL_PLUGINS
  84. "<li>Nekobi plugin code based on nekobee by Sean Bolton and others</li>"
  85. "<li>VectorJuice and WobbleJuice plugin code by Andre Sklenar</li>"
  86. # ifdef HAVE_ZYN_DEPS
  87. "<li>ZynAddSubFX plugin code by Mark McCurry and Nasca Octavian Paul</li>"
  88. # endif
  89. #endif // HAVE_EXTERNAL_PLUGINS
  90. // end
  91. "</ul>";
  92. }
  93. return retText;
  94. }
  95. const char* carla_get_juce_version()
  96. {
  97. carla_debug("carla_get_juce_version()");
  98. static CarlaString retVersion;
  99. #ifdef USING_JUCE
  100. if (retVersion.isEmpty())
  101. {
  102. if (const char* const version = juce::SystemStats::getJUCEVersion().toRawUTF8())
  103. retVersion = version+6;
  104. else
  105. retVersion = "Unknown";
  106. }
  107. #endif
  108. return retVersion;
  109. }
  110. const char* const* carla_get_supported_file_extensions()
  111. {
  112. carla_debug("carla_get_supported_file_extensions()");
  113. // NOTE: please keep in sync with CarlaEngine::loadFile!!
  114. static const char* const extensions[] = {
  115. // Base types
  116. "carxp", "carxs",
  117. // plugin files and resources
  118. #ifdef HAVE_FLUIDSYNTH
  119. "sf2", "sf3",
  120. #endif
  121. #ifdef HAVE_FLUIDSYNTH_INSTPATCH
  122. "dls", "gig",
  123. #endif
  124. #ifdef HAVE_ZYN_DEPS
  125. "xmz", "xiz",
  126. #endif
  127. #ifdef CARLA_OS_MAC
  128. "vst",
  129. #else
  130. "dll",
  131. "so",
  132. #endif
  133. "vst3",
  134. // Audio files
  135. #ifdef HAVE_SNDFILE
  136. "aif", "aifc", "aiff", "au", "bwf", "flac", "htk", "iff", "mat4", "mat5", "oga", "ogg",
  137. "paf", "pvf", "pvf5", "sd2", "sf", "snd", "svx", "vcc", "w64", "wav", "xi",
  138. #endif
  139. #ifdef HAVE_FFMPEG
  140. "3g2", "3gp", "aac", "ac3", "amr", "ape", "mp2", "mp3", "mpc", "wma",
  141. # ifndef HAVE_SNDFILE
  142. // FFmpeg without sndfile
  143. "flac", "oga", "ogg", "w64", "wav",
  144. # endif
  145. #else
  146. // minimp3
  147. "mp3",
  148. #endif
  149. // MIDI files
  150. "mid", "midi",
  151. // SFZ
  152. "sfz",
  153. // terminator
  154. nullptr
  155. };
  156. return extensions;
  157. }
  158. const char* const* carla_get_supported_features()
  159. {
  160. carla_debug("carla_get_supported_features()");
  161. static const char* const features[] = {
  162. #ifdef HAVE_FLUIDSYNTH
  163. "sf2",
  164. #endif
  165. #ifdef HAVE_FLUIDSYNTH_INSTPATCH
  166. "dls", "gig",
  167. #endif
  168. #ifdef HAVE_HYLIA
  169. "link",
  170. #endif
  171. #ifdef HAVE_LIBLO
  172. "osc",
  173. #endif
  174. #if defined(HAVE_LIBMAGIC) || defined(CARLA_OS_WIN)
  175. "bridges",
  176. #endif
  177. #ifdef HAVE_PYQT
  178. "gui",
  179. #endif
  180. #ifdef USING_JUCE
  181. "juce",
  182. "vst3",
  183. # if defined(CARLA_OS_MAC)
  184. "au",
  185. # endif
  186. #endif
  187. nullptr
  188. };
  189. return features;
  190. }
  191. // -------------------------------------------------------------------------------------------------------------------
  192. const char* carla_get_library_filename()
  193. {
  194. carla_debug("carla_get_library_filename()");
  195. static CarlaString ret;
  196. if (ret.isEmpty())
  197. {
  198. using water::File;
  199. ret = File(File::getSpecialLocation(File::currentExecutableFile)).getFullPathName().toRawUTF8();
  200. }
  201. return ret;
  202. }
  203. const char* carla_get_library_folder()
  204. {
  205. carla_debug("carla_get_library_folder()");
  206. static CarlaString ret;
  207. if (ret.isEmpty())
  208. {
  209. using water::File;
  210. ret = File(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()).getFullPathName().toRawUTF8();
  211. }
  212. return ret;
  213. }
  214. // -------------------------------------------------------------------------------------------------------------------