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.

2207 lines
78KB

  1. /*
  2. * Carla Standalone
  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. // TODO:
  18. // Check carla_stderr2("Engine is not running"); <= prepend func name and args
  19. #include "CarlaHost.h"
  20. #include "CarlaMIDI.h"
  21. #include "CarlaEngine.hpp"
  22. #include "CarlaPlugin.hpp"
  23. #include "CarlaBackendUtils.hpp"
  24. #include "CarlaBase64Utils.hpp"
  25. #ifdef HAVE_LIBLO
  26. # include "CarlaOscUtils.hpp"
  27. #endif
  28. #include "juce_audio_formats.h"
  29. #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
  30. # include "juce_gui_basics.h"
  31. #else
  32. namespace juce {
  33. # include "juce_events/messages/juce_Initialisation.h"
  34. } // namespace juce
  35. #endif
  36. namespace CB = CarlaBackend;
  37. using CB::EngineOptions;
  38. // -------------------------------------------------------------------------------------------------------------------
  39. // Single, standalone engine
  40. struct CarlaBackendStandalone {
  41. CarlaEngine* engine;
  42. EngineCallbackFunc engineCallback;
  43. void* engineCallbackPtr;
  44. #ifndef BUILD_BRIDGE
  45. EngineOptions engineOptions;
  46. #endif
  47. FileCallbackFunc fileCallback;
  48. void* fileCallbackPtr;
  49. CarlaString lastError;
  50. CarlaBackendStandalone() noexcept
  51. : engine(nullptr),
  52. engineCallback(nullptr),
  53. engineCallbackPtr(nullptr),
  54. #ifndef BUILD_BRIDGE
  55. engineOptions(),
  56. #endif
  57. fileCallback(nullptr),
  58. fileCallbackPtr(nullptr),
  59. lastError() {}
  60. ~CarlaBackendStandalone() noexcept
  61. {
  62. CARLA_SAFE_ASSERT(engine == nullptr);
  63. }
  64. CARLA_PREVENT_HEAP_ALLOCATION
  65. CARLA_DECLARE_NON_COPY_STRUCT(CarlaBackendStandalone)
  66. };
  67. static CarlaBackendStandalone gStandalone;
  68. #ifdef HAVE_LIBLO
  69. // -------------------------------------------------------------------------------------------------------------------
  70. // NSM support
  71. #define NSM_API_VERSION_MAJOR 1
  72. #define NSM_API_VERSION_MINOR 2
  73. //#define NSM_CLIENT_FEATURES ":switch:optional-gui:"
  74. #define NSM_CLIENT_FEATURES ":switch:"
  75. class CarlaNSM
  76. {
  77. public:
  78. CarlaNSM() noexcept
  79. : fOscServer(nullptr),
  80. fClientId(),
  81. fProjectPath(),
  82. fHasBroadcast(false),
  83. fHasShowHideUI(false) {}
  84. ~CarlaNSM()
  85. {
  86. if (fOscServer != nullptr)
  87. {
  88. lo_server_del_method(fOscServer, "/reply", "ssss");
  89. lo_server_del_method(fOscServer, "/nsm/client/open", "sss");
  90. lo_server_del_method(fOscServer, "/nsm/client/save", "");
  91. //lo_server_del_method(fOscServer, "/nsm/client/show_optional_gui", "");
  92. //lo_server_del_method(fOscServer, "/nsm/client/hide_optional_gui", "");
  93. lo_server_free(fOscServer);
  94. fOscServer = nullptr;
  95. }
  96. }
  97. void announce(const int pid, const char* const initName)
  98. {
  99. const char* const NSM_URL(std::getenv("NSM_URL"));
  100. if (NSM_URL == nullptr)
  101. return;
  102. const lo_address addr = lo_address_new_from_url(NSM_URL);
  103. CARLA_SAFE_ASSERT_RETURN(addr != nullptr,);
  104. const int proto = lo_address_get_protocol(addr);
  105. if (fOscServer == nullptr)
  106. {
  107. // create new OSC server
  108. fOscServer = lo_server_new_with_proto(nullptr, proto, _error_handler);
  109. // register message handlers and start OSC thread
  110. lo_server_add_method(fOscServer, "/reply", "ssss", _reply_handler, this);
  111. lo_server_add_method(fOscServer, "/nsm/client/open", "sss", _open_handler, this);
  112. lo_server_add_method(fOscServer, "/nsm/client/save", "", _save_handler, this);
  113. //lo_server_add_method(fOscServer, "/nsm/client/show_optional_gui", "", _show_gui_handler, this);
  114. //lo_server_add_method(fOscServer, "/nsm/client/hide_optional_gui", "", _hide_gui_handler, this);
  115. // /nsm/client/session_is_loaded
  116. }
  117. #ifndef BUILD_ANSI_TEST
  118. lo_send_from(addr, fOscServer, LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii",
  119. "Carla", NSM_CLIENT_FEATURES, initName, NSM_API_VERSION_MAJOR, NSM_API_VERSION_MINOR, pid);
  120. #endif
  121. lo_address_free(addr);
  122. }
  123. void idle() noexcept
  124. {
  125. if (fOscServer == nullptr)
  126. return;
  127. for (;;)
  128. {
  129. try {
  130. if (lo_server_recv_noblock(fOscServer, 0) == 0)
  131. break;
  132. } CARLA_SAFE_EXCEPTION_CONTINUE("NSM OSC idle")
  133. }
  134. }
  135. protected:
  136. int handleReply(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg)
  137. {
  138. carla_debug("CarlaNSM::handleReply(%s, %i, %p, %s, %p)", path, argc, argv, types, msg);
  139. const char* const method = &argv[0]->s;
  140. const char* const message = &argv[1]->s;
  141. const char* const smName = &argv[2]->s;
  142. const char* const features = &argv[3]->s;
  143. CARLA_SAFE_ASSERT_RETURN(std::strcmp(method, "/nsm/server/announce") == 0, 0);
  144. fHasBroadcast = std::strstr(features, ":broadcast:") != nullptr;
  145. fHasShowHideUI = std::strstr(features, ":optional-gui:") != nullptr;
  146. carla_stdout("'%s' started: %s", smName, message);
  147. // TODO: send callback, disable open+save etc
  148. return 0;
  149. #ifndef DEBUG
  150. // unused
  151. (void)path; (void)types; (void)argc; (void)msg;
  152. #endif
  153. }
  154. // FIXME
  155. int handleOpen(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg)
  156. {
  157. CARLA_SAFE_ASSERT_RETURN(fOscServer != nullptr, 0);
  158. carla_debug("CarlaNSM::handleOpen(\"%s\", \"%s\", %p, %i, %p)", path, types, argv, argc, msg);
  159. const char* const projectPath = &argv[0]->s;
  160. //const char* const displayName = &argv[1]->s;
  161. const char* const clientId = &argv[2]->s;
  162. if (! carla_is_engine_running())
  163. {
  164. #ifndef BUILD_BRIDGE
  165. gStandalone.engineOptions.processMode = CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS;
  166. gStandalone.engineOptions.transportMode = CB::ENGINE_TRANSPORT_MODE_JACK;
  167. #endif
  168. carla_engine_init("JACK", clientId);
  169. }
  170. else
  171. {
  172. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  173. for (uint i=0, count=gStandalone.engine->getCurrentPluginCount(); i < count; ++i)
  174. gStandalone.engine->removePlugin(i);
  175. }
  176. fClientId = clientId;
  177. fProjectPath = projectPath;
  178. fProjectPath += ".carxp";
  179. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  180. if (juce::File(fProjectPath.buffer()).existsAsFile())
  181. gStandalone.engine->loadProject(fProjectPath);
  182. #ifndef BUILD_ANSI_TEST
  183. lo_send_from(lo_message_get_source(msg), fOscServer, LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/open", "OK");
  184. #endif
  185. #if 0
  186. if (fHasBroadcast)
  187. {
  188. char* const url = lo_server_get_url(fOscServer);
  189. lo_send(lo_message_get_source(msg), "/nsm/server/broadcast", "sssss",
  190. "/non/hello", url, "Carla", CARLA_VERSION_STRING, clientId);
  191. //lo_send_from(lo_message_get_source(msg), fOscServer, LO_TT_IMMEDIATE, "/nsm/server/broadcast", "sssss"
  192. // "/non/hello", url, "Carla", CARLA_VERSION_STRING, clientId);
  193. lo_send(lo_message_get_source(msg), "/signal/created", "ssfff", "/path/somewhere", true ? "in" : "out", 0.0f, 1.0f, 0.5f);
  194. std::free(url);
  195. carla_stdout("Broadcast sent!");
  196. }
  197. else
  198. carla_stdout("Broadcast NOT NOT NOT sent!");
  199. #endif
  200. return 0;
  201. #ifndef DEBUG
  202. // unused
  203. (void)path; (void)types; (void)argc; (void)msg;
  204. #endif
  205. }
  206. int handleSave(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg)
  207. {
  208. CARLA_SAFE_ASSERT_RETURN(fOscServer != nullptr, 0);
  209. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  210. CARLA_SAFE_ASSERT_RETURN(fProjectPath.isNotEmpty(), 0);
  211. carla_debug("CarlaNSM::handleSave(\"%s\", \"%s\", %p, %i, %p)", path, types, argv, argc, msg);
  212. gStandalone.engine->saveProject(fProjectPath);
  213. #ifndef BUILD_ANSI_TEST
  214. lo_send_from(lo_message_get_source(msg), fOscServer, LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/save", "OK");
  215. #endif
  216. return 0;
  217. #ifndef DEBUG
  218. // unused
  219. (void)path; (void)types; (void)argv; (void)argc; (void)msg;
  220. #endif
  221. }
  222. #if 0
  223. int handleShowHideGui(const lo_message msg, const bool show)
  224. {
  225. CARLA_SAFE_ASSERT_RETURN(fOscServer != nullptr, 0);
  226. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  227. //CARLA_SAFE_ASSERT_RETURN(gStandalone.frontendWinId != 0, 0);
  228. carla_debug("CarlaNSM::handleShowHideGui(%s)", bool2str(show));
  229. #ifndef BUILD_ANSI_TEST
  230. lo_send_from(lo_message_get_source(msg), fOscServer, LO_TT_IMMEDIATE, show ? "/nsm/client/gui_is_shown" : "/nsm/client/gui_is_hidden", "");
  231. #endif
  232. return 0;
  233. }
  234. #endif
  235. private:
  236. lo_server fOscServer;
  237. CarlaString fClientId;
  238. CarlaString fProjectPath;
  239. bool fHasBroadcast;
  240. bool fHasShowHideUI;
  241. #define handlePtr ((CarlaNSM*)data)
  242. static void _error_handler(int num, const char* msg, const char* path)
  243. {
  244. carla_stderr2("CarlaNSM::_error_handler(%i, \"%s\", \"%s\")", num, msg, path);
  245. }
  246. static int _reply_handler(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* data)
  247. {
  248. return handlePtr->handleReply(path, types, argv, argc, msg);
  249. }
  250. static int _open_handler(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* data)
  251. {
  252. return handlePtr->handleOpen(path, types, argv, argc, msg);
  253. }
  254. static int _save_handler(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* data)
  255. {
  256. return handlePtr->handleSave(path, types, argv, argc, msg);
  257. }
  258. #if 0
  259. static int _show_gui_handler(const char*, const char*, lo_arg**, int, lo_message, void* data)
  260. {
  261. return handlePtr->handleShowHideGui(true);
  262. }
  263. static int _hide_gui_handler(const char*, const char*, lo_arg**, int, lo_message, void* data)
  264. {
  265. return handlePtr->handleShowHideGui(false);
  266. }
  267. #endif
  268. #undef handlePtr
  269. CARLA_PREVENT_HEAP_ALLOCATION
  270. CARLA_DECLARE_NON_COPY_CLASS(CarlaNSM)
  271. };
  272. static CarlaNSM gNSM;
  273. #endif // HAVE_LIBLO
  274. // -------------------------------------------------------------------------------------------------------------------
  275. // API
  276. #define CARLA_COMMON_NEED_CHECKSTRINGPTR
  277. #include "CarlaHostCommon.cpp"
  278. // -------------------------------------------------------------------------------------------------------------------
  279. uint carla_get_engine_driver_count()
  280. {
  281. carla_debug("carla_get_engine_driver_count()");
  282. return CarlaEngine::getDriverCount();
  283. }
  284. const char* carla_get_engine_driver_name(uint index)
  285. {
  286. carla_debug("carla_get_engine_driver_name(%i)", index);
  287. return CarlaEngine::getDriverName(index);
  288. }
  289. const char* const* carla_get_engine_driver_device_names(uint index)
  290. {
  291. carla_debug("carla_get_engine_driver_device_names(%i)", index);
  292. return CarlaEngine::getDriverDeviceNames(index);
  293. }
  294. const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(uint index, const char* name)
  295. {
  296. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr);
  297. carla_debug("carla_get_engine_driver_device_info(%i, \"%s\")", index, name);
  298. if (const EngineDriverDeviceInfo* const ret = CarlaEngine::getDriverDeviceInfo(index, name))
  299. {
  300. static EngineDriverDeviceInfo devInfo;
  301. static const uint32_t nullBufferSizes[] = { 0 };
  302. static const double nullSampleRates[] = { 0.0 };
  303. devInfo.hints = ret->hints;
  304. devInfo.bufferSizes = (ret->bufferSizes != nullptr) ? ret->bufferSizes : nullBufferSizes;
  305. devInfo.sampleRates = (ret->sampleRates != nullptr) ? ret->sampleRates : nullSampleRates;
  306. return &devInfo;
  307. }
  308. return nullptr;
  309. }
  310. // -------------------------------------------------------------------------------------------------------------------
  311. CarlaEngine* carla_get_engine()
  312. {
  313. carla_debug("carla_get_engine()");
  314. return gStandalone.engine;
  315. }
  316. // -------------------------------------------------------------------------------------------------------------------
  317. static void carla_engine_init_common()
  318. {
  319. gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr);
  320. gStandalone.engine->setFileCallback(gStandalone.fileCallback, gStandalone.fileCallbackPtr);
  321. #ifdef BUILD_BRIDGE
  322. using juce::File;
  323. File juceBinaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory());
  324. /*
  325. if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_FORCE_STEREO"))
  326. gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);
  327. if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_PREFER_PLUGIN_BRIDGES"))
  328. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);
  329. if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_PREFER_UI_BRIDGES"))
  330. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);
  331. */
  332. if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_UIS_ALWAYS_ON_TOP"))
  333. gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);
  334. if (const char* const maxParameters = std::getenv("ENGINE_OPTION_MAX_PARAMETERS"))
  335. gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, std::atoi(maxParameters), nullptr);
  336. if (const char* const uiBridgesTimeout = std::getenv("ENGINE_OPTION_UI_BRIDGES_TIMEOUT"))
  337. gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, std::atoi(uiBridgesTimeout), nullptr);
  338. if (const char* const pathLADSPA = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LADSPA"))
  339. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, pathLADSPA);
  340. if (const char* const pathDSSI = std::getenv("ENGINE_OPTION_PLUGIN_PATH_DSSI"))
  341. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, pathDSSI);
  342. if (const char* const pathLV2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LV2"))
  343. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, pathLV2);
  344. if (const char* const pathVST2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST2"))
  345. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, pathVST2);
  346. if (const char* const pathVST3 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST3"))
  347. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, pathVST3);
  348. if (const char* const pathAU = std::getenv("ENGINE_OPTION_PLUGIN_PATH_AU"))
  349. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_AU, pathAU);
  350. if (const char* const pathGIG = std::getenv("ENGINE_OPTION_PLUGIN_PATH_GIG"))
  351. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_GIG, pathGIG);
  352. if (const char* const pathSF2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SF2"))
  353. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, pathSF2);
  354. if (const char* const pathSFZ = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SFZ"))
  355. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, pathSFZ);
  356. if (const char* const binaryDir = std::getenv("ENGINE_OPTION_PATH_BINARIES"))
  357. gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir);
  358. else
  359. gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, juceBinaryDir.getFullPathName().toRawUTF8());
  360. if (const char* const resourceDir = std::getenv("ENGINE_OPTION_PATH_RESOURCES"))
  361. gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir);
  362. else
  363. gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, juceBinaryDir.getChildFile("resources").getFullPathName().toRawUTF8());
  364. if (const char* const preventBadBehaviour = std::getenv("ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"))
  365. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, (std::strcmp(preventBadBehaviour, "true") == 0) ? 1 : 0, nullptr);
  366. if (const char* const frontendWinId = std::getenv("ENGINE_OPTION_FRONTEND_WIN_ID"))
  367. gStandalone.engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, frontendWinId);
  368. #else
  369. gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, gStandalone.engineOptions.forceStereo ? 1 : 0, nullptr);
  370. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, gStandalone.engineOptions.preferPluginBridges ? 1 : 0, nullptr);
  371. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.engineOptions.preferUiBridges ? 1 : 0, nullptr);
  372. gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, gStandalone.engineOptions.uisAlwaysOnTop ? 1 : 0, nullptr);
  373. gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.engineOptions.maxParameters), nullptr);
  374. gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.engineOptions.uiBridgesTimeout), nullptr);
  375. gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_NUM_PERIODS, static_cast<int>(gStandalone.engineOptions.audioNumPeriods), nullptr);
  376. gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE, static_cast<int>(gStandalone.engineOptions.audioBufferSize), nullptr);
  377. gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(gStandalone.engineOptions.audioSampleRate), nullptr);
  378. if (gStandalone.engineOptions.audioDevice != nullptr)
  379. gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_DEVICE, 0, gStandalone.engineOptions.audioDevice);
  380. if (gStandalone.engineOptions.pathLADSPA != nullptr)
  381. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, gStandalone.engineOptions.pathLADSPA);
  382. if (gStandalone.engineOptions.pathDSSI != nullptr)
  383. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, gStandalone.engineOptions.pathDSSI);
  384. if (gStandalone.engineOptions.pathLV2 != nullptr)
  385. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, gStandalone.engineOptions.pathLV2);
  386. if (gStandalone.engineOptions.pathVST2 != nullptr)
  387. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, gStandalone.engineOptions.pathVST2);
  388. if (gStandalone.engineOptions.pathVST3 != nullptr)
  389. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, gStandalone.engineOptions.pathVST3);
  390. if (gStandalone.engineOptions.pathAU != nullptr)
  391. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_AU, gStandalone.engineOptions.pathAU);
  392. if (gStandalone.engineOptions.pathGIG != nullptr)
  393. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_GIG, gStandalone.engineOptions.pathGIG);
  394. if (gStandalone.engineOptions.pathSF2 != nullptr)
  395. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, gStandalone.engineOptions.pathSF2);
  396. if (gStandalone.engineOptions.pathSFZ != nullptr)
  397. gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, gStandalone.engineOptions.pathSFZ);
  398. if (gStandalone.engineOptions.binaryDir != nullptr && gStandalone.engineOptions.binaryDir[0] != '\0')
  399. gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, gStandalone.engineOptions.binaryDir);
  400. if (gStandalone.engineOptions.resourceDir != nullptr && gStandalone.engineOptions.resourceDir[0] != '\0')
  401. gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, gStandalone.engineOptions.resourceDir);
  402. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, gStandalone.engineOptions.preventBadBehaviour ? 1 : 0, nullptr);
  403. if (gStandalone.engineOptions.frontendWinId != 0)
  404. {
  405. char strBuf[STR_MAX+1];
  406. strBuf[STR_MAX] = '\0';
  407. std::snprintf(strBuf, STR_MAX, P_UINTPTR, gStandalone.engineOptions.frontendWinId);
  408. gStandalone.engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, strBuf);
  409. }
  410. else
  411. gStandalone.engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0");
  412. #endif
  413. }
  414. bool carla_engine_init(const char* driverName, const char* clientName)
  415. {
  416. CARLA_SAFE_ASSERT_RETURN(driverName != nullptr && driverName[0] != '\0', false);
  417. CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
  418. carla_debug("carla_engine_init(\"%s\", \"%s\")", driverName, clientName);
  419. if (gStandalone.engine != nullptr)
  420. {
  421. carla_stderr2("Engine is already running");
  422. gStandalone.lastError = "Engine is already running";
  423. return false;
  424. }
  425. #ifdef CARLA_OS_WIN
  426. carla_setenv("WINEASIO_CLIENT_NAME", clientName);
  427. #endif
  428. // TODO: make this an option, put somewhere else
  429. if (std::getenv("WINE_RT") == nullptr)
  430. {
  431. carla_setenv("WINE_RT", "15");
  432. carla_setenv("WINE_SVR_RT", "10");
  433. }
  434. gStandalone.engine = CarlaEngine::newDriverByName(driverName);
  435. if (gStandalone.engine == nullptr)
  436. {
  437. carla_stderr2("The seleted audio driver is not available");
  438. gStandalone.lastError = "The seleted audio driver is not available";
  439. return false;
  440. }
  441. #ifdef BUILD_BRIDGE
  442. gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, nullptr);
  443. gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_JACK, nullptr);
  444. gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, false, nullptr);
  445. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr);
  446. gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, false, nullptr);
  447. #else
  448. gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr);
  449. gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), nullptr);
  450. #endif
  451. carla_engine_init_common();
  452. if (gStandalone.engine->init(clientName))
  453. {
  454. #ifndef BUILD_BRIDGE
  455. juce::initialiseJuce_GUI();
  456. #endif
  457. gStandalone.lastError = "No error";
  458. return true;
  459. }
  460. else
  461. {
  462. gStandalone.lastError = gStandalone.engine->getLastError();
  463. delete gStandalone.engine;
  464. gStandalone.engine = nullptr;
  465. return false;
  466. }
  467. }
  468. #ifdef BUILD_BRIDGE
  469. bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtClientBaseName[6+1], const char nonRtClientBaseName[6+1],
  470. const char nonRtServerBaseName[6+1], const char* clientName)
  471. {
  472. CARLA_SAFE_ASSERT_RETURN(audioBaseName != nullptr && audioBaseName[0] != '\0', false);
  473. CARLA_SAFE_ASSERT_RETURN(rtClientBaseName != nullptr && rtClientBaseName[0] != '\0', false);
  474. CARLA_SAFE_ASSERT_RETURN(nonRtClientBaseName != nullptr && nonRtClientBaseName[0] != '\0', false);
  475. CARLA_SAFE_ASSERT_RETURN(nonRtServerBaseName != nullptr && nonRtServerBaseName[0] != '\0', false);
  476. CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
  477. carla_debug("carla_engine_init_bridge(\"%s\", \"%s\", \"%s\", \"%s\", \"%s\")", audioBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName, clientName);
  478. if (gStandalone.engine != nullptr)
  479. {
  480. carla_stderr2("Engine is already running");
  481. gStandalone.lastError = "Engine is already running";
  482. return false;
  483. }
  484. gStandalone.engine = CarlaEngine::newBridge(audioBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName);
  485. if (gStandalone.engine == nullptr)
  486. {
  487. carla_stderr2("The seleted audio driver is not available!");
  488. gStandalone.lastError = "The seleted audio driver is not available!";
  489. return false;
  490. }
  491. carla_engine_init_common();
  492. gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr);
  493. gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_BRIDGE, nullptr);
  494. if (gStandalone.engine->init(clientName))
  495. {
  496. gStandalone.lastError = "No error";
  497. return true;
  498. }
  499. else
  500. {
  501. gStandalone.lastError = gStandalone.engine->getLastError();
  502. delete gStandalone.engine;
  503. gStandalone.engine = nullptr;
  504. return false;
  505. }
  506. }
  507. #endif
  508. bool carla_engine_close()
  509. {
  510. carla_debug("carla_engine_close()");
  511. if (gStandalone.engine == nullptr)
  512. {
  513. carla_stderr2("Engine is not running");
  514. gStandalone.lastError = "Engine is not running";
  515. return false;
  516. }
  517. gStandalone.engine->setAboutToClose();
  518. gStandalone.engine->removeAllPlugins();
  519. const bool closed(gStandalone.engine->close());
  520. if (! closed)
  521. gStandalone.lastError = gStandalone.engine->getLastError();
  522. #ifndef BUILD_BRIDGE
  523. juce::shutdownJuce_GUI();
  524. #endif
  525. delete gStandalone.engine;
  526. gStandalone.engine = nullptr;
  527. return closed;
  528. }
  529. void carla_engine_idle()
  530. {
  531. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  532. #ifdef HAVE_LIBLO
  533. gNSM.idle();
  534. #endif
  535. gStandalone.engine->idle();
  536. }
  537. bool carla_is_engine_running()
  538. {
  539. return (gStandalone.engine != nullptr && gStandalone.engine->isRunning());
  540. }
  541. void carla_set_engine_about_to_close()
  542. {
  543. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  544. carla_debug("carla_set_engine_about_to_close()");
  545. gStandalone.engine->setAboutToClose();
  546. }
  547. void carla_set_engine_callback(EngineCallbackFunc func, void* ptr)
  548. {
  549. carla_debug("carla_set_engine_callback(%p, %p)", func, ptr);
  550. gStandalone.engineCallback = func;
  551. gStandalone.engineCallbackPtr = ptr;
  552. if (gStandalone.engine != nullptr)
  553. gStandalone.engine->setCallback(func, ptr);
  554. //#ifdef WANT_LOGS
  555. // gLogThread.setCallback(func, ptr);
  556. //#endif
  557. }
  558. #ifndef BUILD_BRIDGE
  559. void carla_set_engine_option(EngineOption option, int value, const char* valueStr)
  560. {
  561. carla_debug("carla_set_engine_option(%i:%s, %i, \"%s\")", option, CB::EngineOption2Str(option), value, valueStr);
  562. switch (option)
  563. {
  564. case CB::ENGINE_OPTION_DEBUG:
  565. break;
  566. case CB::ENGINE_OPTION_PROCESS_MODE:
  567. CARLA_SAFE_ASSERT_RETURN(value >= CB::ENGINE_PROCESS_MODE_SINGLE_CLIENT && value < CB::ENGINE_PROCESS_MODE_BRIDGE,);
  568. gStandalone.engineOptions.processMode = static_cast<CB::EngineProcessMode>(value);
  569. break;
  570. case CB::ENGINE_OPTION_TRANSPORT_MODE:
  571. CARLA_SAFE_ASSERT_RETURN(value >= CB::ENGINE_TRANSPORT_MODE_INTERNAL && value < CB::ENGINE_TRANSPORT_MODE_BRIDGE,);
  572. gStandalone.engineOptions.transportMode = static_cast<CB::EngineTransportMode>(value);
  573. break;
  574. case CB::ENGINE_OPTION_FORCE_STEREO:
  575. CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
  576. gStandalone.engineOptions.forceStereo = (value != 0);
  577. break;
  578. case CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES:
  579. CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
  580. gStandalone.engineOptions.preferPluginBridges = (value != 0);
  581. break;
  582. case CB::ENGINE_OPTION_PREFER_UI_BRIDGES:
  583. CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
  584. gStandalone.engineOptions.preferUiBridges = (value != 0);
  585. break;
  586. case CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP:
  587. CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
  588. gStandalone.engineOptions.uisAlwaysOnTop = (value != 0);
  589. break;
  590. case CB::ENGINE_OPTION_MAX_PARAMETERS:
  591. CARLA_SAFE_ASSERT_RETURN(value >= 0,);
  592. gStandalone.engineOptions.maxParameters = static_cast<uint>(value);
  593. break;
  594. case CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT:
  595. CARLA_SAFE_ASSERT_RETURN(value >= 0,);
  596. gStandalone.engineOptions.uiBridgesTimeout = static_cast<uint>(value);
  597. break;
  598. case CB::ENGINE_OPTION_AUDIO_NUM_PERIODS:
  599. CARLA_SAFE_ASSERT_RETURN(value >= 2 && value <= 3,);
  600. gStandalone.engineOptions.audioNumPeriods = static_cast<uint>(value);
  601. break;
  602. case CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE:
  603. CARLA_SAFE_ASSERT_RETURN(value >= 8,);
  604. gStandalone.engineOptions.audioBufferSize = static_cast<uint>(value);
  605. break;
  606. case CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE:
  607. CARLA_SAFE_ASSERT_RETURN(value >= 22050,);
  608. gStandalone.engineOptions.audioSampleRate = static_cast<uint>(value);
  609. break;
  610. case CB::ENGINE_OPTION_AUDIO_DEVICE:
  611. CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,);
  612. if (gStandalone.engineOptions.audioDevice != nullptr)
  613. delete[] gStandalone.engineOptions.audioDevice;
  614. gStandalone.engineOptions.audioDevice = carla_strdup_safe(valueStr);
  615. break;
  616. case CB:: ENGINE_OPTION_NSM_INIT:
  617. CARLA_SAFE_ASSERT_RETURN(value != 0,);
  618. CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
  619. #ifdef HAVE_LIBLO
  620. gNSM.announce(value, valueStr);
  621. #endif
  622. break;
  623. case CB::ENGINE_OPTION_PLUGIN_PATH:
  624. CARLA_SAFE_ASSERT_RETURN(value > CB::PLUGIN_NONE,);
  625. CARLA_SAFE_ASSERT_RETURN(value <= CB::PLUGIN_SFZ,);
  626. CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,);
  627. switch (value)
  628. {
  629. case CB::PLUGIN_LADSPA:
  630. if (gStandalone.engineOptions.pathLADSPA != nullptr)
  631. delete[] gStandalone.engineOptions.pathLADSPA;
  632. gStandalone.engineOptions.pathLADSPA = carla_strdup_safe(valueStr);
  633. break;
  634. case CB::PLUGIN_DSSI:
  635. if (gStandalone.engineOptions.pathDSSI != nullptr)
  636. delete[] gStandalone.engineOptions.pathDSSI;
  637. gStandalone.engineOptions.pathDSSI = carla_strdup_safe(valueStr);
  638. break;
  639. case CB::PLUGIN_LV2:
  640. if (gStandalone.engineOptions.pathLV2 != nullptr)
  641. delete[] gStandalone.engineOptions.pathLV2;
  642. gStandalone.engineOptions.pathLV2 = carla_strdup_safe(valueStr);
  643. break;
  644. case CB::PLUGIN_VST2:
  645. if (gStandalone.engineOptions.pathVST2 != nullptr)
  646. delete[] gStandalone.engineOptions.pathVST2;
  647. gStandalone.engineOptions.pathVST2 = carla_strdup_safe(valueStr);
  648. break;
  649. case CB::PLUGIN_VST3:
  650. if (gStandalone.engineOptions.pathVST3 != nullptr)
  651. delete[] gStandalone.engineOptions.pathVST3;
  652. gStandalone.engineOptions.pathVST3 = carla_strdup_safe(valueStr);
  653. break;
  654. case CB::PLUGIN_AU:
  655. if (gStandalone.engineOptions.pathAU != nullptr)
  656. delete[] gStandalone.engineOptions.pathAU;
  657. gStandalone.engineOptions.pathAU = carla_strdup_safe(valueStr);
  658. break;
  659. case CB::PLUGIN_GIG:
  660. if (gStandalone.engineOptions.pathGIG != nullptr)
  661. delete[] gStandalone.engineOptions.pathGIG;
  662. gStandalone.engineOptions.pathGIG = carla_strdup_safe(valueStr);
  663. break;
  664. case CB::PLUGIN_SF2:
  665. if (gStandalone.engineOptions.pathSF2 != nullptr)
  666. delete[] gStandalone.engineOptions.pathSF2;
  667. gStandalone.engineOptions.pathSF2 = carla_strdup_safe(valueStr);
  668. break;
  669. case CB::PLUGIN_SFZ:
  670. if (gStandalone.engineOptions.pathSFZ != nullptr)
  671. delete[] gStandalone.engineOptions.pathSFZ;
  672. gStandalone.engineOptions.pathSFZ = carla_strdup_safe(valueStr);
  673. break;
  674. }
  675. break;
  676. case CB::ENGINE_OPTION_PATH_BINARIES:
  677. CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
  678. if (gStandalone.engineOptions.binaryDir != nullptr)
  679. delete[] gStandalone.engineOptions.binaryDir;
  680. gStandalone.engineOptions.binaryDir = carla_strdup_safe(valueStr);
  681. break;
  682. case CB::ENGINE_OPTION_PATH_RESOURCES:
  683. CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
  684. if (gStandalone.engineOptions.resourceDir != nullptr)
  685. delete[] gStandalone.engineOptions.resourceDir;
  686. gStandalone.engineOptions.resourceDir = carla_strdup_safe(valueStr);
  687. break;
  688. case CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR:
  689. CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
  690. gStandalone.engineOptions.preventBadBehaviour = (value != 0);
  691. break;
  692. case CB::ENGINE_OPTION_FRONTEND_WIN_ID:
  693. CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
  694. const long long winId(std::strtoll(valueStr, nullptr, 16));
  695. CARLA_SAFE_ASSERT_RETURN(winId >= 0,);
  696. gStandalone.engineOptions.frontendWinId = static_cast<uintptr_t>(winId);
  697. break;
  698. }
  699. if (gStandalone.engine != nullptr)
  700. gStandalone.engine->setOption(option, value, valueStr);
  701. }
  702. #endif
  703. void carla_set_file_callback(FileCallbackFunc func, void* ptr)
  704. {
  705. carla_debug("carla_set_file_callback(%p, %p)", func, ptr);
  706. gStandalone.fileCallback = func;
  707. gStandalone.fileCallbackPtr = ptr;
  708. if (gStandalone.engine != nullptr)
  709. gStandalone.engine->setFileCallback(func, ptr);
  710. }
  711. // -------------------------------------------------------------------------------------------------------------------
  712. bool carla_load_file(const char* filename)
  713. {
  714. CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
  715. carla_debug("carla_load_file(\"%s\")", filename);
  716. if (gStandalone.engine != nullptr)
  717. return gStandalone.engine->loadFile(filename);
  718. carla_stderr2("Engine is not running");
  719. gStandalone.lastError = "Engine is not running";
  720. return false;
  721. }
  722. bool carla_load_project(const char* filename)
  723. {
  724. CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
  725. carla_debug("carla_load_project(\"%s\")", filename);
  726. if (gStandalone.engine != nullptr)
  727. return gStandalone.engine->loadProject(filename);
  728. carla_stderr2("Engine is not running");
  729. gStandalone.lastError = "Engine is not running";
  730. return false;
  731. }
  732. bool carla_save_project(const char* filename)
  733. {
  734. CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
  735. carla_debug("carla_save_project(\"%s\")", filename);
  736. if (gStandalone.engine != nullptr)
  737. return gStandalone.engine->saveProject(filename);
  738. carla_stderr2("Engine was never initiated");
  739. gStandalone.lastError = "Engine was never initiated";
  740. return false;
  741. }
  742. #ifndef BUILD_BRIDGE
  743. // -------------------------------------------------------------------------------------------------------------------
  744. bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB)
  745. {
  746. carla_debug("carla_patchbay_connect(%u, %u, %u, %u)", groupIdA, portIdA, groupIdB, portIdB);
  747. if (gStandalone.engine != nullptr)
  748. return gStandalone.engine->patchbayConnect(groupIdA, portIdA, groupIdB, portIdB);
  749. carla_stderr2("Engine is not running");
  750. gStandalone.lastError = "Engine is not running";
  751. return false;
  752. }
  753. bool carla_patchbay_disconnect(uint connectionId)
  754. {
  755. carla_debug("carla_patchbay_disconnect(%i)", connectionId);
  756. if (gStandalone.engine != nullptr)
  757. return gStandalone.engine->patchbayDisconnect(connectionId);
  758. carla_stderr2("Engine is not running");
  759. gStandalone.lastError = "Engine is not running";
  760. return false;
  761. }
  762. bool carla_patchbay_refresh(bool external)
  763. {
  764. carla_debug("carla_patchbay_refresh(%s)", bool2str(external));
  765. if (gStandalone.engine != nullptr)
  766. return gStandalone.engine->patchbayRefresh(external);
  767. carla_stderr2("Engine is not running");
  768. gStandalone.lastError = "Engine is not running";
  769. return false;
  770. }
  771. // -------------------------------------------------------------------------------------------------------------------
  772. void carla_transport_play()
  773. {
  774. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(),);
  775. carla_debug("carla_transport_play()");
  776. gStandalone.engine->transportPlay();
  777. }
  778. void carla_transport_pause()
  779. {
  780. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(),);
  781. carla_debug("carla_transport_pause()");
  782. gStandalone.engine->transportPause();
  783. }
  784. void carla_transport_relocate(uint64_t frame)
  785. {
  786. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(),);
  787. carla_debug("carla_transport_relocate(%i)", frame);
  788. gStandalone.engine->transportRelocate(frame);
  789. }
  790. uint64_t carla_get_current_transport_frame()
  791. {
  792. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(), 0);
  793. const CB::EngineTimeInfo& timeInfo(gStandalone.engine->getTimeInfo());
  794. return timeInfo.frame;
  795. }
  796. const CarlaTransportInfo* carla_get_transport_info()
  797. {
  798. static CarlaTransportInfo retInfo;
  799. // reset
  800. retInfo.playing = false;
  801. retInfo.frame = 0;
  802. retInfo.bar = 0;
  803. retInfo.beat = 0;
  804. retInfo.tick = 0;
  805. retInfo.bpm = 0.0;
  806. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(), &retInfo);
  807. const CB::EngineTimeInfo& timeInfo(gStandalone.engine->getTimeInfo());
  808. retInfo.playing = timeInfo.playing;
  809. retInfo.frame = timeInfo.frame;
  810. if (timeInfo.valid & CB::EngineTimeInfo::kValidBBT)
  811. {
  812. retInfo.bar = timeInfo.bbt.bar;
  813. retInfo.beat = timeInfo.bbt.beat;
  814. retInfo.tick = timeInfo.bbt.tick;
  815. retInfo.bpm = timeInfo.bbt.beatsPerMinute;
  816. }
  817. return &retInfo;
  818. }
  819. #endif
  820. // -------------------------------------------------------------------------------------------------------------------
  821. uint32_t carla_get_current_plugin_count()
  822. {
  823. if (gStandalone.engine != nullptr)
  824. return gStandalone.engine->getCurrentPluginCount();
  825. return 0;
  826. }
  827. uint32_t carla_get_max_plugin_number()
  828. {
  829. if (gStandalone.engine != nullptr)
  830. return gStandalone.engine->getMaxPluginNumber();
  831. return 0;
  832. }
  833. // -------------------------------------------------------------------------------------------------------------------
  834. bool carla_add_plugin(BinaryType btype, PluginType ptype, const char* filename, const char* name, const char* label, int64_t uniqueId, const void* extraPtr)
  835. {
  836. CARLA_SAFE_ASSERT_RETURN(label != nullptr /*&& label[0] != '\0'*/, false);
  837. carla_debug("carla_add_plugin(%i:%s, %i:%s, \"%s\", \"%s\", \"%s\", " P_INT64 ", %p)", btype, CB::BinaryType2Str(btype), ptype, CB::PluginType2Str(ptype), filename, name, label, uniqueId, extraPtr);
  838. if (gStandalone.engine != nullptr)
  839. return gStandalone.engine->addPlugin(btype, ptype, filename, name, label, uniqueId, extraPtr);
  840. carla_stderr2("Engine is not running");
  841. gStandalone.lastError = "Engine is not running";
  842. return false;
  843. }
  844. bool carla_remove_plugin(uint pluginId)
  845. {
  846. carla_debug("carla_remove_plugin(%i)", pluginId);
  847. if (gStandalone.engine != nullptr)
  848. return gStandalone.engine->removePlugin(pluginId);
  849. carla_stderr2("Engine is not running");
  850. gStandalone.lastError = "Engine is not running";
  851. return false;
  852. }
  853. bool carla_remove_all_plugins()
  854. {
  855. carla_debug("carla_remove_all_plugins()");
  856. if (gStandalone.engine != nullptr)
  857. return gStandalone.engine->removeAllPlugins();
  858. carla_stderr2("Engine is not running");
  859. gStandalone.lastError = "Engine is not running";
  860. return false;
  861. }
  862. #ifndef BUILD_BRIDGE
  863. const char* carla_rename_plugin(uint pluginId, const char* newName)
  864. {
  865. CARLA_SAFE_ASSERT_RETURN(newName != nullptr && newName[0] != '\0', nullptr);
  866. carla_debug("carla_rename_plugin(%i, \"%s\")", pluginId, newName);
  867. if (gStandalone.engine != nullptr)
  868. return gStandalone.engine->renamePlugin(pluginId, newName);
  869. carla_stderr2("Engine is not running");
  870. gStandalone.lastError = "Engine is not running";
  871. return nullptr;
  872. }
  873. bool carla_clone_plugin(uint pluginId)
  874. {
  875. carla_debug("carla_clone_plugin(%i)", pluginId);
  876. if (gStandalone.engine != nullptr)
  877. return gStandalone.engine->clonePlugin(pluginId);
  878. carla_stderr2("Engine is not running");
  879. gStandalone.lastError = "Engine is not running";
  880. return false;
  881. }
  882. bool carla_replace_plugin(uint pluginId)
  883. {
  884. carla_debug("carla_replace_plugin(%i)", pluginId);
  885. if (gStandalone.engine != nullptr)
  886. return gStandalone.engine->replacePlugin(pluginId);
  887. carla_stderr2("Engine is not running");
  888. gStandalone.lastError = "Engine is not running";
  889. return false;
  890. }
  891. bool carla_switch_plugins(uint pluginIdA, uint pluginIdB)
  892. {
  893. CARLA_SAFE_ASSERT_RETURN(pluginIdA != pluginIdB, false);
  894. carla_debug("carla_switch_plugins(%i, %i)", pluginIdA, pluginIdB);
  895. if (gStandalone.engine != nullptr)
  896. return gStandalone.engine->switchPlugins(pluginIdA, pluginIdB);
  897. carla_stderr2("Engine is not running");
  898. gStandalone.lastError = "Engine is not running";
  899. return false;
  900. }
  901. #endif
  902. // -------------------------------------------------------------------------------------------------------------------
  903. bool carla_load_plugin_state(uint pluginId, const char* filename)
  904. {
  905. CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
  906. carla_debug("carla_load_plugin_state(%i, \"%s\")", pluginId, filename);
  907. if (gStandalone.engine == nullptr || ! gStandalone.engine->isRunning())
  908. {
  909. carla_stderr2("Engine is not running");
  910. gStandalone.lastError = "Engine is not running";
  911. return false;
  912. }
  913. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  914. return plugin->loadStateFromFile(filename);
  915. carla_stderr2("carla_load_plugin_state(%i, \"%s\") - could not find plugin", pluginId, filename);
  916. return false;
  917. }
  918. bool carla_save_plugin_state(uint pluginId, const char* filename)
  919. {
  920. CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
  921. carla_debug("carla_save_plugin_state(%i, \"%s\")", pluginId, filename);
  922. if (gStandalone.engine == nullptr)
  923. {
  924. carla_stderr2("Engine is not running");
  925. gStandalone.lastError = "Engine is not running";
  926. return false;
  927. }
  928. // allow to save even if engine isn't running
  929. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  930. return plugin->saveStateToFile(filename);
  931. carla_stderr2("carla_save_plugin_state(%i, \"%s\") - could not find plugin", pluginId, filename);
  932. return false;
  933. }
  934. // -------------------------------------------------------------------------------------------------------------------
  935. const CarlaPluginInfo* carla_get_plugin_info(uint pluginId)
  936. {
  937. carla_debug("carla_get_plugin_info(%i)", pluginId);
  938. static CarlaPluginInfo info;
  939. // reset
  940. info.type = CB::PLUGIN_NONE;
  941. info.category = CB::PLUGIN_CATEGORY_NONE;
  942. info.hints = 0x0;
  943. info.optionsAvailable = 0x0;
  944. info.optionsEnabled = 0x0;
  945. info.filename = gNullCharPtr;
  946. info.name = gNullCharPtr;
  947. info.iconName = gNullCharPtr;
  948. info.uniqueId = 0;
  949. // cleanup
  950. if (info.label != gNullCharPtr)
  951. {
  952. delete[] info.label;
  953. info.label = gNullCharPtr;
  954. }
  955. if (info.maker != gNullCharPtr)
  956. {
  957. delete[] info.maker;
  958. info.maker = gNullCharPtr;
  959. }
  960. if (info.copyright != gNullCharPtr)
  961. {
  962. delete[] info.copyright;
  963. info.copyright = gNullCharPtr;
  964. }
  965. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &info);
  966. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  967. {
  968. char strBufLabel[STR_MAX+1];
  969. char strBufMaker[STR_MAX+1];
  970. char strBufCopyright[STR_MAX+1];
  971. carla_zeroChar(strBufLabel, STR_MAX+1);
  972. carla_zeroChar(strBufMaker, STR_MAX+1);
  973. carla_zeroChar(strBufCopyright, STR_MAX+1);
  974. info.type = plugin->getType();
  975. info.category = plugin->getCategory();
  976. info.hints = plugin->getHints();
  977. info.filename = plugin->getFilename();
  978. info.name = plugin->getName();
  979. info.iconName = plugin->getIconName();
  980. info.uniqueId = plugin->getUniqueId();
  981. info.optionsAvailable = plugin->getOptionsAvailable();
  982. info.optionsEnabled = plugin->getOptionsEnabled();
  983. plugin->getLabel(strBufLabel);
  984. info.label = carla_strdup_safe(strBufLabel);
  985. plugin->getMaker(strBufMaker);
  986. info.maker = carla_strdup_safe(strBufMaker);
  987. plugin->getCopyright(strBufCopyright);
  988. info.copyright = carla_strdup_safe(strBufCopyright);
  989. checkStringPtr(info.filename);
  990. checkStringPtr(info.name);
  991. checkStringPtr(info.iconName);
  992. checkStringPtr(info.label);
  993. checkStringPtr(info.maker);
  994. checkStringPtr(info.copyright);
  995. return &info;
  996. }
  997. carla_stderr2("carla_get_plugin_info(%i) - could not find plugin", pluginId);
  998. return &info;
  999. }
  1000. const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId)
  1001. {
  1002. carla_debug("carla_get_audio_port_count_info(%i)", pluginId);
  1003. static CarlaPortCountInfo info;
  1004. // reset
  1005. info.ins = 0;
  1006. info.outs = 0;
  1007. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &info);
  1008. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1009. {
  1010. info.ins = plugin->getAudioInCount();
  1011. info.outs = plugin->getAudioOutCount();
  1012. return &info;
  1013. }
  1014. carla_stderr2("carla_get_audio_port_count_info(%i) - could not find plugin", pluginId);
  1015. return &info;
  1016. }
  1017. const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId)
  1018. {
  1019. carla_debug("carla_get_midi_port_count_info(%i)", pluginId);
  1020. static CarlaPortCountInfo info;
  1021. // reset
  1022. info.ins = 0;
  1023. info.outs = 0;
  1024. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &info);
  1025. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1026. {
  1027. info.ins = plugin->getMidiInCount();
  1028. info.outs = plugin->getMidiOutCount();
  1029. return &info;
  1030. }
  1031. carla_stderr2("carla_get_midi_port_count_info(%i) - could not find plugin", pluginId);
  1032. return &info;
  1033. }
  1034. const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId)
  1035. {
  1036. carla_debug("carla_get_parameter_count_info(%i)", pluginId);
  1037. static CarlaPortCountInfo info;
  1038. // reset
  1039. info.ins = 0;
  1040. info.outs = 0;
  1041. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &info);
  1042. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1043. {
  1044. plugin->getParameterCountInfo(info.ins, info.outs);
  1045. return &info;
  1046. }
  1047. carla_stderr2("carla_get_parameter_count_info(%i) - could not find plugin", pluginId);
  1048. return &info;
  1049. }
  1050. const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId)
  1051. {
  1052. carla_debug("carla_get_parameter_info(%i, %i)", pluginId, parameterId);
  1053. static CarlaParameterInfo info;
  1054. // reset
  1055. info.scalePointCount = 0;
  1056. // cleanup
  1057. if (info.name != gNullCharPtr)
  1058. {
  1059. delete[] info.name;
  1060. info.name = gNullCharPtr;
  1061. }
  1062. if (info.symbol != gNullCharPtr)
  1063. {
  1064. delete[] info.symbol;
  1065. info.symbol = gNullCharPtr;
  1066. }
  1067. if (info.unit != gNullCharPtr)
  1068. {
  1069. delete[] info.unit;
  1070. info.unit = gNullCharPtr;
  1071. }
  1072. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &info);
  1073. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1074. {
  1075. if (parameterId < plugin->getParameterCount())
  1076. {
  1077. char strBufName[STR_MAX+1];
  1078. char strBufSymbol[STR_MAX+1];
  1079. char strBufUnit[STR_MAX+1];
  1080. carla_zeroChar(strBufName, STR_MAX+1);
  1081. carla_zeroChar(strBufSymbol, STR_MAX+1);
  1082. carla_zeroChar(strBufUnit, STR_MAX+1);
  1083. info.scalePointCount = plugin->getParameterScalePointCount(parameterId);
  1084. plugin->getParameterName(parameterId, strBufName);
  1085. info.name = carla_strdup_safe(strBufName);
  1086. plugin->getParameterSymbol(parameterId, strBufSymbol);
  1087. info.symbol = carla_strdup_safe(strBufSymbol);
  1088. plugin->getParameterUnit(parameterId, strBufUnit);
  1089. info.unit = carla_strdup_safe(strBufUnit);
  1090. checkStringPtr(info.name);
  1091. checkStringPtr(info.symbol);
  1092. checkStringPtr(info.unit);
  1093. }
  1094. else
  1095. carla_stderr2("carla_get_parameter_info(%i, %i) - parameterId out of bounds", pluginId, parameterId);
  1096. return &info;
  1097. }
  1098. carla_stderr2("carla_get_parameter_info(%i, %i) - could not find plugin", pluginId, parameterId);
  1099. return &info;
  1100. }
  1101. const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId)
  1102. {
  1103. carla_debug("carla_get_parameter_scalepoint_info(%i, %i, %i)", pluginId, parameterId, scalePointId);
  1104. CARLA_ASSERT(gStandalone.engine != nullptr);
  1105. static CarlaScalePointInfo info;
  1106. // reset
  1107. info.value = 0.0f;
  1108. // cleanup
  1109. if (info.label != gNullCharPtr)
  1110. {
  1111. delete[] info.label;
  1112. info.label = gNullCharPtr;
  1113. }
  1114. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &info);
  1115. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1116. {
  1117. if (parameterId < plugin->getParameterCount())
  1118. {
  1119. if (scalePointId < plugin->getParameterScalePointCount(parameterId))
  1120. {
  1121. char strBufLabel[STR_MAX+1];
  1122. carla_zeroChar(strBufLabel, STR_MAX+1);
  1123. info.value = plugin->getParameterScalePointValue(parameterId, scalePointId);
  1124. plugin->getParameterScalePointLabel(parameterId, scalePointId, strBufLabel);
  1125. info.label = carla_strdup_safe(strBufLabel);
  1126. checkStringPtr(info.label);
  1127. }
  1128. else
  1129. carla_stderr2("carla_get_parameter_scalepoint_info(%i, %i, %i) - scalePointId out of bounds", pluginId, parameterId, scalePointId);
  1130. }
  1131. else
  1132. carla_stderr2("carla_get_parameter_scalepoint_info(%i, %i, %i) - parameterId out of bounds", pluginId, parameterId, scalePointId);
  1133. return &info;
  1134. }
  1135. carla_stderr2("carla_get_parameter_scalepoint_info(%i, %i, %i) - could not find plugin", pluginId, parameterId, scalePointId);
  1136. return &info;
  1137. }
  1138. // -------------------------------------------------------------------------------------------------------------------
  1139. const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId)
  1140. {
  1141. carla_debug("carla_get_parameter_data(%i, %i)", pluginId, parameterId);
  1142. static const ParameterData fallbackParameterData = { CB::PARAMETER_UNKNOWN, 0x0, CB::PARAMETER_NULL, -1, -1, 0 };
  1143. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &fallbackParameterData);
  1144. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1145. {
  1146. if (parameterId < plugin->getParameterCount())
  1147. return &plugin->getParameterData(parameterId);
  1148. carla_stderr2("carla_get_parameter_data(%i, %i) - parameterId out of bounds", pluginId, parameterId);
  1149. return &fallbackParameterData;
  1150. }
  1151. carla_stderr2("carla_get_parameter_data(%i, %i) - could not find plugin", pluginId, parameterId);
  1152. return &fallbackParameterData;
  1153. }
  1154. const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId)
  1155. {
  1156. carla_debug("carla_get_parameter_ranges(%i, %i)", pluginId, parameterId);
  1157. static const ParameterRanges fallbackParamRanges = { 0.0f, 0.0f, 1.0f, 0.01f, 0.0001f, 0.1f };
  1158. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &fallbackParamRanges);
  1159. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1160. {
  1161. if (parameterId < plugin->getParameterCount())
  1162. return &plugin->getParameterRanges(parameterId);
  1163. carla_stderr2("carla_get_parameter_ranges(%i, %i) - parameterId out of bounds", pluginId, parameterId);
  1164. return &fallbackParamRanges;
  1165. }
  1166. carla_stderr2("carla_get_parameter_ranges(%i, %i) - could not find plugin", pluginId, parameterId);
  1167. return &fallbackParamRanges;
  1168. }
  1169. const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId)
  1170. {
  1171. carla_debug("carla_get_midi_program_data(%i, %i)", pluginId, midiProgramId);
  1172. static MidiProgramData midiProgData;
  1173. // reset
  1174. midiProgData.bank = 0;
  1175. midiProgData.program = 0;
  1176. midiProgData.name = gNullCharPtr;
  1177. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &midiProgData);
  1178. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1179. {
  1180. if (midiProgramId < plugin->getMidiProgramCount())
  1181. {
  1182. const MidiProgramData& ret(plugin->getMidiProgramData(midiProgramId));
  1183. carla_copyStruct<MidiProgramData>(midiProgData, ret);
  1184. checkStringPtr(midiProgData.name);
  1185. return &midiProgData;
  1186. }
  1187. carla_stderr2("carla_get_midi_program_data(%i, %i) - midiProgramId out of bounds", pluginId, midiProgramId);
  1188. return &midiProgData;
  1189. }
  1190. carla_stderr2("carla_get_midi_program_data(%i, %i) - could not find plugin", pluginId, midiProgramId);
  1191. return &midiProgData;
  1192. }
  1193. const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId)
  1194. {
  1195. carla_debug("carla_get_custom_data(%i, %i)", pluginId, customDataId);
  1196. static CustomData customData;
  1197. // reset
  1198. customData.type = gNullCharPtr;
  1199. customData.key = gNullCharPtr;
  1200. customData.value = gNullCharPtr;
  1201. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &customData);
  1202. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1203. {
  1204. if (customDataId < plugin->getCustomDataCount())
  1205. {
  1206. const CustomData& ret(plugin->getCustomData(customDataId));
  1207. carla_copyStruct<CustomData>(customData, ret);
  1208. checkStringPtr(customData.type);
  1209. checkStringPtr(customData.key);
  1210. checkStringPtr(customData.value);
  1211. return &customData;
  1212. }
  1213. carla_stderr2("carla_get_custom_data(%i, %i) - customDataId out of bounds", pluginId, customDataId);
  1214. return &customData;
  1215. }
  1216. carla_stderr2("carla_get_custom_data(%i, %i) - could not find plugin", pluginId, customDataId);
  1217. return &customData;
  1218. }
  1219. const char* carla_get_chunk_data(uint pluginId)
  1220. {
  1221. carla_debug("carla_get_chunk_data(%i)", pluginId);
  1222. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr);
  1223. static CarlaString chunkData;
  1224. // cleanup
  1225. chunkData.clear();
  1226. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1227. {
  1228. if (plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS)
  1229. {
  1230. void* data = nullptr;
  1231. const std::size_t dataSize(plugin->getChunkData(&data));
  1232. if (data != nullptr && dataSize > 0)
  1233. {
  1234. chunkData = CarlaString::asBase64(data, static_cast<std::size_t>(dataSize));
  1235. return chunkData;
  1236. }
  1237. else
  1238. carla_stderr2("carla_get_chunk_data(%i) - got invalid chunk data", pluginId);
  1239. }
  1240. else
  1241. carla_stderr2("carla_get_chunk_data(%i) - plugin does not use chunks", pluginId);
  1242. return nullptr;
  1243. }
  1244. carla_stderr2("carla_get_chunk_data(%i) - could not find plugin", pluginId);
  1245. return nullptr;
  1246. }
  1247. // -------------------------------------------------------------------------------------------------------------------
  1248. uint32_t carla_get_parameter_count(uint pluginId)
  1249. {
  1250. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  1251. carla_debug("carla_get_parameter_count(%i)", pluginId);
  1252. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1253. return plugin->getParameterCount();
  1254. carla_stderr2("carla_get_parameter_count(%i) - could not find plugin", pluginId);
  1255. return 0;
  1256. }
  1257. uint32_t carla_get_program_count(uint pluginId)
  1258. {
  1259. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  1260. carla_debug("carla_get_program_count(%i)", pluginId);
  1261. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1262. return plugin->getProgramCount();
  1263. carla_stderr2("carla_get_program_count(%i) - could not find plugin", pluginId);
  1264. return 0;
  1265. }
  1266. uint32_t carla_get_midi_program_count(uint pluginId)
  1267. {
  1268. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  1269. carla_debug("carla_get_midi_program_count(%i)", pluginId);
  1270. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1271. return plugin->getMidiProgramCount();
  1272. carla_stderr2("carla_get_midi_program_count(%i) - could not find plugin", pluginId);
  1273. return 0;
  1274. }
  1275. uint32_t carla_get_custom_data_count(uint pluginId)
  1276. {
  1277. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  1278. carla_debug("carla_get_custom_data_count(%i)", pluginId);
  1279. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1280. return plugin->getCustomDataCount();
  1281. carla_stderr2("carla_get_custom_data_count(%i) - could not find plugin", pluginId);
  1282. return 0;
  1283. }
  1284. // -------------------------------------------------------------------------------------------------------------------
  1285. const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId)
  1286. {
  1287. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr);
  1288. carla_debug("carla_get_parameter_text(%i, %i)", pluginId, parameterId);
  1289. static char textBuf[STR_MAX+1];
  1290. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1291. {
  1292. if (parameterId < plugin->getParameterCount())
  1293. {
  1294. carla_zeroChar(textBuf, STR_MAX+1);
  1295. plugin->getParameterText(parameterId, textBuf);
  1296. return textBuf;
  1297. }
  1298. carla_stderr2("carla_get_parameter_text(%i, %i) - parameterId out of bounds", pluginId, parameterId);
  1299. return nullptr;
  1300. }
  1301. carla_stderr2("carla_get_parameter_text(%i, %i) - could not find plugin", pluginId, parameterId);
  1302. return nullptr;
  1303. }
  1304. const char* carla_get_program_name(uint pluginId, uint32_t programId)
  1305. {
  1306. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr);
  1307. carla_debug("carla_get_program_name(%i, %i)", pluginId, programId);
  1308. static char programName[STR_MAX+1];
  1309. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1310. {
  1311. if (programId < plugin->getProgramCount())
  1312. {
  1313. carla_zeroChar(programName, STR_MAX+1);
  1314. plugin->getProgramName(programId, programName);
  1315. return programName;
  1316. }
  1317. carla_stderr2("carla_get_program_name(%i, %i) - programId out of bounds", pluginId, programId);
  1318. return nullptr;
  1319. }
  1320. carla_stderr2("carla_get_program_name(%i, %i) - could not find plugin", pluginId, programId);
  1321. return nullptr;
  1322. }
  1323. const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId)
  1324. {
  1325. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr);
  1326. carla_debug("carla_get_midi_program_name(%i, %i)", pluginId, midiProgramId);
  1327. static char midiProgramName[STR_MAX+1];
  1328. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1329. {
  1330. if (midiProgramId < plugin->getMidiProgramCount())
  1331. {
  1332. carla_zeroChar(midiProgramName, STR_MAX+1);
  1333. plugin->getMidiProgramName(midiProgramId, midiProgramName);
  1334. return midiProgramName;
  1335. }
  1336. carla_stderr2("carla_get_midi_program_name(%i, %i) - midiProgramId out of bounds", pluginId, midiProgramId);
  1337. return nullptr;
  1338. }
  1339. carla_stderr2("carla_get_midi_program_name(%i, %i) - could not find plugin", pluginId, midiProgramId);
  1340. return nullptr;
  1341. }
  1342. const char* carla_get_real_plugin_name(uint pluginId)
  1343. {
  1344. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, nullptr);
  1345. carla_debug("carla_get_real_plugin_name(%i)", pluginId);
  1346. static char realPluginName[STR_MAX+1];
  1347. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1348. {
  1349. carla_zeroChar(realPluginName, STR_MAX+1);
  1350. plugin->getRealName(realPluginName);
  1351. return realPluginName;
  1352. }
  1353. carla_stderr2("carla_get_real_plugin_name(%i) - could not find plugin", pluginId);
  1354. return nullptr;
  1355. }
  1356. // -------------------------------------------------------------------------------------------------------------------
  1357. int32_t carla_get_current_program_index(uint pluginId)
  1358. {
  1359. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, -1);
  1360. carla_debug("carla_get_current_program_index(%i)", pluginId);
  1361. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1362. return plugin->getCurrentProgram();
  1363. carla_stderr2("carla_get_current_program_index(%i) - could not find plugin", pluginId);
  1364. return -1;
  1365. }
  1366. int32_t carla_get_current_midi_program_index(uint pluginId)
  1367. {
  1368. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, -1);
  1369. carla_debug("carla_get_current_midi_program_index(%i)", pluginId);
  1370. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1371. return plugin->getCurrentMidiProgram();
  1372. carla_stderr2("carla_get_current_midi_program_index(%i) - could not find plugin", pluginId);
  1373. return -1;
  1374. }
  1375. // -------------------------------------------------------------------------------------------------------------------
  1376. float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId)
  1377. {
  1378. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f);
  1379. carla_debug("carla_get_default_parameter_value(%i, %i)", pluginId, parameterId);
  1380. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1381. {
  1382. if (parameterId < plugin->getParameterCount())
  1383. return plugin->getParameterRanges(parameterId).def;
  1384. carla_stderr2("carla_get_default_parameter_value(%i, %i) - parameterId out of bounds", pluginId, parameterId);
  1385. return 0.0f;
  1386. }
  1387. carla_stderr2("carla_get_default_parameter_value(%i, %i) - could not find plugin", pluginId, parameterId);
  1388. return 0.0f;
  1389. }
  1390. float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId)
  1391. {
  1392. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f);
  1393. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1394. {
  1395. if (parameterId < plugin->getParameterCount())
  1396. return plugin->getParameterValue(parameterId);
  1397. carla_stderr2("carla_get_current_parameter_value(%i, %i) - parameterId out of bounds", pluginId, parameterId);
  1398. return 0.0f;
  1399. }
  1400. carla_stderr2("carla_get_current_parameter_value(%i, %i) - could not find plugin", pluginId, parameterId);
  1401. return 0.0f;
  1402. }
  1403. float carla_get_internal_parameter_value(uint pluginId, int32_t parameterId)
  1404. {
  1405. #ifdef BUILD_BRIDGE
  1406. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f);
  1407. #else
  1408. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, (parameterId == CB::PARAMETER_CTRL_CHANNEL) ? -1.0f : 0.0f);
  1409. #endif
  1410. CARLA_SAFE_ASSERT_RETURN(parameterId != CB::PARAMETER_NULL && parameterId > CB::PARAMETER_MAX, 0.0f);
  1411. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1412. return plugin->getInternalParameterValue(parameterId);
  1413. carla_stderr2("carla_get_internal_parameter_value(%i, %i) - could not find plugin", pluginId, parameterId);
  1414. return 0.0f;
  1415. }
  1416. // -------------------------------------------------------------------------------------------------------------------
  1417. float carla_get_input_peak_value(uint pluginId, bool isLeft)
  1418. {
  1419. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f);
  1420. return gStandalone.engine->getInputPeak(pluginId, isLeft);
  1421. }
  1422. float carla_get_output_peak_value(uint pluginId, bool isLeft)
  1423. {
  1424. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f);
  1425. return gStandalone.engine->getOutputPeak(pluginId, isLeft);
  1426. }
  1427. // -------------------------------------------------------------------------------------------------------------------
  1428. void carla_set_active(uint pluginId, bool onOff)
  1429. {
  1430. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1431. carla_debug("carla_set_active(%i, %s)", pluginId, bool2str(onOff));
  1432. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1433. return plugin->setActive(onOff, true, false);
  1434. carla_stderr2("carla_set_active(%i, %s) - could not find plugin", pluginId, bool2str(onOff));
  1435. }
  1436. #ifndef BUILD_BRIDGE
  1437. void carla_set_drywet(uint pluginId, float value)
  1438. {
  1439. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1440. carla_debug("carla_set_drywet(%i, %f)", pluginId, value);
  1441. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1442. return plugin->setDryWet(value, true, false);
  1443. carla_stderr2("carla_set_drywet(%i, %f) - could not find plugin", pluginId, value);
  1444. }
  1445. void carla_set_volume(uint pluginId, float value)
  1446. {
  1447. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1448. carla_debug("carla_set_volume(%i, %f)", pluginId, value);
  1449. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1450. return plugin->setVolume(value, true, false);
  1451. carla_stderr2("carla_set_volume(%i, %f) - could not find plugin", pluginId, value);
  1452. }
  1453. void carla_set_balance_left(uint pluginId, float value)
  1454. {
  1455. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1456. carla_debug("carla_set_balance_left(%i, %f)", pluginId, value);
  1457. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1458. return plugin->setBalanceLeft(value, true, false);
  1459. carla_stderr2("carla_set_balance_left(%i, %f) - could not find plugin", pluginId, value);
  1460. }
  1461. void carla_set_balance_right(uint pluginId, float value)
  1462. {
  1463. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1464. carla_debug("carla_set_balance_right(%i, %f)", pluginId, value);
  1465. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1466. return plugin->setBalanceRight(value, true, false);
  1467. carla_stderr2("carla_set_balance_right(%i, %f) - could not find plugin", pluginId, value);
  1468. }
  1469. void carla_set_panning(uint pluginId, float value)
  1470. {
  1471. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1472. carla_debug("carla_set_panning(%i, %f)", pluginId, value);
  1473. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1474. return plugin->setPanning(value, true, false);
  1475. carla_stderr2("carla_set_panning(%i, %f) - could not find plugin", pluginId, value);
  1476. }
  1477. void carla_set_ctrl_channel(uint pluginId, int8_t channel)
  1478. {
  1479. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1480. CARLA_SAFE_ASSERT_RETURN(channel >= -1 && channel < MAX_MIDI_CHANNELS,);
  1481. carla_debug("carla_set_ctrl_channel(%i, %i)", pluginId, channel);
  1482. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1483. return plugin->setCtrlChannel(channel, true, false);
  1484. carla_stderr2("carla_set_ctrl_channel(%i, %i) - could not find plugin", pluginId, channel);
  1485. }
  1486. void carla_set_option(uint pluginId, uint option, bool yesNo)
  1487. {
  1488. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1489. carla_debug("carla_set_option(%i, %i, %s)", pluginId, option, bool2str(yesNo));
  1490. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1491. return plugin->setOption(option, yesNo, false);
  1492. carla_stderr2("carla_set_option(%i, %i, %s) - could not find plugin", pluginId, option, bool2str(yesNo));
  1493. }
  1494. #endif
  1495. // -------------------------------------------------------------------------------------------------------------------
  1496. void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value)
  1497. {
  1498. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1499. carla_debug("carla_set_parameter_value(%i, %i, %f)", pluginId, parameterId, value);
  1500. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1501. {
  1502. if (parameterId < plugin->getParameterCount())
  1503. return plugin->setParameterValue(parameterId, value, true, true, false);
  1504. carla_stderr2("carla_set_parameter_value(%i, %i, %f) - parameterId out of bounds", pluginId, parameterId, value);
  1505. return;
  1506. }
  1507. carla_stderr2("carla_set_parameter_value(%i, %i, %f) - could not find plugin", pluginId, parameterId, value);
  1508. }
  1509. #ifndef BUILD_BRIDGE
  1510. void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel)
  1511. {
  1512. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1513. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  1514. carla_debug("carla_set_parameter_midi_channel(%i, %i, %i)", pluginId, parameterId, channel);
  1515. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1516. {
  1517. if (parameterId < plugin->getParameterCount())
  1518. return plugin->setParameterMidiChannel(parameterId, channel, true, false);
  1519. carla_stderr2("carla_set_parameter_midi_channel(%i, %i, %i) - parameterId out of bounds", pluginId, parameterId, channel);
  1520. return;
  1521. }
  1522. carla_stderr2("carla_set_parameter_midi_channel(%i, %i, %i) - could not find plugin", pluginId, parameterId, channel);
  1523. }
  1524. void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc)
  1525. {
  1526. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1527. CARLA_SAFE_ASSERT_RETURN(cc >= -1 && cc < MAX_MIDI_CONTROL,);
  1528. carla_debug("carla_set_parameter_midi_cc(%i, %i, %i)", pluginId, parameterId, cc);
  1529. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1530. {
  1531. if (parameterId < plugin->getParameterCount())
  1532. return plugin->setParameterMidiCC(parameterId, cc, true, false);
  1533. carla_stderr2("carla_set_parameter_midi_cc(%i, %i, %i) - parameterId out of bounds", pluginId, parameterId, cc);
  1534. return;
  1535. }
  1536. carla_stderr2("carla_set_parameter_midi_cc(%i, %i, %i) - could not find plugin", pluginId, parameterId, cc);
  1537. }
  1538. #endif
  1539. // -------------------------------------------------------------------------------------------------------------------
  1540. void carla_set_program(uint pluginId, uint32_t programId)
  1541. {
  1542. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1543. carla_debug("carla_set_program(%i, %i)", pluginId, programId);
  1544. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1545. {
  1546. if (programId < plugin->getProgramCount())
  1547. return plugin->setProgram(static_cast<int32_t>(programId), true, true, false);
  1548. carla_stderr2("carla_set_program(%i, %i) - programId out of bounds", pluginId, programId);
  1549. return;
  1550. }
  1551. carla_stderr2("carla_set_program(%i, %i) - could not find plugin", pluginId, programId);
  1552. }
  1553. void carla_set_midi_program(uint pluginId, uint32_t midiProgramId)
  1554. {
  1555. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1556. carla_debug("carla_set_midi_program(%i, %i)", pluginId, midiProgramId);
  1557. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1558. {
  1559. if (midiProgramId < plugin->getMidiProgramCount())
  1560. return plugin->setMidiProgram(static_cast<int32_t>(midiProgramId), true, true, false);
  1561. carla_stderr2("carla_set_midi_program(%i, %i) - midiProgramId out of bounds", pluginId, midiProgramId);
  1562. return;
  1563. }
  1564. carla_stderr2("carla_set_midi_program(%i, %i) - could not find plugin", pluginId, midiProgramId);
  1565. }
  1566. // -------------------------------------------------------------------------------------------------------------------
  1567. void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value)
  1568. {
  1569. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1570. CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',);
  1571. CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
  1572. CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
  1573. carla_debug("carla_set_custom_data(%i, \"%s\", \"%s\", \"%s\")", pluginId, type, key, value);
  1574. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1575. return plugin->setCustomData(type, key, value, true);
  1576. carla_stderr2("carla_set_custom_data(%i, \"%s\", \"%s\", \"%s\") - could not find plugin", pluginId, type, key, value);
  1577. }
  1578. void carla_set_chunk_data(uint pluginId, const char* chunkData)
  1579. {
  1580. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1581. CARLA_SAFE_ASSERT_RETURN(chunkData != nullptr && chunkData[0] != '\0',);
  1582. carla_debug("carla_set_chunk_data(%i, \"%s\")", pluginId, chunkData);
  1583. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1584. {
  1585. if (plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS)
  1586. {
  1587. std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkData));
  1588. return plugin->setChunkData(chunk.data(), chunk.size());
  1589. }
  1590. carla_stderr2("carla_set_chunk_data(%i, \"%s\") - plugin does not use chunks", pluginId, chunkData);
  1591. return;
  1592. }
  1593. carla_stderr2("carla_set_chunk_data(%i, \"%s\") - could not find plugin", pluginId, chunkData);
  1594. }
  1595. // -------------------------------------------------------------------------------------------------------------------
  1596. void carla_prepare_for_save(uint pluginId)
  1597. {
  1598. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1599. carla_debug("carla_prepare_for_save(%i)", pluginId);
  1600. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1601. return plugin->prepareForSave();
  1602. carla_stderr2("carla_prepare_for_save(%i) - could not find plugin", pluginId);
  1603. }
  1604. void carla_reset_parameters(uint pluginId)
  1605. {
  1606. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1607. carla_debug("carla_reset_parameters(%i)", pluginId);
  1608. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1609. return plugin->resetParameters();
  1610. carla_stderr2("carla_reset_parameters(%i) - could not find plugin", pluginId);
  1611. }
  1612. void carla_randomize_parameters(uint pluginId)
  1613. {
  1614. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1615. carla_debug("carla_randomize_parameters(%i)", pluginId);
  1616. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1617. return plugin->randomizeParameters();
  1618. carla_stderr2("carla_randomize_parameters(%i) - could not find plugin", pluginId);
  1619. }
  1620. #ifndef BUILD_BRIDGE
  1621. void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity)
  1622. {
  1623. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(),);
  1624. carla_debug("carla_send_midi_note(%i, %i, %i, %i)", pluginId, channel, note, velocity);
  1625. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1626. return plugin->sendMidiSingleNote(channel, note, velocity, true, true, false);
  1627. carla_stderr2("carla_send_midi_note(%i, %i, %i, %i) - could not find plugin", pluginId, channel, note, velocity);
  1628. }
  1629. #endif
  1630. void carla_show_custom_ui(uint pluginId, bool yesNo)
  1631. {
  1632. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
  1633. carla_debug("carla_show_custom_ui(%i, %s)", pluginId, bool2str(yesNo));
  1634. if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
  1635. return plugin->showCustomUI(yesNo);
  1636. carla_stderr2("carla_show_custom_ui(%i, %s) - could not find plugin", pluginId, bool2str(yesNo));
  1637. }
  1638. // -------------------------------------------------------------------------------------------------------------------
  1639. uint32_t carla_get_buffer_size()
  1640. {
  1641. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0);
  1642. carla_debug("carla_get_buffer_size()");
  1643. return gStandalone.engine->getBufferSize();
  1644. }
  1645. double carla_get_sample_rate()
  1646. {
  1647. CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0);
  1648. carla_debug("carla_get_sample_rate()");
  1649. return gStandalone.engine->getSampleRate();
  1650. }
  1651. // -------------------------------------------------------------------------------------------------------------------
  1652. const char* carla_get_last_error()
  1653. {
  1654. carla_debug("carla_get_last_error()");
  1655. if (gStandalone.engine != nullptr)
  1656. return gStandalone.engine->getLastError();
  1657. return gStandalone.lastError;
  1658. }
  1659. const char* carla_get_host_osc_url_tcp()
  1660. {
  1661. carla_debug("carla_get_host_osc_url_tcp()");
  1662. #ifdef HAVE_LIBLO
  1663. if (gStandalone.engine == nullptr)
  1664. {
  1665. carla_stderr2("Engine is not running");
  1666. gStandalone.lastError = "Engine is not running";
  1667. return nullptr;
  1668. }
  1669. return gStandalone.engine->getOscServerPathTCP();
  1670. #else
  1671. return nullptr;
  1672. #endif
  1673. }
  1674. const char* carla_get_host_osc_url_udp()
  1675. {
  1676. carla_debug("carla_get_host_osc_url_udp()");
  1677. #ifdef HAVE_LIBLO
  1678. if (gStandalone.engine == nullptr)
  1679. {
  1680. carla_stderr2("Engine is not running");
  1681. gStandalone.lastError = "Engine is not running";
  1682. return nullptr;
  1683. }
  1684. return gStandalone.engine->getOscServerPathUDP();
  1685. #else
  1686. return nullptr;
  1687. #endif
  1688. }
  1689. // -------------------------------------------------------------------------------------------------------------------
  1690. #include "CarlaPluginUI.cpp"
  1691. #include "CarlaDssiUtils.cpp"
  1692. #include "CarlaPatchbayUtils.cpp"
  1693. #include "CarlaPipeUtils.cpp"
  1694. #include "CarlaStateUtils.cpp"
  1695. #include "CarlaJuceEvents.cpp"
  1696. // -------------------------------------------------------------------------------------------------------------------