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.

CarlaUtils.h 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2019 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. #ifndef CARLA_UTILS_H_INCLUDED
  18. #define CARLA_UTILS_H_INCLUDED
  19. #include "CarlaBackend.h"
  20. #ifdef __cplusplus
  21. using CarlaBackend::PluginCategory;
  22. using CarlaBackend::PluginType;
  23. #endif
  24. /*!
  25. * @defgroup CarlaUtilsAPI Carla Utils API
  26. *
  27. * The Carla Utils API.
  28. *
  29. * This API allows to call advanced features from Python.
  30. * @{
  31. */
  32. /*!
  33. * TODO.
  34. */
  35. typedef void* CarlaPipeClientHandle;
  36. /*!
  37. * TODO.
  38. */
  39. typedef void (*CarlaPipeCallbackFunc)(void* ptr, const char* msg);
  40. /*!
  41. * Information about a cached plugin.
  42. * @see carla_get_cached_plugin_info()
  43. */
  44. typedef struct _CarlaCachedPluginInfo {
  45. /*!
  46. * Wherever the data in this struct is valid.
  47. * For performance reasons, plugins are only checked on request,
  48. * and as such, the count vs number of really valid plugins might not match.
  49. * Use this field to skip on plugins which cannot be loaded in Carla.
  50. */
  51. bool valid;
  52. /*!
  53. * Plugin category.
  54. */
  55. PluginCategory category;
  56. /*!
  57. * Plugin hints.
  58. * @see PluginHints
  59. */
  60. uint hints;
  61. /*!
  62. * Number of audio inputs.
  63. */
  64. uint32_t audioIns;
  65. /*!
  66. * Number of audio outputs.
  67. */
  68. uint32_t audioOuts;
  69. /*!
  70. * Number of CV inputs.
  71. */
  72. uint32_t cvIns;
  73. /*!
  74. * Number of CV outputs.
  75. */
  76. uint32_t cvOuts;
  77. /*!
  78. * Number of MIDI inputs.
  79. */
  80. uint32_t midiIns;
  81. /*!
  82. * Number of MIDI outputs.
  83. */
  84. uint32_t midiOuts;
  85. /*!
  86. * Number of input parameters.
  87. */
  88. uint32_t parameterIns;
  89. /*!
  90. * Number of output parameters.
  91. */
  92. uint32_t parameterOuts;
  93. /*!
  94. * Plugin name.
  95. */
  96. const char* name;
  97. /*!
  98. * Plugin label.
  99. */
  100. const char* label;
  101. /*!
  102. * Plugin author/maker.
  103. */
  104. const char* maker;
  105. /*!
  106. * Plugin copyright/license.
  107. */
  108. const char* copyright;
  109. #ifdef __cplusplus
  110. /*!
  111. * C++ constructor.
  112. */
  113. CARLA_API _CarlaCachedPluginInfo() noexcept;
  114. CARLA_DECLARE_NON_COPY_STRUCT(_CarlaCachedPluginInfo)
  115. #endif
  116. } CarlaCachedPluginInfo;
  117. /* --------------------------------------------------------------------------------------------------------------------
  118. * get stuff */
  119. /*!
  120. * Get the complete license text of used third-party code and features.
  121. * Returned string is in basic html format.
  122. */
  123. CARLA_EXPORT const char* carla_get_complete_license_text(void);
  124. /*!
  125. * Get the juce version used in the current Carla build.
  126. */
  127. CARLA_EXPORT const char* carla_get_juce_version(void);
  128. /*!
  129. * Get the list of supported file extensions in carla_load_file().
  130. */
  131. CARLA_EXPORT const char* const* carla_get_supported_file_extensions(void);
  132. /*!
  133. * Get the list of supported features in the current Carla build.
  134. */
  135. CARLA_EXPORT const char* const* carla_get_supported_features(void);
  136. /*!
  137. * Get how many cached plugins are available.
  138. * Internal and LV2 plugin formats are cached and need to be discovered via this function.
  139. * Do not call this for any other plugin formats.
  140. *
  141. * @note if this carla build uses JUCE, then you must call carla_juce_init beforehand
  142. */
  143. CARLA_EXPORT uint carla_get_cached_plugin_count(PluginType ptype, const char* pluginPath);
  144. /*!
  145. * Get information about a cached plugin.
  146. *
  147. * @note if this carla build uses JUCE, then you must call carla_juce_init beforehand
  148. */
  149. CARLA_EXPORT const CarlaCachedPluginInfo* carla_get_cached_plugin_info(PluginType ptype, uint index);
  150. /* --------------------------------------------------------------------------------------------------------------------
  151. * set stuff */
  152. /*!
  153. * Flush stdout or stderr.
  154. */
  155. CARLA_EXPORT void carla_fflush(bool err);
  156. /*!
  157. * Print the string @a string to stdout or stderr.
  158. */
  159. CARLA_EXPORT void carla_fputs(bool err, const char* string);
  160. /*!
  161. * Set the current process name to @a name.
  162. */
  163. CARLA_EXPORT void carla_set_process_name(const char* name);
  164. /* --------------------------------------------------------------------------------------------------------------------
  165. * pipes */
  166. /*!
  167. * TODO.
  168. */
  169. CARLA_EXPORT CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], CarlaPipeCallbackFunc callbackFunc, void* callbackPtr);
  170. /*!
  171. * TODO.
  172. */
  173. CARLA_EXPORT const char* carla_pipe_client_idle(CarlaPipeClientHandle handle);
  174. /*!
  175. * TODO.
  176. */
  177. CARLA_EXPORT bool carla_pipe_client_is_running(CarlaPipeClientHandle handle);
  178. /*!
  179. * TODO.
  180. */
  181. CARLA_EXPORT void carla_pipe_client_lock(CarlaPipeClientHandle handle);
  182. /*!
  183. * TODO.
  184. */
  185. CARLA_EXPORT void carla_pipe_client_unlock(CarlaPipeClientHandle handle);
  186. /*!
  187. * TODO.
  188. */
  189. CARLA_EXPORT const char* carla_pipe_client_readlineblock(CarlaPipeClientHandle handle, uint timeout);
  190. /*!
  191. * Extras.
  192. * TODO.
  193. */
  194. CARLA_EXPORT bool carla_pipe_client_readlineblock_bool(CarlaPipeClientHandle handle, uint timeout);
  195. CARLA_EXPORT int carla_pipe_client_readlineblock_int(CarlaPipeClientHandle handle, uint timeout);
  196. CARLA_EXPORT double carla_pipe_client_readlineblock_float(CarlaPipeClientHandle handle, uint timeout);
  197. /*!
  198. * TODO.
  199. */
  200. CARLA_EXPORT bool carla_pipe_client_write_msg(CarlaPipeClientHandle handle, const char* msg);
  201. /*!
  202. * TODO.
  203. */
  204. CARLA_EXPORT bool carla_pipe_client_write_and_fix_msg(CarlaPipeClientHandle handle, const char* msg);
  205. /*!
  206. * TODO.
  207. */
  208. CARLA_EXPORT bool carla_pipe_client_flush(CarlaPipeClientHandle handle);
  209. /*!
  210. * TODO.
  211. */
  212. CARLA_EXPORT bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle);
  213. /*!
  214. * TODO.
  215. */
  216. CARLA_EXPORT void carla_pipe_client_destroy(CarlaPipeClientHandle handle);
  217. #ifndef CARLA_HOST_H_INCLUDED
  218. /* --------------------------------------------------------------------------------------------------------------------
  219. * info about current library */
  220. /*!
  221. * Get the absolute filename of this carla library.
  222. */
  223. CARLA_EXPORT const char* carla_get_library_filename(void);
  224. /*!
  225. * Get the folder where this carla library resides.
  226. */
  227. CARLA_EXPORT const char* carla_get_library_folder(void);
  228. /* --------------------------------------------------------------------------------------------------------------------
  229. * JUCE */
  230. /*!
  231. * Initialize data structures and GUI support for JUCE.
  232. * This is only needed when carla builds use JUCE and you call cached-plugin related APIs.
  233. *
  234. * Idle must then be called at somewhat regular intervals, though in practice there is no reason for it yet.
  235. *
  236. * Make sure to call carla_juce_cleanup after you are done with APIs that need JUCE.
  237. */
  238. CARLA_EXPORT void carla_juce_init();
  239. /*!
  240. * Give idle time to JUCE stuff.
  241. * Currently only used for Linux.
  242. */
  243. CARLA_EXPORT void carla_juce_idle();
  244. /*!
  245. * Cleanup the JUCE stuff that was initialized by carla_juce_init.
  246. */
  247. CARLA_EXPORT void carla_juce_cleanup();
  248. #endif
  249. /* --------------------------------------------------------------------------------------------------------------------
  250. * window control */
  251. CARLA_EXPORT int carla_cocoa_get_window(void* nsViewPtr);
  252. CARLA_EXPORT void carla_x11_reparent_window(uintptr_t winId1, uintptr_t winId2);
  253. CARLA_EXPORT void carla_x11_move_window(uintptr_t winId, int x, int y);
  254. CARLA_EXPORT int* carla_x11_get_window_pos(uintptr_t winId);
  255. /* ----------------------------------------------------------------------------------------------------------------- */
  256. /** @} */
  257. #endif /* CARLA_UTILS_H_INCLUDED */