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.

CarlaEngineOscSend.cpp 38KB

10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "CarlaBackendUtils.hpp"
  18. #include "CarlaEngineInternal.hpp"
  19. #include "CarlaMIDI.h"
  20. CARLA_BACKEND_START_NAMESPACE
  21. // -----------------------------------------------------------------------
  22. #ifdef BUILD_BRIDGE
  23. void CarlaEngine::oscSend_bridge_plugin_info1(const PluginCategory category, const uint hints, const int64_t uniqueId) const noexcept
  24. {
  25. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  26. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  27. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  28. carla_debug("CarlaEngine::oscSend_bridge_plugin_info1(%i:%s, %X, " P_INT64 ")", category, PluginCategory2Str(category), hints, uniqueId);
  29. char targetPath[std::strlen(pData->oscData->path)+21];
  30. std::strcpy(targetPath, pData->oscData->path);
  31. std::strcat(targetPath, "/bridge_plugin_info1");
  32. try_lo_send(pData->oscData->target, targetPath, "iih", static_cast<int32_t>(category), static_cast<int32_t>(hints), uniqueId);
  33. }
  34. void CarlaEngine::oscSend_bridge_plugin_info2(const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept
  35. {
  36. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  37. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  38. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  39. CARLA_SAFE_ASSERT_RETURN(realName != nullptr && realName[0] != '\0',);
  40. CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',);
  41. CARLA_SAFE_ASSERT_RETURN(maker != nullptr,);
  42. CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,);
  43. carla_debug("CarlaEngine::oscSend_bridge_plugin_info2(\"%s\", \"%s\", \"%s\", \"%s\")", realName, label, maker, copyright);
  44. char targetPath[std::strlen(pData->oscData->path)+21];
  45. std::strcpy(targetPath, pData->oscData->path);
  46. std::strcat(targetPath, "/bridge_plugin_info2");
  47. try_lo_send(pData->oscData->target, targetPath, "ssss", realName, label, maker, copyright);
  48. }
  49. void CarlaEngine::oscSend_bridge_audio_count(const uint32_t ins, const uint32_t outs) const noexcept
  50. {
  51. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  52. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  53. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  54. carla_debug("CarlaEngine::oscSend_bridge_audio_count(%i, %i)", ins, outs);
  55. char targetPath[std::strlen(pData->oscData->path)+20];
  56. std::strcpy(targetPath, pData->oscData->path);
  57. std::strcat(targetPath, "/bridge_audio_count");
  58. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  59. }
  60. void CarlaEngine::oscSend_bridge_midi_count(const uint32_t ins, const uint32_t outs) const noexcept
  61. {
  62. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  63. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  64. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  65. carla_debug("CarlaEngine::oscSend_bridge_midi_count(%i, %i)", ins, outs);
  66. char targetPath[std::strlen(pData->oscData->path)+19];
  67. std::strcpy(targetPath, pData->oscData->path);
  68. std::strcat(targetPath, "/bridge_midi_count");
  69. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  70. }
  71. void CarlaEngine::oscSend_bridge_parameter_count(const uint32_t ins, const uint32_t outs) const noexcept
  72. {
  73. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  74. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  75. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  76. carla_debug("CarlaEngine::oscSend_bridge_parameter_count(%i, %i)", ins, outs);
  77. char targetPath[std::strlen(pData->oscData->path)+24];
  78. std::strcpy(targetPath, pData->oscData->path);
  79. std::strcat(targetPath, "/bridge_parameter_count");
  80. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  81. }
  82. void CarlaEngine::oscSend_bridge_program_count(const uint32_t count) const noexcept
  83. {
  84. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  85. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  86. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  87. carla_debug("CarlaEngine::oscSend_bridge_program_count(%i)", count);
  88. char targetPath[std::strlen(pData->oscData->path)+23];
  89. std::strcpy(targetPath, pData->oscData->path);
  90. std::strcat(targetPath, "/bridge_program_count");
  91. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count));
  92. }
  93. void CarlaEngine::oscSend_bridge_midi_program_count(const uint32_t count) const noexcept
  94. {
  95. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  96. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  97. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  98. carla_debug("CarlaEngine::oscSend_bridge_midi_program_count(%i)", count);
  99. char targetPath[std::strlen(pData->oscData->path)+27];
  100. std::strcpy(targetPath, pData->oscData->path);
  101. std::strcat(targetPath, "/bridge_midi_program_count");
  102. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(count));
  103. }
  104. void CarlaEngine::oscSend_bridge_parameter_data(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const char* const name, const char* const unit) const noexcept
  105. {
  106. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  107. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  108. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  109. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  110. CARLA_SAFE_ASSERT_RETURN(unit != nullptr,);
  111. carla_debug("CarlaEngine::oscSend_bridge_parameter_data(%i, %i, %i:%s, %X, \"%s\", \"%s\")", index, rindex, type, ParameterType2Str(type), hints, name, unit);
  112. char targetPath[std::strlen(pData->oscData->path)+24];
  113. std::strcpy(targetPath, pData->oscData->path);
  114. std::strcat(targetPath, "/bridge_parameter_data");
  115. try_lo_send(pData->oscData->target, targetPath, "iiiiss", static_cast<int32_t>(index), static_cast<int32_t>(rindex), static_cast<int32_t>(type), static_cast<int32_t>(hints), name, unit);
  116. }
  117. void CarlaEngine::oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept
  118. {
  119. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  120. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  121. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  122. carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, def, min, max);
  123. char targetPath[std::strlen(pData->oscData->path)+26];
  124. std::strcpy(targetPath, pData->oscData->path);
  125. std::strcat(targetPath, "/bridge_parameter_ranges1");
  126. try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), def, min, max);
  127. }
  128. void CarlaEngine::oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept
  129. {
  130. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  131. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  132. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  133. carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, step, stepSmall, stepLarge);
  134. char targetPath[std::strlen(pData->oscData->path)+26];
  135. std::strcpy(targetPath, pData->oscData->path);
  136. std::strcat(targetPath, "/bridge_parameter_ranges2");
  137. try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), step, stepSmall, stepLarge);
  138. }
  139. void CarlaEngine::oscSend_bridge_parameter_midi_cc(const uint32_t index, const int16_t cc) const noexcept
  140. {
  141. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  142. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  143. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  144. carla_debug("CarlaEngine::oscSend_bridge_parameter_midi_cc(%i, %i)", index, cc);
  145. char targetPath[std::strlen(pData->oscData->path)+26];
  146. std::strcpy(targetPath, pData->oscData->path);
  147. std::strcat(targetPath, "/bridge_parameter_midi_cc");
  148. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(index), static_cast<int32_t>(cc));
  149. }
  150. void CarlaEngine::oscSend_bridge_parameter_midi_channel(const uint32_t index, const uint8_t channel) const noexcept
  151. {
  152. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  153. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  154. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  155. carla_debug("CarlaEngine::oscSend_bridge_parameter_midi_channel(%i, %i)", index, channel);
  156. char targetPath[std::strlen(pData->oscData->path)+31];
  157. std::strcpy(targetPath, pData->oscData->path);
  158. std::strcat(targetPath, "/bridge_parameter_midi_channel");
  159. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(index), static_cast<int32_t>(channel));
  160. }
  161. void CarlaEngine::oscSend_bridge_parameter_value(const uint32_t index, const float value) const noexcept
  162. {
  163. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  164. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  165. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  166. carla_debug("CarlaEngine::oscSend_bridge_parameter_value(%i, %f)", index, value);
  167. char targetPath[std::strlen(pData->oscData->path)+24];
  168. std::strcpy(targetPath, pData->oscData->path);
  169. std::strcat(targetPath, "/bridge_parameter_value");
  170. try_lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value);
  171. }
  172. void CarlaEngine::oscSend_bridge_default_value(const uint32_t index, const float value) const noexcept
  173. {
  174. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  175. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  176. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  177. carla_debug("CarlaEngine::oscSend_bridge_default_value(%i, %f)", index, value);
  178. char targetPath[std::strlen(pData->oscData->path)+22];
  179. std::strcpy(targetPath, pData->oscData->path);
  180. std::strcat(targetPath, "/bridge_default_value");
  181. try_lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value);
  182. }
  183. void CarlaEngine::oscSend_bridge_current_program(const int32_t index) const noexcept
  184. {
  185. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  186. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  187. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  188. carla_debug("CarlaEngine::oscSend_bridge_current_program(%i)", index);
  189. char targetPath[std::strlen(pData->oscData->path)+24];
  190. std::strcpy(targetPath, pData->oscData->path);
  191. std::strcat(targetPath, "/bridge_current_program");
  192. try_lo_send(pData->oscData->target, targetPath, "i", index);
  193. }
  194. void CarlaEngine::oscSend_bridge_current_midi_program(const int32_t index) const noexcept
  195. {
  196. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  197. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  198. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  199. carla_debug("CarlaEngine::oscSend_bridge_current_midi_program(%i)", index);
  200. char targetPath[std::strlen(pData->oscData->path)+30];
  201. std::strcpy(targetPath, pData->oscData->path);
  202. std::strcat(targetPath, "/bridge_current_midi_program");
  203. try_lo_send(pData->oscData->target, targetPath, "i", index);
  204. }
  205. void CarlaEngine::oscSend_bridge_program_name(const uint32_t index, const char* const name) const noexcept
  206. {
  207. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  208. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  209. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  210. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  211. carla_debug("CarlaEngine::oscSend_bridge_program_name(%i, \"%s\")", index, name);
  212. char targetPath[std::strlen(pData->oscData->path)+21];
  213. std::strcpy(targetPath, pData->oscData->path);
  214. std::strcat(targetPath, "/bridge_program_name");
  215. try_lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(index), name);
  216. }
  217. void CarlaEngine::oscSend_bridge_midi_program_data(const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const noexcept
  218. {
  219. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  220. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  221. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  222. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  223. carla_debug("CarlaEngine::oscSend_bridge_midi_program_data(%i, %i, %i, \"%s\")", index, bank, program, name);
  224. char targetPath[std::strlen(pData->oscData->path)+26];
  225. std::strcpy(targetPath, pData->oscData->path);
  226. std::strcat(targetPath, "/bridge_midi_program_data");
  227. try_lo_send(pData->oscData->target, targetPath, "iiis", static_cast<int32_t>(index), static_cast<int32_t>(bank), static_cast<int32_t>(program), name);
  228. }
  229. void CarlaEngine::oscSend_bridge_configure(const char* const key, const char* const value) const noexcept
  230. {
  231. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  232. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  233. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  234. CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
  235. CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
  236. carla_debug("CarlaEngine::oscSend_bridge_configure(\"%s\", \"%s\")", key, value);
  237. char targetPath[std::strlen(pData->oscData->path)+18];
  238. std::strcpy(targetPath, pData->oscData->path);
  239. std::strcat(targetPath, "/bridge_configure");
  240. try_lo_send(pData->oscData->target, targetPath, "ss", key, value);
  241. }
  242. void CarlaEngine::oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const noexcept
  243. {
  244. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  245. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  246. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  247. CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',);
  248. CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
  249. CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
  250. carla_debug("CarlaEngine::oscSend_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value);
  251. char targetPath[std::strlen(pData->oscData->path)+24];
  252. std::strcpy(targetPath, pData->oscData->path);
  253. std::strcat(targetPath, "/bridge_set_custom_data");
  254. try_lo_send(pData->oscData->target, targetPath, "sss", type, key, value);
  255. }
  256. void CarlaEngine::oscSend_bridge_set_chunk_data(const char* const chunkFile) const noexcept
  257. {
  258. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  259. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  260. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  261. CARLA_SAFE_ASSERT_RETURN(chunkFile != nullptr && chunkFile[0] != '\0',);
  262. carla_debug("CarlaEngine::oscSend_bridge_set_chunk_data(\"%s\")", chunkFile);
  263. char targetPath[std::strlen(pData->oscData->path)+23];
  264. std::strcpy(targetPath, pData->oscData->path);
  265. std::strcat(targetPath, "/bridge_set_chunk_data");
  266. try_lo_send(pData->oscData->target, targetPath, "s", chunkFile);
  267. }
  268. void CarlaEngine::oscSend_bridge_pong() const noexcept
  269. {
  270. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  271. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  272. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  273. //carla_debug("CarlaEngine::oscSend_pong()");
  274. char targetPath[std::strlen(pData->oscData->path)+13];
  275. std::strcpy(targetPath, pData->oscData->path);
  276. std::strcat(targetPath, "/bridge_pong");
  277. try_lo_send(pData->oscData->target, targetPath, "");
  278. }
  279. #else
  280. void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const noexcept
  281. {
  282. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  283. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  284. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  285. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  286. CARLA_SAFE_ASSERT_RETURN(pluginName != nullptr && pluginName[0] != '\0',);
  287. carla_debug("CarlaEngine::oscSend_control_add_plugin_start(%i, \"%s\")", pluginId, pluginName);
  288. char targetPath[std::strlen(pData->oscData->path)+18];
  289. std::strcpy(targetPath, pData->oscData->path);
  290. std::strcat(targetPath, "/add_plugin_start");
  291. try_lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(pluginId), pluginName);
  292. }
  293. void CarlaEngine::oscSend_control_add_plugin_end(const uint pluginId) const noexcept
  294. {
  295. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  296. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  297. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  298. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  299. carla_debug("CarlaEngine::oscSend_control_add_plugin_end(%i)", pluginId);
  300. char targetPath[std::strlen(pData->oscData->path)+16];
  301. std::strcpy(targetPath, pData->oscData->path);
  302. std::strcat(targetPath, "/add_plugin_end");
  303. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(pluginId));
  304. }
  305. void CarlaEngine::oscSend_control_remove_plugin(const uint pluginId) const noexcept
  306. {
  307. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  308. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  309. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  310. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  311. carla_debug("CarlaEngine::oscSend_control_remove_plugin(%i)", pluginId);
  312. char targetPath[std::strlen(pData->oscData->path)+15];
  313. std::strcpy(targetPath, pData->oscData->path);
  314. std::strcat(targetPath, "/remove_plugin");
  315. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(pluginId));
  316. }
  317. void CarlaEngine::oscSend_control_set_plugin_info1(const uint pluginId, const PluginType type, const PluginCategory category, const uint hints, const int64_t uniqueId) const noexcept
  318. {
  319. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  320. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  321. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  322. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  323. CARLA_SAFE_ASSERT_RETURN(type != PLUGIN_NONE,);
  324. carla_debug("CarlaEngine::oscSend_control_set_plugin_data(%i, %i:%s, %i:%s, %X, " P_INT64 ")", pluginId, type, PluginType2Str(type), category, PluginCategory2Str(category), hints, uniqueId);
  325. char targetPath[std::strlen(pData->oscData->path)+18];
  326. std::strcpy(targetPath, pData->oscData->path);
  327. std::strcat(targetPath, "/set_plugin_info1");
  328. try_lo_send(pData->oscData->target, targetPath, "iiiih", static_cast<int32_t>(pluginId), static_cast<int32_t>(type), static_cast<int32_t>(category), static_cast<int32_t>(hints), static_cast<int64_t>(uniqueId));
  329. }
  330. void CarlaEngine::oscSend_control_set_plugin_info2(const uint pluginId, const char* const realName, const char* const label, const char* const maker, const char* const copyright) const noexcept
  331. {
  332. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  333. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  334. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  335. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  336. CARLA_SAFE_ASSERT_RETURN(realName != nullptr && realName[0] != '\0',);
  337. CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',);
  338. CARLA_SAFE_ASSERT_RETURN(maker != nullptr,);
  339. CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,);
  340. carla_debug("CarlaEngine::oscSend_control_set_plugin_data(%i, \"%s\", \"%s\", \"%s\", \"%s\")", pluginId, realName, label, maker, copyright);
  341. char targetPath[std::strlen(pData->oscData->path)+18];
  342. std::strcpy(targetPath, pData->oscData->path);
  343. std::strcat(targetPath, "/set_plugin_info2");
  344. try_lo_send(pData->oscData->target, targetPath, "issss", static_cast<int32_t>(pluginId), realName, label, maker, copyright);
  345. }
  346. void CarlaEngine::oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  347. {
  348. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  349. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  350. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  351. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  352. carla_debug("CarlaEngine::oscSend_control_set_audio_count(%i, %i, %i)", pluginId, ins, outs);
  353. char targetPath[std::strlen(pData->oscData->path)+18];
  354. std::strcpy(targetPath, pData->oscData->path);
  355. std::strcat(targetPath, "/set_audio_count");
  356. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  357. }
  358. void CarlaEngine::oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  359. {
  360. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  361. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  362. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  363. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  364. carla_debug("CarlaEngine::oscSend_control_set_midi_count(%i, %i, %i)", pluginId, ins, outs);
  365. char targetPath[std::strlen(pData->oscData->path)+18];
  366. std::strcpy(targetPath, pData->oscData->path);
  367. std::strcat(targetPath, "/set_midi_count");
  368. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  369. }
  370. void CarlaEngine::oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  371. {
  372. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  373. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  374. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  375. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  376. carla_debug("CarlaEngine::oscSend_control_set_parameter_count(%i, %i, %i)", pluginId, ins, outs);
  377. char targetPath[std::strlen(pData->oscData->path)+18];
  378. std::strcpy(targetPath, pData->oscData->path);
  379. std::strcat(targetPath, "/set_parameter_count");
  380. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  381. }
  382. void CarlaEngine::oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const noexcept
  383. {
  384. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  385. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  386. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  387. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  388. carla_debug("CarlaEngine::oscSend_control_set_program_count(%i, %i)", pluginId, count);
  389. char targetPath[std::strlen(pData->oscData->path)+19];
  390. std::strcpy(targetPath, pData->oscData->path);
  391. std::strcat(targetPath, "/set_program_count");
  392. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), static_cast<int32_t>(count));
  393. }
  394. void CarlaEngine::oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const noexcept
  395. {
  396. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  397. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  398. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  399. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  400. carla_debug("CarlaEngine::oscSend_control_set_midi_program_count(%i, %i)", pluginId, count);
  401. char targetPath[std::strlen(pData->oscData->path)+24];
  402. std::strcpy(targetPath, pData->oscData->path);
  403. std::strcat(targetPath, "/set_midi_program_count");
  404. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), static_cast<int32_t>(count));
  405. }
  406. void CarlaEngine::oscSend_control_set_parameter_data(const uint pluginId, const uint32_t index, const ParameterType type, const uint hints, const char* const name, const char* const unit) const noexcept
  407. {
  408. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  409. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  410. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  411. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  412. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',);
  413. CARLA_SAFE_ASSERT_RETURN(unit != nullptr,);
  414. carla_debug("CarlaEngine::oscSend_control_set_parameter_data(%i, %i, %i:%s, %X, \"%s\", \"%s\")", pluginId, index, type, ParameterType2Str(type), hints, name, unit);
  415. char targetPath[std::strlen(pData->oscData->path)+20];
  416. std::strcpy(targetPath, pData->oscData->path);
  417. std::strcat(targetPath, "/set_parameter_data");
  418. try_lo_send(pData->oscData->target, targetPath, "iiiiss", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(type), static_cast<int32_t>(hints), name, unit);
  419. }
  420. void CarlaEngine::oscSend_control_set_parameter_ranges1(const uint pluginId, const uint32_t index, const float def, const float min, const float max) const noexcept
  421. {
  422. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  423. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  424. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  425. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  426. CARLA_SAFE_ASSERT_RETURN(def <= min && def >= max,);
  427. CARLA_SAFE_ASSERT_RETURN(min < max,);
  428. carla_debug("CarlaEngine::oscSend_control_set_parameter_ranges1(%i, %i, %f, %f, %f)", pluginId, index, def, min, max, def);
  429. char targetPath[std::strlen(pData->oscData->path)+23];
  430. std::strcpy(targetPath, pData->oscData->path);
  431. std::strcat(targetPath, "/set_parameter_ranges1");
  432. try_lo_send(pData->oscData->target, targetPath, "iifff", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), def, min, max);
  433. }
  434. void CarlaEngine::oscSend_control_set_parameter_ranges2(const uint pluginId, const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept
  435. {
  436. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  437. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  438. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  439. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  440. CARLA_SAFE_ASSERT_RETURN(step <= stepSmall && step >= stepLarge,);
  441. CARLA_SAFE_ASSERT_RETURN(stepSmall <= stepLarge,);
  442. carla_debug("CarlaEngine::oscSend_control_set_parameter_ranges2(%i, %i, %f, %f, %f)", pluginId, index, step, stepSmall, stepLarge);
  443. char targetPath[std::strlen(pData->oscData->path)+23];
  444. std::strcpy(targetPath, pData->oscData->path);
  445. std::strcat(targetPath, "/set_parameter_ranges");
  446. try_lo_send(pData->oscData->target, targetPath, "iifff", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), step, stepSmall, stepLarge);
  447. }
  448. void CarlaEngine::oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const noexcept
  449. {
  450. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  451. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  452. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  453. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  454. CARLA_SAFE_ASSERT_RETURN(cc <= 0x5F,);
  455. carla_debug("CarlaEngine::oscSend_control_set_parameter_midi_cc(%i, %i, %i)", pluginId, index, cc);
  456. char targetPath[std::strlen(pData->oscData->path)+23];
  457. std::strcpy(targetPath, pData->oscData->path);
  458. std::strcat(targetPath, "/set_parameter_midi_cc");
  459. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(cc));
  460. }
  461. void CarlaEngine::oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const noexcept
  462. {
  463. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  464. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  465. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  466. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  467. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  468. carla_debug("CarlaEngine::oscSend_control_set_parameter_midi_channel(%i, %i, %i)", pluginId, index, channel);
  469. char targetPath[std::strlen(pData->oscData->path)+28];
  470. std::strcpy(targetPath, pData->oscData->path);
  471. std::strcat(targetPath, "/set_parameter_midi_channel");
  472. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(channel));
  473. }
  474. void CarlaEngine::oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) const noexcept
  475. {
  476. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  477. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  478. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  479. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  480. CARLA_SAFE_ASSERT_RETURN(index != PARAMETER_NULL,);
  481. carla_debug("CarlaEngine::oscSend_control_set_parameter_value(%i, %i:%s, %f)", pluginId, index, (index < 0) ? InternalParameterIndex2Str(static_cast<InternalParameterIndex>(index)) : "(none)", value);
  482. char targetPath[std::strlen(pData->oscData->path)+21];
  483. std::strcpy(targetPath, pData->oscData->path);
  484. std::strcat(targetPath, "/set_parameter_value");
  485. try_lo_send(pData->oscData->target, targetPath, "iif", static_cast<int32_t>(pluginId), index, value);
  486. }
  487. void CarlaEngine::oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const noexcept
  488. {
  489. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  490. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  491. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  492. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  493. carla_debug("CarlaEngine::oscSend_control_set_default_value(%i, %i, %f)", pluginId, index, value);
  494. char targetPath[std::strlen(pData->oscData->path)+19];
  495. std::strcpy(targetPath, pData->oscData->path);
  496. std::strcat(targetPath, "/set_default_value");
  497. try_lo_send(pData->oscData->target, targetPath, "iif", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), value);
  498. }
  499. void CarlaEngine::oscSend_control_set_current_program(const uint pluginId, const int32_t index) const noexcept
  500. {
  501. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  502. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  503. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  504. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  505. carla_debug("CarlaEngine::oscSend_control_set_current_program(%i, %i)", pluginId, index);
  506. char targetPath[std::strlen(pData->oscData->path)+21];
  507. std::strcpy(targetPath, pData->oscData->path);
  508. std::strcat(targetPath, "/set_current_program");
  509. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), index);
  510. }
  511. void CarlaEngine::oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const noexcept
  512. {
  513. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  514. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  515. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  516. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  517. carla_debug("CarlaEngine::oscSend_control_set_current_midi_program(%i, %i)", pluginId, index);
  518. char targetPath[std::strlen(pData->oscData->path)+26];
  519. std::strcpy(targetPath, pData->oscData->path);
  520. std::strcat(targetPath, "/set_current_midi_program");
  521. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), index);
  522. }
  523. void CarlaEngine::oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const noexcept
  524. {
  525. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  526. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  527. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  528. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  529. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  530. carla_debug("CarlaEngine::oscSend_control_set_program_name(%i, %i, \"%s\")", pluginId, index, name);
  531. char targetPath[std::strlen(pData->oscData->path)+18];
  532. std::strcpy(targetPath, pData->oscData->path);
  533. std::strcat(targetPath, "/set_program_name");
  534. try_lo_send(pData->oscData->target, targetPath, "iis", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), name);
  535. }
  536. void CarlaEngine::oscSend_control_set_midi_program_data(const uint pluginId, const uint32_t index, const uint32_t bank, const uint32_t program, const char* const name) const noexcept
  537. {
  538. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  539. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  540. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  541. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  542. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  543. carla_debug("CarlaEngine::oscSend_control_set_midi_program_data(%i, %i, %i, %i, \"%s\")", pluginId, index, bank, program, name);
  544. char targetPath[std::strlen(pData->oscData->path)+23];
  545. std::strcpy(targetPath, pData->oscData->path);
  546. std::strcat(targetPath, "/set_midi_program_data");
  547. try_lo_send(pData->oscData->target, targetPath, "iiiis", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(bank), static_cast<int32_t>(program), name);
  548. }
  549. void CarlaEngine::oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const noexcept
  550. {
  551. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  552. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  553. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  554. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  555. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  556. CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
  557. CARLA_SAFE_ASSERT_RETURN(velo < MAX_MIDI_VALUE,);
  558. carla_debug("CarlaEngine::oscSend_control_note_on(%i, %i, %i, %i)", pluginId, channel, note, velo);
  559. char targetPath[std::strlen(pData->oscData->path)+9];
  560. std::strcpy(targetPath, pData->oscData->path);
  561. std::strcat(targetPath, "/note_on");
  562. try_lo_send(pData->oscData->target, targetPath, "iiii", static_cast<int32_t>(pluginId), static_cast<int32_t>(channel), static_cast<int32_t>(note), static_cast<int32_t>(velo));
  563. }
  564. void CarlaEngine::oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) const noexcept
  565. {
  566. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  567. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  568. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  569. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  570. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  571. CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
  572. carla_debug("CarlaEngine::oscSend_control_note_off(%i, %i, %i)", pluginId, channel, note);
  573. char targetPath[std::strlen(pData->oscData->path)+10];
  574. std::strcpy(targetPath, pData->oscData->path);
  575. std::strcat(targetPath, "/note_off");
  576. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(channel), static_cast<int32_t>(note));
  577. }
  578. void CarlaEngine::oscSend_control_set_peaks(const uint pluginId) const noexcept
  579. {
  580. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  581. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  582. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  583. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  584. // TODO - try and see if we can get peaks[4] ref
  585. const EnginePluginData& epData(pData->plugins[pluginId]);
  586. char targetPath[std::strlen(pData->oscData->path)+11];
  587. std::strcpy(targetPath, pData->oscData->path);
  588. std::strcat(targetPath, "/set_peaks");
  589. try_lo_send(pData->oscData->target, targetPath, "iffff", static_cast<int32_t>(pluginId), epData.insPeak[0], epData.insPeak[1], epData.outsPeak[0], epData.outsPeak[1]);
  590. }
  591. void CarlaEngine::oscSend_control_exit() const noexcept
  592. {
  593. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  594. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  595. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  596. carla_debug("CarlaEngine::oscSend_control_exit()");
  597. char targetPath[std::strlen(pData->oscData->path)+6];
  598. std::strcpy(targetPath, pData->oscData->path);
  599. std::strcat(targetPath, "/exit");
  600. try_lo_send(pData->oscData->target, targetPath, "");
  601. }
  602. #endif
  603. // -----------------------------------------------------------------------
  604. CARLA_BACKEND_END_NAMESPACE