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.

274 lines
6.4KB

  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 MIDI inputs.
  71. */
  72. uint32_t midiIns;
  73. /*!
  74. * Number of MIDI outputs.
  75. */
  76. uint32_t midiOuts;
  77. /*!
  78. * Number of input parameters.
  79. */
  80. uint32_t parameterIns;
  81. /*!
  82. * Number of output parameters.
  83. */
  84. uint32_t parameterOuts;
  85. /*!
  86. * Plugin name.
  87. */
  88. const char* name;
  89. /*!
  90. * Plugin label.
  91. */
  92. const char* label;
  93. /*!
  94. * Plugin author/maker.
  95. */
  96. const char* maker;
  97. /*!
  98. * Plugin copyright/license.
  99. */
  100. const char* copyright;
  101. #ifdef __cplusplus
  102. /*!
  103. * C++ constructor.
  104. */
  105. CARLA_API _CarlaCachedPluginInfo() noexcept;
  106. CARLA_DECLARE_NON_COPY_STRUCT(_CarlaCachedPluginInfo)
  107. #endif
  108. } CarlaCachedPluginInfo;
  109. /* --------------------------------------------------------------------------------------------------------------------
  110. * get stuff */
  111. /*!
  112. * Get the complete license text of used third-party code and features.
  113. * Returned string is in basic html format.
  114. */
  115. CARLA_EXPORT const char* carla_get_complete_license_text();
  116. /*!
  117. * Get the juce version used in the current Carla build.
  118. */
  119. CARLA_EXPORT const char* carla_get_juce_version();
  120. /*!
  121. * Get the list of supported file extensions in carla_load_file().
  122. */
  123. CARLA_EXPORT const char* const* carla_get_supported_file_extensions();
  124. /*!
  125. * Get the list of supported features in the current Carla build.
  126. */
  127. CARLA_EXPORT const char* const* carla_get_supported_features();
  128. /*!
  129. * Get how many cached plugins are available.
  130. * Internal and LV2 plugin formats are cached and need to be discovered via this function.
  131. * Do not call this for any other plugin formats.
  132. */
  133. CARLA_EXPORT uint carla_get_cached_plugin_count(PluginType ptype, const char* pluginPath);
  134. /*!
  135. * Get information about a cached plugin.
  136. */
  137. CARLA_EXPORT const CarlaCachedPluginInfo* carla_get_cached_plugin_info(PluginType ptype, uint index);
  138. /* --------------------------------------------------------------------------------------------------------------------
  139. * set stuff */
  140. /*!
  141. * Flush stdout or stderr.
  142. */
  143. CARLA_EXPORT void carla_fflush(bool err);
  144. /*!
  145. * Print the string @a string to stdout or stderr.
  146. */
  147. CARLA_EXPORT void carla_fputs(bool err, const char* string);
  148. /*!
  149. * Set the current process name to @a name.
  150. */
  151. CARLA_EXPORT void carla_set_process_name(const char* name);
  152. /* --------------------------------------------------------------------------------------------------------------------
  153. * pipes */
  154. /*!
  155. * TODO.
  156. */
  157. CARLA_EXPORT CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], CarlaPipeCallbackFunc callbackFunc, void* callbackPtr);
  158. /*!
  159. * TODO.
  160. */
  161. CARLA_EXPORT const char* carla_pipe_client_idle(CarlaPipeClientHandle handle);
  162. /*!
  163. * TODO.
  164. */
  165. CARLA_EXPORT bool carla_pipe_client_is_running(CarlaPipeClientHandle handle);
  166. /*!
  167. * TODO.
  168. */
  169. CARLA_EXPORT void carla_pipe_client_lock(CarlaPipeClientHandle handle);
  170. /*!
  171. * TODO.
  172. */
  173. CARLA_EXPORT void carla_pipe_client_unlock(CarlaPipeClientHandle handle);
  174. /*!
  175. * TODO.
  176. */
  177. CARLA_EXPORT const char* carla_pipe_client_readlineblock(CarlaPipeClientHandle handle, uint timeout);
  178. /*!
  179. * TODO.
  180. */
  181. CARLA_EXPORT bool carla_pipe_client_write_msg(CarlaPipeClientHandle handle, const char* msg);
  182. /*!
  183. * TODO.
  184. */
  185. CARLA_EXPORT bool carla_pipe_client_write_and_fix_msg(CarlaPipeClientHandle handle, const char* msg);
  186. /*!
  187. * TODO.
  188. */
  189. CARLA_EXPORT bool carla_pipe_client_flush(CarlaPipeClientHandle handle);
  190. /*!
  191. * TODO.
  192. */
  193. CARLA_EXPORT bool carla_pipe_client_flush_and_unlock(CarlaPipeClientHandle handle);
  194. /*!
  195. * TODO.
  196. */
  197. CARLA_EXPORT void carla_pipe_client_destroy(CarlaPipeClientHandle handle);
  198. #ifndef CARLA_HOST_H_INCLUDED
  199. /* --------------------------------------------------------------------------------------------------------------------
  200. * info about current library */
  201. /*!
  202. * Get the absolute filename of this carla library.
  203. */
  204. CARLA_EXPORT const char* carla_get_library_filename();
  205. /*!
  206. * Get the folder where this carla library resides.
  207. */
  208. CARLA_EXPORT const char* carla_get_library_folder();
  209. #endif
  210. /* --------------------------------------------------------------------------------------------------------------------
  211. * window control */
  212. CARLA_EXPORT int carla_cocoa_get_window(void* nsViewPtr);
  213. CARLA_EXPORT void carla_x11_reparent_window(uintptr_t winId1, uintptr_t winId2);
  214. CARLA_EXPORT void carla_x11_move_window(uintptr_t winId, int x, int y);
  215. CARLA_EXPORT int* carla_x11_get_window_pos(uintptr_t winId);
  216. /* ----------------------------------------------------------------------------------------------------------------- */
  217. /** @} */
  218. #endif /* CARLA_UTILS_H_INCLUDED */