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
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  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 uint optionsAvailable, const uint optionsEnabled, 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, %X, %X, " P_INT64 ")", category, PluginCategory2Str(category), hints, optionsAvailable, optionsEnabled, 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, "iiiih", static_cast<int32_t>(category), static_cast<int32_t>(hints), static_cast<int32_t>(optionsAvailable), static_cast<int32_t>(optionsEnabled), 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_data1(const uint32_t index, const int32_t rindex, const ParameterType type, const uint hints, const int16_t cc) 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(cc >= -1 && cc < 0x9F,); // FIXME
  110. carla_debug("CarlaEngine::oscSend_bridge_parameter_data1(%i, %i, %i:%s, %X, %i)", index, rindex, type, ParameterType2Str(type), hints, cc);
  111. char targetPath[std::strlen(pData->oscData->path)+25];
  112. std::strcpy(targetPath, pData->oscData->path);
  113. std::strcat(targetPath, "/bridge_parameter_data1");
  114. try_lo_send(pData->oscData->target, targetPath, "iiiii", static_cast<int32_t>(index), static_cast<int32_t>(rindex), static_cast<int32_t>(type), static_cast<int32_t>(hints), static_cast<int32_t>(cc));
  115. }
  116. void CarlaEngine::oscSend_bridge_parameter_data2(const uint32_t index, const char* const name, const char* const unit) const noexcept
  117. {
  118. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  119. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  120. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  121. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  122. CARLA_SAFE_ASSERT_RETURN(unit != nullptr,);
  123. carla_debug("CarlaEngine::oscSend_bridge_parameter_data2(%i, \"%s\", \"%s\")", index, name, unit);
  124. char targetPath[std::strlen(pData->oscData->path)+25];
  125. std::strcpy(targetPath, pData->oscData->path);
  126. std::strcat(targetPath, "/bridge_parameter_data2");
  127. try_lo_send(pData->oscData->target, targetPath, "iss", static_cast<int32_t>(index), name, unit);
  128. }
  129. void CarlaEngine::oscSend_bridge_parameter_ranges1(const uint32_t index, const float def, const float min, const float max) const noexcept
  130. {
  131. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  132. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  133. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  134. carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, def, min, max);
  135. char targetPath[std::strlen(pData->oscData->path)+26];
  136. std::strcpy(targetPath, pData->oscData->path);
  137. std::strcat(targetPath, "/bridge_parameter_ranges1");
  138. try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), def, min, max);
  139. }
  140. void CarlaEngine::oscSend_bridge_parameter_ranges2(const uint32_t index, const float step, const float stepSmall, const float stepLarge) const noexcept
  141. {
  142. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  143. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  144. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  145. carla_debug("CarlaEngine::oscSend_bridge_parameter_ranges(%i, %f, %f, %f)", index, step, stepSmall, stepLarge);
  146. char targetPath[std::strlen(pData->oscData->path)+26];
  147. std::strcpy(targetPath, pData->oscData->path);
  148. std::strcat(targetPath, "/bridge_parameter_ranges2");
  149. try_lo_send(pData->oscData->target, targetPath, "ifff", static_cast<int32_t>(index), step, stepSmall, stepLarge);
  150. }
  151. void CarlaEngine::oscSend_bridge_parameter_value(const uint32_t index, const float value) const noexcept
  152. {
  153. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  154. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  155. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  156. carla_debug("CarlaEngine::oscSend_bridge_parameter_value(%i, %f)", index, value);
  157. char targetPath[std::strlen(pData->oscData->path)+24];
  158. std::strcpy(targetPath, pData->oscData->path);
  159. std::strcat(targetPath, "/bridge_parameter_value");
  160. try_lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value);
  161. }
  162. void CarlaEngine::oscSend_bridge_default_value(const uint32_t index, const float value) const noexcept
  163. {
  164. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  165. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  166. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  167. carla_debug("CarlaEngine::oscSend_bridge_default_value(%i, %f)", index, value);
  168. char targetPath[std::strlen(pData->oscData->path)+22];
  169. std::strcpy(targetPath, pData->oscData->path);
  170. std::strcat(targetPath, "/bridge_default_value");
  171. try_lo_send(pData->oscData->target, targetPath, "if", static_cast<int32_t>(index), value);
  172. }
  173. void CarlaEngine::oscSend_bridge_current_program(const int32_t index) const noexcept
  174. {
  175. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  176. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  177. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  178. carla_debug("CarlaEngine::oscSend_bridge_current_program(%i)", index);
  179. char targetPath[std::strlen(pData->oscData->path)+24];
  180. std::strcpy(targetPath, pData->oscData->path);
  181. std::strcat(targetPath, "/bridge_current_program");
  182. try_lo_send(pData->oscData->target, targetPath, "i", index);
  183. }
  184. void CarlaEngine::oscSend_bridge_current_midi_program(const int32_t index) const noexcept
  185. {
  186. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  187. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  188. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  189. carla_debug("CarlaEngine::oscSend_bridge_current_midi_program(%i)", index);
  190. char targetPath[std::strlen(pData->oscData->path)+30];
  191. std::strcpy(targetPath, pData->oscData->path);
  192. std::strcat(targetPath, "/bridge_current_midi_program");
  193. try_lo_send(pData->oscData->target, targetPath, "i", index);
  194. }
  195. void CarlaEngine::oscSend_bridge_program_name(const uint32_t index, const char* const name) const noexcept
  196. {
  197. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  198. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  199. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  200. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  201. carla_debug("CarlaEngine::oscSend_bridge_program_name(%i, \"%s\")", index, name);
  202. char targetPath[std::strlen(pData->oscData->path)+21];
  203. std::strcpy(targetPath, pData->oscData->path);
  204. std::strcat(targetPath, "/bridge_program_name");
  205. try_lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(index), name);
  206. }
  207. 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
  208. {
  209. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  210. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  211. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  212. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  213. carla_debug("CarlaEngine::oscSend_bridge_midi_program_data(%i, %i, %i, \"%s\")", index, bank, program, name);
  214. char targetPath[std::strlen(pData->oscData->path)+26];
  215. std::strcpy(targetPath, pData->oscData->path);
  216. std::strcat(targetPath, "/bridge_midi_program_data");
  217. try_lo_send(pData->oscData->target, targetPath, "iiis", static_cast<int32_t>(index), static_cast<int32_t>(bank), static_cast<int32_t>(program), name);
  218. }
  219. void CarlaEngine::oscSend_bridge_configure(const char* const key, const char* const value) const noexcept
  220. {
  221. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  222. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  223. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  224. CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
  225. CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
  226. carla_debug("CarlaEngine::oscSend_bridge_configure(\"%s\", \"%s\")", key, value);
  227. char targetPath[std::strlen(pData->oscData->path)+18];
  228. std::strcpy(targetPath, pData->oscData->path);
  229. std::strcat(targetPath, "/bridge_configure");
  230. try_lo_send(pData->oscData->target, targetPath, "ss", key, value);
  231. }
  232. void CarlaEngine::oscSend_bridge_set_custom_data(const char* const type, const char* const key, const char* const value) const noexcept
  233. {
  234. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  235. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  236. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  237. CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',);
  238. CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
  239. CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
  240. carla_debug("CarlaEngine::oscSend_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value);
  241. char targetPath[std::strlen(pData->oscData->path)+24];
  242. std::strcpy(targetPath, pData->oscData->path);
  243. std::strcat(targetPath, "/bridge_set_custom_data");
  244. try_lo_send(pData->oscData->target, targetPath, "sss", type, key, value);
  245. }
  246. void CarlaEngine::oscSend_bridge_set_chunk_data_file(const char* const chunkDataFile) const noexcept
  247. {
  248. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  249. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  250. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  251. CARLA_SAFE_ASSERT_RETURN(chunkDataFile != nullptr && chunkDataFile[0] != '\0',);
  252. carla_debug("CarlaEngine::oscSend_bridge_set_chunk_data_file(\"%s\")", chunkDataFile);
  253. char targetPath[std::strlen(pData->oscData->path)+28];
  254. std::strcpy(targetPath, pData->oscData->path);
  255. std::strcat(targetPath, "/bridge_set_chunk_data_file");
  256. try_lo_send(pData->oscData->target, targetPath, "s", chunkDataFile);
  257. }
  258. void CarlaEngine::oscSend_bridge_pong() const noexcept
  259. {
  260. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  261. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  262. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  263. //carla_debug("CarlaEngine::oscSend_pong()");
  264. char targetPath[std::strlen(pData->oscData->path)+13];
  265. std::strcpy(targetPath, pData->oscData->path);
  266. std::strcat(targetPath, "/bridge_pong");
  267. try_lo_send(pData->oscData->target, targetPath, "");
  268. }
  269. #else // BUILD_BRIDGE
  270. void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) const noexcept
  271. {
  272. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  273. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  274. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  275. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  276. CARLA_SAFE_ASSERT_RETURN(pluginName != nullptr && pluginName[0] != '\0',);
  277. carla_debug("CarlaEngine::oscSend_control_add_plugin_start(%i, \"%s\")", pluginId, pluginName);
  278. char targetPath[std::strlen(pData->oscData->path)+18];
  279. std::strcpy(targetPath, pData->oscData->path);
  280. std::strcat(targetPath, "/add_plugin_start");
  281. try_lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(pluginId), pluginName);
  282. }
  283. void CarlaEngine::oscSend_control_add_plugin_end(const uint pluginId) const noexcept
  284. {
  285. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  286. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  287. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  288. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  289. carla_debug("CarlaEngine::oscSend_control_add_plugin_end(%i)", pluginId);
  290. char targetPath[std::strlen(pData->oscData->path)+16];
  291. std::strcpy(targetPath, pData->oscData->path);
  292. std::strcat(targetPath, "/add_plugin_end");
  293. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(pluginId));
  294. }
  295. void CarlaEngine::oscSend_control_remove_plugin(const uint pluginId) const noexcept
  296. {
  297. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  298. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  299. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  300. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  301. carla_debug("CarlaEngine::oscSend_control_remove_plugin(%i)", pluginId);
  302. char targetPath[std::strlen(pData->oscData->path)+15];
  303. std::strcpy(targetPath, pData->oscData->path);
  304. std::strcat(targetPath, "/remove_plugin");
  305. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(pluginId));
  306. }
  307. 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
  308. {
  309. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  310. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  311. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  312. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  313. CARLA_SAFE_ASSERT_RETURN(type != PLUGIN_NONE,);
  314. 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);
  315. char targetPath[std::strlen(pData->oscData->path)+18];
  316. std::strcpy(targetPath, pData->oscData->path);
  317. std::strcat(targetPath, "/set_plugin_info1");
  318. 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));
  319. }
  320. 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
  321. {
  322. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  323. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  324. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  325. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  326. CARLA_SAFE_ASSERT_RETURN(realName != nullptr && realName[0] != '\0',);
  327. CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',);
  328. CARLA_SAFE_ASSERT_RETURN(maker != nullptr,);
  329. CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,);
  330. carla_debug("CarlaEngine::oscSend_control_set_plugin_data(%i, \"%s\", \"%s\", \"%s\", \"%s\")", pluginId, realName, label, maker, copyright);
  331. char targetPath[std::strlen(pData->oscData->path)+18];
  332. std::strcpy(targetPath, pData->oscData->path);
  333. std::strcat(targetPath, "/set_plugin_info2");
  334. try_lo_send(pData->oscData->target, targetPath, "issss", static_cast<int32_t>(pluginId), realName, label, maker, copyright);
  335. }
  336. void CarlaEngine::oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  337. {
  338. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  339. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  340. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  341. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  342. carla_debug("CarlaEngine::oscSend_control_set_audio_count(%i, %i, %i)", pluginId, ins, outs);
  343. char targetPath[std::strlen(pData->oscData->path)+18];
  344. std::strcpy(targetPath, pData->oscData->path);
  345. std::strcat(targetPath, "/set_audio_count");
  346. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  347. }
  348. void CarlaEngine::oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  349. {
  350. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  351. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  352. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  353. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  354. carla_debug("CarlaEngine::oscSend_control_set_midi_count(%i, %i, %i)", pluginId, ins, outs);
  355. char targetPath[std::strlen(pData->oscData->path)+18];
  356. std::strcpy(targetPath, pData->oscData->path);
  357. std::strcat(targetPath, "/set_midi_count");
  358. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  359. }
  360. void CarlaEngine::oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  361. {
  362. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  363. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  364. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  365. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  366. carla_debug("CarlaEngine::oscSend_control_set_parameter_count(%i, %i, %i)", pluginId, ins, outs);
  367. char targetPath[std::strlen(pData->oscData->path)+18];
  368. std::strcpy(targetPath, pData->oscData->path);
  369. std::strcat(targetPath, "/set_parameter_count");
  370. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  371. }
  372. void CarlaEngine::oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const noexcept
  373. {
  374. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  375. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  376. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  377. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  378. carla_debug("CarlaEngine::oscSend_control_set_program_count(%i, %i)", pluginId, count);
  379. char targetPath[std::strlen(pData->oscData->path)+19];
  380. std::strcpy(targetPath, pData->oscData->path);
  381. std::strcat(targetPath, "/set_program_count");
  382. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), static_cast<int32_t>(count));
  383. }
  384. void CarlaEngine::oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const noexcept
  385. {
  386. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  387. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  388. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  389. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  390. carla_debug("CarlaEngine::oscSend_control_set_midi_program_count(%i, %i)", pluginId, count);
  391. char targetPath[std::strlen(pData->oscData->path)+24];
  392. std::strcpy(targetPath, pData->oscData->path);
  393. std::strcat(targetPath, "/set_midi_program_count");
  394. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), static_cast<int32_t>(count));
  395. }
  396. 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
  397. {
  398. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  399. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  400. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  401. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  402. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',);
  403. CARLA_SAFE_ASSERT_RETURN(unit != nullptr,);
  404. carla_debug("CarlaEngine::oscSend_control_set_parameter_data(%i, %i, %i:%s, %X, \"%s\", \"%s\")", pluginId, index, type, ParameterType2Str(type), hints, name, unit);
  405. char targetPath[std::strlen(pData->oscData->path)+20];
  406. std::strcpy(targetPath, pData->oscData->path);
  407. std::strcat(targetPath, "/set_parameter_data");
  408. 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);
  409. }
  410. 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
  411. {
  412. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  413. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  414. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  415. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  416. CARLA_SAFE_ASSERT_RETURN(def <= min && def >= max,);
  417. CARLA_SAFE_ASSERT_RETURN(min < max,);
  418. carla_debug("CarlaEngine::oscSend_control_set_parameter_ranges1(%i, %i, %f, %f, %f)", pluginId, index, def, min, max, def);
  419. char targetPath[std::strlen(pData->oscData->path)+23];
  420. std::strcpy(targetPath, pData->oscData->path);
  421. std::strcat(targetPath, "/set_parameter_ranges1");
  422. try_lo_send(pData->oscData->target, targetPath, "iifff", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), def, min, max);
  423. }
  424. 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
  425. {
  426. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  427. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  428. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  429. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  430. CARLA_SAFE_ASSERT_RETURN(step <= stepSmall && step >= stepLarge,);
  431. CARLA_SAFE_ASSERT_RETURN(stepSmall <= stepLarge,);
  432. carla_debug("CarlaEngine::oscSend_control_set_parameter_ranges2(%i, %i, %f, %f, %f)", pluginId, index, step, stepSmall, stepLarge);
  433. char targetPath[std::strlen(pData->oscData->path)+23];
  434. std::strcpy(targetPath, pData->oscData->path);
  435. std::strcat(targetPath, "/set_parameter_ranges");
  436. try_lo_send(pData->oscData->target, targetPath, "iifff", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), step, stepSmall, stepLarge);
  437. }
  438. void CarlaEngine::oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const noexcept
  439. {
  440. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  441. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  442. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  443. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  444. CARLA_SAFE_ASSERT_RETURN(cc <= 0x5F,);
  445. carla_debug("CarlaEngine::oscSend_control_set_parameter_midi_cc(%i, %i, %i)", pluginId, index, cc);
  446. char targetPath[std::strlen(pData->oscData->path)+23];
  447. std::strcpy(targetPath, pData->oscData->path);
  448. std::strcat(targetPath, "/set_parameter_midi_cc");
  449. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(cc));
  450. }
  451. void CarlaEngine::oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const noexcept
  452. {
  453. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  454. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  455. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  456. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  457. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  458. carla_debug("CarlaEngine::oscSend_control_set_parameter_midi_channel(%i, %i, %i)", pluginId, index, channel);
  459. char targetPath[std::strlen(pData->oscData->path)+28];
  460. std::strcpy(targetPath, pData->oscData->path);
  461. std::strcat(targetPath, "/set_parameter_midi_channel");
  462. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(channel));
  463. }
  464. void CarlaEngine::oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) const noexcept
  465. {
  466. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  467. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  468. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  469. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  470. CARLA_SAFE_ASSERT_RETURN(index != PARAMETER_NULL,);
  471. carla_debug("CarlaEngine::oscSend_control_set_parameter_value(%i, %i:%s, %f)", pluginId, index, (index < 0) ? InternalParameterIndex2Str(static_cast<InternalParameterIndex>(index)) : "(none)", value);
  472. char targetPath[std::strlen(pData->oscData->path)+21];
  473. std::strcpy(targetPath, pData->oscData->path);
  474. std::strcat(targetPath, "/set_parameter_value");
  475. try_lo_send(pData->oscData->target, targetPath, "iif", static_cast<int32_t>(pluginId), index, value);
  476. }
  477. void CarlaEngine::oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const noexcept
  478. {
  479. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  480. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  481. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  482. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  483. carla_debug("CarlaEngine::oscSend_control_set_default_value(%i, %i, %f)", pluginId, index, value);
  484. char targetPath[std::strlen(pData->oscData->path)+19];
  485. std::strcpy(targetPath, pData->oscData->path);
  486. std::strcat(targetPath, "/set_default_value");
  487. try_lo_send(pData->oscData->target, targetPath, "iif", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), value);
  488. }
  489. void CarlaEngine::oscSend_control_set_current_program(const uint pluginId, const int32_t index) const noexcept
  490. {
  491. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  492. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  493. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  494. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  495. carla_debug("CarlaEngine::oscSend_control_set_current_program(%i, %i)", pluginId, index);
  496. char targetPath[std::strlen(pData->oscData->path)+21];
  497. std::strcpy(targetPath, pData->oscData->path);
  498. std::strcat(targetPath, "/set_current_program");
  499. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), index);
  500. }
  501. void CarlaEngine::oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const noexcept
  502. {
  503. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  504. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  505. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  506. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  507. carla_debug("CarlaEngine::oscSend_control_set_current_midi_program(%i, %i)", pluginId, index);
  508. char targetPath[std::strlen(pData->oscData->path)+26];
  509. std::strcpy(targetPath, pData->oscData->path);
  510. std::strcat(targetPath, "/set_current_midi_program");
  511. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), index);
  512. }
  513. void CarlaEngine::oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const noexcept
  514. {
  515. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  516. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  517. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  518. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  519. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  520. carla_debug("CarlaEngine::oscSend_control_set_program_name(%i, %i, \"%s\")", pluginId, index, name);
  521. char targetPath[std::strlen(pData->oscData->path)+18];
  522. std::strcpy(targetPath, pData->oscData->path);
  523. std::strcat(targetPath, "/set_program_name");
  524. try_lo_send(pData->oscData->target, targetPath, "iis", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), name);
  525. }
  526. 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
  527. {
  528. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  529. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  530. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  531. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  532. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  533. carla_debug("CarlaEngine::oscSend_control_set_midi_program_data(%i, %i, %i, %i, \"%s\")", pluginId, index, bank, program, name);
  534. char targetPath[std::strlen(pData->oscData->path)+23];
  535. std::strcpy(targetPath, pData->oscData->path);
  536. std::strcat(targetPath, "/set_midi_program_data");
  537. 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);
  538. }
  539. void CarlaEngine::oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const noexcept
  540. {
  541. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  542. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  543. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  544. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  545. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  546. CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
  547. CARLA_SAFE_ASSERT_RETURN(velo < MAX_MIDI_VALUE,);
  548. carla_debug("CarlaEngine::oscSend_control_note_on(%i, %i, %i, %i)", pluginId, channel, note, velo);
  549. char targetPath[std::strlen(pData->oscData->path)+9];
  550. std::strcpy(targetPath, pData->oscData->path);
  551. std::strcat(targetPath, "/note_on");
  552. 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));
  553. }
  554. void CarlaEngine::oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) const noexcept
  555. {
  556. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  557. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  558. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  559. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  560. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  561. CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
  562. carla_debug("CarlaEngine::oscSend_control_note_off(%i, %i, %i)", pluginId, channel, note);
  563. char targetPath[std::strlen(pData->oscData->path)+10];
  564. std::strcpy(targetPath, pData->oscData->path);
  565. std::strcat(targetPath, "/note_off");
  566. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(channel), static_cast<int32_t>(note));
  567. }
  568. void CarlaEngine::oscSend_control_set_peaks(const uint pluginId) const noexcept
  569. {
  570. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  571. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  572. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  573. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  574. // TODO - try and see if we can get peaks[4] ref
  575. const EnginePluginData& epData(pData->plugins[pluginId]);
  576. char targetPath[std::strlen(pData->oscData->path)+11];
  577. std::strcpy(targetPath, pData->oscData->path);
  578. std::strcat(targetPath, "/set_peaks");
  579. 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]);
  580. }
  581. void CarlaEngine::oscSend_control_exit() const noexcept
  582. {
  583. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  584. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  585. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  586. carla_debug("CarlaEngine::oscSend_control_exit()");
  587. char targetPath[std::strlen(pData->oscData->path)+6];
  588. std::strcpy(targetPath, pData->oscData->path);
  589. std::strcat(targetPath, "/exit");
  590. try_lo_send(pData->oscData->target, targetPath, "");
  591. }
  592. #endif // BUILD_BRIDGE
  593. // -----------------------------------------------------------------------
  594. CARLA_BACKEND_END_NAMESPACE