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.

404 lines
23KB

  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. #ifndef BUILD_BRIDGE
  23. void CarlaEngine::oscSend_control_add_plugin_start(const uint pluginId, const char* const pluginName) 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_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  29. CARLA_SAFE_ASSERT_RETURN(pluginName != nullptr && pluginName[0] != '\0',);
  30. carla_debug("CarlaEngine::oscSend_control_add_plugin_start(%i, \"%s\")", pluginId, pluginName);
  31. char targetPath[std::strlen(pData->oscData->path)+18];
  32. std::strcpy(targetPath, pData->oscData->path);
  33. std::strcat(targetPath, "/add_plugin_start");
  34. try_lo_send(pData->oscData->target, targetPath, "is", static_cast<int32_t>(pluginId), pluginName);
  35. }
  36. void CarlaEngine::oscSend_control_add_plugin_end(const uint pluginId) const noexcept
  37. {
  38. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  39. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  40. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  41. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  42. carla_debug("CarlaEngine::oscSend_control_add_plugin_end(%i)", pluginId);
  43. char targetPath[std::strlen(pData->oscData->path)+16];
  44. std::strcpy(targetPath, pData->oscData->path);
  45. std::strcat(targetPath, "/add_plugin_end");
  46. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(pluginId));
  47. }
  48. void CarlaEngine::oscSend_control_remove_plugin(const uint pluginId) const noexcept
  49. {
  50. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  51. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  52. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  53. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  54. carla_debug("CarlaEngine::oscSend_control_remove_plugin(%i)", pluginId);
  55. char targetPath[std::strlen(pData->oscData->path)+15];
  56. std::strcpy(targetPath, pData->oscData->path);
  57. std::strcat(targetPath, "/remove_plugin");
  58. try_lo_send(pData->oscData->target, targetPath, "i", static_cast<int32_t>(pluginId));
  59. }
  60. 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
  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_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  66. CARLA_SAFE_ASSERT_RETURN(type != PLUGIN_NONE,);
  67. 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);
  68. char targetPath[std::strlen(pData->oscData->path)+18];
  69. std::strcpy(targetPath, pData->oscData->path);
  70. std::strcat(targetPath, "/set_plugin_info1");
  71. 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));
  72. }
  73. 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
  74. {
  75. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  76. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  77. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  78. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  79. CARLA_SAFE_ASSERT_RETURN(realName != nullptr && realName[0] != '\0',);
  80. CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0',);
  81. CARLA_SAFE_ASSERT_RETURN(maker != nullptr,);
  82. CARLA_SAFE_ASSERT_RETURN(copyright != nullptr,);
  83. carla_debug("CarlaEngine::oscSend_control_set_plugin_data(%i, \"%s\", \"%s\", \"%s\", \"%s\")", pluginId, realName, label, maker, copyright);
  84. char targetPath[std::strlen(pData->oscData->path)+18];
  85. std::strcpy(targetPath, pData->oscData->path);
  86. std::strcat(targetPath, "/set_plugin_info2");
  87. try_lo_send(pData->oscData->target, targetPath, "issss", static_cast<int32_t>(pluginId), realName, label, maker, copyright);
  88. }
  89. void CarlaEngine::oscSend_control_set_audio_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  90. {
  91. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  92. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  93. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  94. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  95. carla_debug("CarlaEngine::oscSend_control_set_audio_count(%i, %i, %i)", pluginId, ins, outs);
  96. char targetPath[std::strlen(pData->oscData->path)+18];
  97. std::strcpy(targetPath, pData->oscData->path);
  98. std::strcat(targetPath, "/set_audio_count");
  99. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  100. }
  101. void CarlaEngine::oscSend_control_set_midi_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  102. {
  103. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  104. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  105. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  106. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  107. carla_debug("CarlaEngine::oscSend_control_set_midi_count(%i, %i, %i)", pluginId, ins, outs);
  108. char targetPath[std::strlen(pData->oscData->path)+18];
  109. std::strcpy(targetPath, pData->oscData->path);
  110. std::strcat(targetPath, "/set_midi_count");
  111. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  112. }
  113. void CarlaEngine::oscSend_control_set_parameter_count(const uint pluginId, const uint32_t ins, const uint32_t outs) const noexcept
  114. {
  115. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  116. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  117. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  118. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  119. carla_debug("CarlaEngine::oscSend_control_set_parameter_count(%i, %i, %i)", pluginId, ins, outs);
  120. char targetPath[std::strlen(pData->oscData->path)+18];
  121. std::strcpy(targetPath, pData->oscData->path);
  122. std::strcat(targetPath, "/set_parameter_count");
  123. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(ins), static_cast<int32_t>(outs));
  124. }
  125. void CarlaEngine::oscSend_control_set_program_count(const uint pluginId, const uint32_t count) const noexcept
  126. {
  127. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  128. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  129. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  130. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  131. carla_debug("CarlaEngine::oscSend_control_set_program_count(%i, %i)", pluginId, count);
  132. char targetPath[std::strlen(pData->oscData->path)+19];
  133. std::strcpy(targetPath, pData->oscData->path);
  134. std::strcat(targetPath, "/set_program_count");
  135. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), static_cast<int32_t>(count));
  136. }
  137. void CarlaEngine::oscSend_control_set_midi_program_count(const uint pluginId, const uint32_t count) const noexcept
  138. {
  139. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  140. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  141. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  142. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  143. carla_debug("CarlaEngine::oscSend_control_set_midi_program_count(%i, %i)", pluginId, count);
  144. char targetPath[std::strlen(pData->oscData->path)+24];
  145. std::strcpy(targetPath, pData->oscData->path);
  146. std::strcat(targetPath, "/set_midi_program_count");
  147. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), static_cast<int32_t>(count));
  148. }
  149. 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
  150. {
  151. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  152. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  153. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  154. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  155. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',);
  156. CARLA_SAFE_ASSERT_RETURN(unit != nullptr,);
  157. carla_debug("CarlaEngine::oscSend_control_set_parameter_data(%i, %i, %i:%s, %X, \"%s\", \"%s\")", pluginId, index, type, ParameterType2Str(type), hints, name, unit);
  158. char targetPath[std::strlen(pData->oscData->path)+20];
  159. std::strcpy(targetPath, pData->oscData->path);
  160. std::strcat(targetPath, "/set_parameter_data");
  161. 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);
  162. }
  163. 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
  164. {
  165. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  166. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  167. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  168. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  169. CARLA_SAFE_ASSERT_RETURN(def <= min && def >= max,);
  170. CARLA_SAFE_ASSERT_RETURN(min < max,);
  171. carla_debug("CarlaEngine::oscSend_control_set_parameter_ranges1(%i, %i, %f, %f, %f)", pluginId, index, def, min, max, def);
  172. char targetPath[std::strlen(pData->oscData->path)+23];
  173. std::strcpy(targetPath, pData->oscData->path);
  174. std::strcat(targetPath, "/set_parameter_ranges1");
  175. try_lo_send(pData->oscData->target, targetPath, "iifff", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), def, min, max);
  176. }
  177. 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
  178. {
  179. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  180. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  181. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  182. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  183. CARLA_SAFE_ASSERT_RETURN(step <= stepSmall && step >= stepLarge,);
  184. CARLA_SAFE_ASSERT_RETURN(stepSmall <= stepLarge,);
  185. carla_debug("CarlaEngine::oscSend_control_set_parameter_ranges2(%i, %i, %f, %f, %f)", pluginId, index, step, stepSmall, stepLarge);
  186. char targetPath[std::strlen(pData->oscData->path)+23];
  187. std::strcpy(targetPath, pData->oscData->path);
  188. std::strcat(targetPath, "/set_parameter_ranges");
  189. try_lo_send(pData->oscData->target, targetPath, "iifff", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), step, stepSmall, stepLarge);
  190. }
  191. void CarlaEngine::oscSend_control_set_parameter_midi_cc(const uint pluginId, const uint32_t index, const int16_t cc) const noexcept
  192. {
  193. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  194. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  195. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  196. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  197. CARLA_SAFE_ASSERT_RETURN(cc >= -1 && cc < MAX_MIDI_CONTROL,);
  198. carla_debug("CarlaEngine::oscSend_control_set_parameter_midi_cc(%i, %i, %i)", pluginId, index, cc);
  199. char targetPath[std::strlen(pData->oscData->path)+23];
  200. std::strcpy(targetPath, pData->oscData->path);
  201. std::strcat(targetPath, "/set_parameter_midi_cc");
  202. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(cc));
  203. }
  204. void CarlaEngine::oscSend_control_set_parameter_midi_channel(const uint pluginId, const uint32_t index, const uint8_t channel) const noexcept
  205. {
  206. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  207. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  208. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  209. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  210. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  211. carla_debug("CarlaEngine::oscSend_control_set_parameter_midi_channel(%i, %i, %i)", pluginId, index, channel);
  212. char targetPath[std::strlen(pData->oscData->path)+28];
  213. std::strcpy(targetPath, pData->oscData->path);
  214. std::strcat(targetPath, "/set_parameter_midi_channel");
  215. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), static_cast<int32_t>(channel));
  216. }
  217. void CarlaEngine::oscSend_control_set_parameter_value(const uint pluginId, const int32_t index, const float value) 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(pluginId < pData->curPluginCount,);
  223. CARLA_SAFE_ASSERT_RETURN(index != PARAMETER_NULL,);
  224. carla_debug("CarlaEngine::oscSend_control_set_parameter_value(%i, %i:%s, %f)", pluginId, index, (index < 0) ? InternalParameterIndex2Str(static_cast<InternalParameterIndex>(index)) : "(none)", value);
  225. char targetPath[std::strlen(pData->oscData->path)+21];
  226. std::strcpy(targetPath, pData->oscData->path);
  227. std::strcat(targetPath, "/set_parameter_value");
  228. try_lo_send(pData->oscData->target, targetPath, "iif", static_cast<int32_t>(pluginId), index, value);
  229. }
  230. void CarlaEngine::oscSend_control_set_default_value(const uint pluginId, const uint32_t index, const float value) const noexcept
  231. {
  232. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  233. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  234. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  235. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  236. carla_debug("CarlaEngine::oscSend_control_set_default_value(%i, %i, %f)", pluginId, index, value);
  237. char targetPath[std::strlen(pData->oscData->path)+19];
  238. std::strcpy(targetPath, pData->oscData->path);
  239. std::strcat(targetPath, "/set_default_value");
  240. try_lo_send(pData->oscData->target, targetPath, "iif", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), value);
  241. }
  242. void CarlaEngine::oscSend_control_set_current_program(const uint pluginId, const int32_t index) 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(pluginId < pData->curPluginCount,);
  248. carla_debug("CarlaEngine::oscSend_control_set_current_program(%i, %i)", pluginId, index);
  249. char targetPath[std::strlen(pData->oscData->path)+21];
  250. std::strcpy(targetPath, pData->oscData->path);
  251. std::strcat(targetPath, "/set_current_program");
  252. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), index);
  253. }
  254. void CarlaEngine::oscSend_control_set_current_midi_program(const uint pluginId, const int32_t index) const noexcept
  255. {
  256. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  257. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  258. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  259. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  260. carla_debug("CarlaEngine::oscSend_control_set_current_midi_program(%i, %i)", pluginId, index);
  261. char targetPath[std::strlen(pData->oscData->path)+26];
  262. std::strcpy(targetPath, pData->oscData->path);
  263. std::strcat(targetPath, "/set_current_midi_program");
  264. try_lo_send(pData->oscData->target, targetPath, "ii", static_cast<int32_t>(pluginId), index);
  265. }
  266. void CarlaEngine::oscSend_control_set_program_name(const uint pluginId, const uint32_t index, const char* const name) const noexcept
  267. {
  268. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  269. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  270. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  271. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  272. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  273. carla_debug("CarlaEngine::oscSend_control_set_program_name(%i, %i, \"%s\")", pluginId, index, name);
  274. char targetPath[std::strlen(pData->oscData->path)+18];
  275. std::strcpy(targetPath, pData->oscData->path);
  276. std::strcat(targetPath, "/set_program_name");
  277. try_lo_send(pData->oscData->target, targetPath, "iis", static_cast<int32_t>(pluginId), static_cast<int32_t>(index), name);
  278. }
  279. 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
  280. {
  281. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  282. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  283. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  284. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  285. CARLA_SAFE_ASSERT_RETURN(name != nullptr,);
  286. carla_debug("CarlaEngine::oscSend_control_set_midi_program_data(%i, %i, %i, %i, \"%s\")", pluginId, index, bank, program, name);
  287. char targetPath[std::strlen(pData->oscData->path)+23];
  288. std::strcpy(targetPath, pData->oscData->path);
  289. std::strcat(targetPath, "/set_midi_program_data");
  290. 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);
  291. }
  292. void CarlaEngine::oscSend_control_note_on(const uint pluginId, const uint8_t channel, const uint8_t note, const uint8_t velo) const noexcept
  293. {
  294. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  295. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  296. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  297. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  298. CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
  299. CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
  300. CARLA_SAFE_ASSERT_RETURN(velo < MAX_MIDI_VALUE,);
  301. carla_debug("CarlaEngine::oscSend_control_note_on(%i, %i, %i, %i)", pluginId, channel, note, velo);
  302. char targetPath[std::strlen(pData->oscData->path)+9];
  303. std::strcpy(targetPath, pData->oscData->path);
  304. std::strcat(targetPath, "/note_on");
  305. 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));
  306. }
  307. void CarlaEngine::oscSend_control_note_off(const uint pluginId, const uint8_t channel, const uint8_t note) 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(channel < MAX_MIDI_CHANNELS,);
  314. CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,);
  315. carla_debug("CarlaEngine::oscSend_control_note_off(%i, %i, %i)", pluginId, channel, note);
  316. char targetPath[std::strlen(pData->oscData->path)+10];
  317. std::strcpy(targetPath, pData->oscData->path);
  318. std::strcat(targetPath, "/note_off");
  319. try_lo_send(pData->oscData->target, targetPath, "iii", static_cast<int32_t>(pluginId), static_cast<int32_t>(channel), static_cast<int32_t>(note));
  320. }
  321. void CarlaEngine::oscSend_control_set_peaks(const uint pluginId) const noexcept
  322. {
  323. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  324. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  325. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  326. CARLA_SAFE_ASSERT_RETURN(pluginId < pData->curPluginCount,);
  327. // TODO - try and see if we can get peaks[4] ref
  328. const EnginePluginData& epData(pData->plugins[pluginId]);
  329. char targetPath[std::strlen(pData->oscData->path)+11];
  330. std::strcpy(targetPath, pData->oscData->path);
  331. std::strcat(targetPath, "/set_peaks");
  332. 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]);
  333. }
  334. void CarlaEngine::oscSend_control_exit() const noexcept
  335. {
  336. CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,);
  337. CARLA_SAFE_ASSERT_RETURN(pData->oscData->path != nullptr && pData->oscData->path[0] != '\0',);
  338. CARLA_SAFE_ASSERT_RETURN(pData->oscData->target != nullptr,);
  339. carla_debug("CarlaEngine::oscSend_control_exit()");
  340. char targetPath[std::strlen(pData->oscData->path)+6];
  341. std::strcpy(targetPath, pData->oscData->path);
  342. std::strcat(targetPath, "/exit");
  343. try_lo_send(pData->oscData->target, targetPath, "");
  344. }
  345. #endif // BUILD_BRIDGE
  346. // -----------------------------------------------------------------------
  347. CARLA_BACKEND_END_NAMESPACE