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.

584 lines
19KB

  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "CarlaEngineOsc.hpp"
  18. #ifdef HAVE_LIBLO
  19. #include "CarlaEngine.hpp"
  20. #include "CarlaPlugin.hpp"
  21. #include "CarlaMIDI.h"
  22. #include <cctype>
  23. CARLA_BACKEND_START_NAMESPACE
  24. // -----------------------------------------------------------------------
  25. int CarlaEngineOsc::handleMessage(const bool isTCP, const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg)
  26. {
  27. CARLA_SAFE_ASSERT_RETURN(fName.isNotEmpty(), 1);
  28. CARLA_SAFE_ASSERT_RETURN(path != nullptr && path[0] != '\0', 1);
  29. #ifdef DEBUG
  30. if (std::strstr(path, "/bridge_pong") == nullptr) {
  31. carla_debug("CarlaEngineOsc::handleMessage(%s, \"%s\", %i, %p, \"%s\", %p)", bool2str(isTCP), path, argc, argv, types, msg);
  32. }
  33. #endif
  34. if (isTCP)
  35. {
  36. CARLA_SAFE_ASSERT_RETURN(fServerPathTCP.isNotEmpty(), 1);
  37. CARLA_SAFE_ASSERT_RETURN(fServerTCP != nullptr, 1);
  38. }
  39. else
  40. {
  41. CARLA_SAFE_ASSERT_RETURN(fServerPathUDP.isNotEmpty(), 1);
  42. CARLA_SAFE_ASSERT_RETURN(fServerUDP != nullptr, 1);
  43. }
  44. // Initial path check
  45. if (std::strcmp(path, "/register") == 0)
  46. return handleMsgRegister(isTCP, argc, argv, types);
  47. if (std::strcmp(path, "/unregister") == 0)
  48. return handleMsgUnregister(isTCP, argc, argv, types);
  49. if (std::strncmp(path, "/ctrl/", 6) == 0)
  50. {
  51. CARLA_SAFE_ASSERT_RETURN(isTCP, 1);
  52. return handleMsgControl(path + 6, argc, argv, types);
  53. }
  54. const std::size_t nameSize(fName.length());
  55. // Check if message is for this client
  56. if (std::strlen(path) <= nameSize || std::strncmp(path+1, fName, nameSize) != 0)
  57. {
  58. carla_stderr("CarlaEngineOsc::handleMessage() - message not for this client -> '%s' != '/%s/'",
  59. path, fName.buffer());
  60. return 1;
  61. }
  62. // Get plugin id from path, "/carla/23/method" -> 23
  63. uint pluginId = 0;
  64. std::size_t offset;
  65. if (std::isdigit(path[nameSize+2]))
  66. {
  67. if (std::isdigit(path[nameSize+3]))
  68. {
  69. if (std::isdigit(path[nameSize+5]))
  70. {
  71. carla_stderr2("CarlaEngineOsc::handleMessage() - invalid plugin id, over 999? (value: \"%s\")", path+(nameSize+1));
  72. return 1;
  73. }
  74. else if (std::isdigit(path[nameSize+4]))
  75. {
  76. // 3 digits, /xyz/method
  77. offset = 6;
  78. pluginId += uint(path[nameSize+2]-'0')*100;
  79. pluginId += uint(path[nameSize+3]-'0')*10;
  80. pluginId += uint(path[nameSize+4]-'0');
  81. }
  82. else
  83. {
  84. // 2 digits, /xy/method
  85. offset = 5;
  86. pluginId += uint(path[nameSize+2]-'0')*10;
  87. pluginId += uint(path[nameSize+3]-'0');
  88. }
  89. }
  90. else
  91. {
  92. // single digit, /x/method
  93. offset = 4;
  94. pluginId += uint(path[nameSize+2]-'0');
  95. }
  96. }
  97. else
  98. {
  99. carla_stderr("CarlaEngineOsc::handleMessage() - invalid message '%s'", path);
  100. return 1;
  101. }
  102. if (pluginId > fEngine->getCurrentPluginCount())
  103. {
  104. carla_stderr("CarlaEngineOsc::handleMessage() - failed to get plugin, wrong id '%i'", pluginId);
  105. return 0;
  106. }
  107. // Get plugin
  108. CarlaPlugin* const plugin(fEngine->getPluginUnchecked(pluginId));
  109. if (plugin == nullptr || plugin->getId() != pluginId)
  110. {
  111. carla_stderr("CarlaEngineOsc::handleMessage() - invalid plugin id '%i', probably has been removed (path: '%s')", pluginId, path);
  112. return 0;
  113. }
  114. // Get method from path, "/Carla/i/method" -> "method"
  115. char method[32+1];
  116. method[32] = '\0';
  117. std::strncpy(method, path + (nameSize + offset), 32);
  118. if (method[0] == '\0')
  119. {
  120. carla_stderr("CarlaEngineOsc::handleMessage(%s, \"%s\", ...) - received message without method", bool2str(isTCP), path);
  121. return 0;
  122. }
  123. // Internal methods
  124. if (std::strcmp(method, "set_option") == 0)
  125. return 0; //handleMsgSetOption(plugin, argc, argv, types); // TODO
  126. if (std::strcmp(method, "set_active") == 0)
  127. return handleMsgSetActive(plugin, argc, argv, types);
  128. if (std::strcmp(method, "set_drywet") == 0)
  129. return handleMsgSetDryWet(plugin, argc, argv, types);
  130. if (std::strcmp(method, "set_volume") == 0)
  131. return handleMsgSetVolume(plugin, argc, argv, types);
  132. if (std::strcmp(method, "set_balance_left") == 0)
  133. return handleMsgSetBalanceLeft(plugin, argc, argv, types);
  134. if (std::strcmp(method, "set_balance_right") == 0)
  135. return handleMsgSetBalanceRight(plugin, argc, argv, types);
  136. if (std::strcmp(method, "set_panning") == 0)
  137. return handleMsgSetPanning(plugin, argc, argv, types);
  138. if (std::strcmp(method, "set_ctrl_channel") == 0)
  139. return 0; //handleMsgSetControlChannel(plugin, argc, argv, types); // TODO
  140. if (std::strcmp(method, "set_parameter_value") == 0)
  141. return handleMsgSetParameterValue(plugin, argc, argv, types);
  142. if (std::strcmp(method, "set_parameter_midi_cc") == 0)
  143. return handleMsgSetParameterMidiCC(plugin, argc, argv, types);
  144. if (std::strcmp(method, "set_parameter_midi_channel") == 0)
  145. return handleMsgSetParameterMidiChannel(plugin, argc, argv, types);
  146. if (std::strcmp(method, "set_program") == 0)
  147. return handleMsgSetProgram(plugin, argc, argv, types);
  148. if (std::strcmp(method, "set_midi_program") == 0)
  149. return handleMsgSetMidiProgram(plugin, argc, argv, types);
  150. if (std::strcmp(method, "set_custom_data") == 0)
  151. return 0; //handleMsgSetCustomData(plugin, argc, argv, types); // TODO
  152. if (std::strcmp(method, "set_chunk") == 0)
  153. return 0; //handleMsgSetChunk(plugin, argc, argv, types); // TODO
  154. if (std::strcmp(method, "note_on") == 0)
  155. return handleMsgNoteOn(plugin, argc, argv, types);
  156. if (std::strcmp(method, "note_off") == 0)
  157. return handleMsgNoteOff(plugin, argc, argv, types);
  158. // Send all other methods to plugins, TODO
  159. plugin->handleOscMessage(method, argc, argv, types, msg);
  160. return 0;
  161. }
  162. // -----------------------------------------------------------------------
  163. int CarlaEngineOsc::handleMsgRegister(const bool isTCP,
  164. const int argc, const lo_arg* const* const argv, const char* const types)
  165. {
  166. carla_debug("CarlaEngineOsc::handleMsgRegister()");
  167. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "s");
  168. const char* const url = &argv[0]->s;
  169. const lo_address addr = lo_address_new_from_url(url);
  170. CarlaOscData& oscData(isTCP ? fControlDataTCP : fControlDataUDP);
  171. if (oscData.owner != nullptr)
  172. {
  173. carla_stderr("OSC backend already registered to %s", oscData.owner);
  174. char* const path = lo_url_get_path(url);
  175. char targetPath[std::strlen(path)+18];
  176. std::strcpy(targetPath, path);
  177. std::strcat(targetPath, "/exit-error");
  178. lo_send_from(addr, isTCP ? fServerTCP : fServerUDP, LO_TT_IMMEDIATE,
  179. targetPath, "s", "OSC already registered to another client");
  180. free(path);
  181. }
  182. else
  183. {
  184. carla_stdout("OSC backend registered to %s", url);
  185. const char* const host = lo_address_get_hostname(addr);
  186. const char* const port = lo_address_get_port(addr);
  187. const lo_address target = lo_address_new_with_proto(isTCP ? LO_TCP : LO_UDP, host, port);
  188. oscData.owner = carla_strdup_safe(url);
  189. oscData.path = carla_strdup_free(lo_url_get_path(url));
  190. oscData.target = target;
  191. if (isTCP)
  192. {
  193. const EngineOptions& opts(fEngine->getOptions());
  194. fEngine->callback(false, true,
  195. ENGINE_CALLBACK_ENGINE_STARTED, 0,
  196. opts.processMode,
  197. opts.transportMode,
  198. static_cast<int>(fEngine->getBufferSize()),
  199. static_cast<float>(fEngine->getSampleRate()),
  200. fEngine->getCurrentDriverName());
  201. for (uint i=0, count=fEngine->getCurrentPluginCount(); i < count; ++i)
  202. {
  203. CarlaPlugin* const plugin(fEngine->getPluginUnchecked(i));
  204. CARLA_SAFE_ASSERT_CONTINUE(plugin != nullptr);
  205. fEngine->callback(false, true, ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName());
  206. }
  207. }
  208. }
  209. lo_address_free(addr);
  210. return 0;
  211. }
  212. int CarlaEngineOsc::handleMsgUnregister(const bool isTCP,
  213. const int argc, const lo_arg* const* const argv, const char* const types)
  214. {
  215. carla_debug("CarlaEngineOsc::handleMsgUnregister()");
  216. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "s");
  217. CarlaOscData& oscData(isTCP ? fControlDataTCP : fControlDataUDP);
  218. if (oscData.owner == nullptr)
  219. {
  220. carla_stderr("OSC backend is not registered yet, unregister failed");
  221. return 0;
  222. }
  223. const char* const url = &argv[0]->s;
  224. if (std::strcmp(oscData.owner, url) == 0)
  225. {
  226. carla_stdout("OSC client %s unregistered", url);
  227. oscData.clear();
  228. return 0;
  229. }
  230. carla_stderr("OSC backend unregister failed, current owner %s does not match requested %s", oscData.owner, url);
  231. return 0;
  232. }
  233. int CarlaEngineOsc::handleMsgControl(const char* const method,
  234. const int argc, const lo_arg* const* const argv, const char* const types)
  235. {
  236. carla_debug("CarlaEngineOsc::handleMsgControl()");
  237. CARLA_SAFE_ASSERT_RETURN(method != nullptr && method[0] != '\0', 0);
  238. CARLA_SAFE_ASSERT_RETURN(types != nullptr, 0);
  239. if (fControlDataTCP.owner == nullptr)
  240. {
  241. carla_stderr("OSC backend is not registered yet, control failed");
  242. return 0;
  243. }
  244. carla_stdout("OSC control for '%s'", method);
  245. // "patchbay_refresh",
  246. // "transport_play",
  247. // "transport_pause",
  248. // "transport_relocate",
  249. // "transport_bpm",
  250. /**/ if (std::strcmp(method, "clear_engine_xruns") == 0)
  251. {
  252. fEngine->clearXruns();
  253. }
  254. else if (std::strcmp(method, "cancel_engine_action") == 0)
  255. {
  256. fEngine->setActionCanceled(true);
  257. }
  258. // "patchbay_connect",
  259. // "patchbay_disconnect",
  260. else if (std::strcmp(method, "patchbay_connect") == 0)
  261. {
  262. CARLA_SAFE_ASSERT_INT_RETURN(argc == 4, argc, 0);
  263. CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0);
  264. CARLA_SAFE_ASSERT_RETURN(types[1] == 'i', 0);
  265. CARLA_SAFE_ASSERT_RETURN(types[2] == 'i', 0);
  266. CARLA_SAFE_ASSERT_RETURN(types[3] == 'i', 0);
  267. const int32_t i0 = argv[0]->i;
  268. CARLA_SAFE_ASSERT_RETURN(i0 >= 0, 0);
  269. const int32_t i1 = argv[1]->i;
  270. CARLA_SAFE_ASSERT_RETURN(i1 >= 0, 0);
  271. const int32_t i2 = argv[2]->i;
  272. CARLA_SAFE_ASSERT_RETURN(i2 >= 0, 0);
  273. const int32_t i3 = argv[3]->i;
  274. CARLA_SAFE_ASSERT_RETURN(i3 >= 0, 0);
  275. fEngine->patchbayConnect(static_cast<uint32_t>(i0),
  276. static_cast<uint32_t>(i1),
  277. static_cast<uint32_t>(i2),
  278. static_cast<uint32_t>(i3));
  279. }
  280. else if (std::strcmp(method, "patchbay_disconnect") == 0)
  281. {
  282. CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0);
  283. CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0);
  284. const int32_t i = argv[0]->i;
  285. CARLA_SAFE_ASSERT_RETURN(i >= 0, 0);
  286. fEngine->patchbayDisconnect(static_cast<uint32_t>(i));
  287. }
  288. else if (std::strcmp(method, "patchbay_refresh") == 0)
  289. {
  290. CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0);
  291. CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0);
  292. const int32_t i = argv[0]->i;
  293. fEngine->patchbayRefresh(i != 0);
  294. }
  295. else if (std::strcmp(method, "transport_play") == 0)
  296. {
  297. CARLA_SAFE_ASSERT_INT_RETURN(argc == 0, argc, 0);
  298. fEngine->transportPlay();
  299. }
  300. else if (std::strcmp(method, "transport_pause") == 0)
  301. {
  302. CARLA_SAFE_ASSERT_INT_RETURN(argc == 0, argc, 0);
  303. fEngine->transportPause();
  304. }
  305. else if (std::strcmp(method, "transport_bpm") == 0)
  306. {
  307. CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0);
  308. CARLA_SAFE_ASSERT_RETURN(types[0] == 'f', 0);
  309. const double f = argv[0]->f;
  310. CARLA_SAFE_ASSERT_RETURN(f >= 0.0, 0);
  311. fEngine->transportBPM(f);
  312. }
  313. else if (std::strcmp(method, "transport_relocate") == 0)
  314. {
  315. CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0);
  316. uint64_t frame;
  317. /**/ if (types[0] == 'i')
  318. {
  319. const int32_t i = argv[0]->i;
  320. CARLA_SAFE_ASSERT_RETURN(i >= 0, 0);
  321. frame = static_cast<uint64_t>(i);
  322. }
  323. else if (types[0] == 'h')
  324. {
  325. const int64_t h = argv[0]->h;
  326. CARLA_SAFE_ASSERT_RETURN(h >= 0, 0);
  327. frame = static_cast<uint64_t>(h);
  328. }
  329. else
  330. {
  331. carla_stderr2("Wrong OSC type used for '%s'", method);
  332. return 0;
  333. }
  334. fEngine->transportRelocate(frame);
  335. }
  336. // #"add_plugin",
  337. // "remove_plugin",
  338. // "remove_all_plugins",
  339. // "rename_plugin",
  340. // "clone_plugin",
  341. // "replace_plugin",
  342. // "switch_plugins",
  343. return 0;
  344. }
  345. // -----------------------------------------------------------------------
  346. int CarlaEngineOsc::handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS)
  347. {
  348. carla_debug("CarlaEngineOsc::handleMsgSetActive()");
  349. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i");
  350. const bool active = (argv[0]->i != 0);
  351. plugin->setActive(active, false, true);
  352. return 0;
  353. }
  354. int CarlaEngineOsc::handleMsgSetDryWet(CARLA_ENGINE_OSC_HANDLE_ARGS)
  355. {
  356. carla_debug("CarlaEngineOsc::handleMsgSetDryWet()");
  357. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");
  358. const float value = argv[0]->f;
  359. plugin->setDryWet(value, false, true);
  360. return 0;
  361. }
  362. int CarlaEngineOsc::handleMsgSetVolume(CARLA_ENGINE_OSC_HANDLE_ARGS)
  363. {
  364. carla_debug("CarlaEngineOsc::handleMsgSetVolume()");
  365. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");
  366. const float value = argv[0]->f;
  367. plugin->setVolume(value, false, true);
  368. return 0;
  369. }
  370. int CarlaEngineOsc::handleMsgSetBalanceLeft(CARLA_ENGINE_OSC_HANDLE_ARGS)
  371. {
  372. carla_debug("CarlaEngineOsc::handleMsgSetBalanceLeft()");
  373. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");
  374. const float value = argv[0]->f;
  375. plugin->setBalanceLeft(value, false, true);
  376. return 0;
  377. }
  378. int CarlaEngineOsc::handleMsgSetBalanceRight(CARLA_ENGINE_OSC_HANDLE_ARGS)
  379. {
  380. carla_debug("CarlaEngineOsc::handleMsgSetBalanceRight()");
  381. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");
  382. const float value = argv[0]->f;
  383. plugin->setBalanceRight(value, false, true);
  384. return 0;
  385. }
  386. int CarlaEngineOsc::handleMsgSetPanning(CARLA_ENGINE_OSC_HANDLE_ARGS)
  387. {
  388. carla_debug("CarlaEngineOsc::handleMsgSetPanning()");
  389. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "f");
  390. const float value = argv[0]->f;
  391. plugin->setPanning(value, false, true);
  392. return 0;
  393. }
  394. int CarlaEngineOsc::handleMsgSetParameterValue(CARLA_ENGINE_OSC_HANDLE_ARGS)
  395. {
  396. carla_debug("CarlaEngineOsc::handleMsgSetParameterValue()");
  397. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "if");
  398. const int32_t index = argv[0]->i;
  399. const float value = argv[1]->f;
  400. CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
  401. plugin->setParameterValue(static_cast<uint32_t>(index), value, true, false, true);
  402. return 0;
  403. }
  404. int CarlaEngineOsc::handleMsgSetParameterMidiCC(CARLA_ENGINE_OSC_HANDLE_ARGS)
  405. {
  406. carla_debug("CarlaEngineOsc::handleMsgSetParameterMidiCC()");
  407. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii");
  408. const int32_t index = argv[0]->i;
  409. const int32_t cc = argv[1]->i;
  410. CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
  411. CARLA_SAFE_ASSERT_RETURN(cc >= -1 && cc < MAX_MIDI_CONTROL, 0);
  412. plugin->setParameterMidiCC(static_cast<uint32_t>(index), static_cast<int16_t>(cc), false, true);
  413. return 0;
  414. }
  415. int CarlaEngineOsc::handleMsgSetParameterMidiChannel(CARLA_ENGINE_OSC_HANDLE_ARGS)
  416. {
  417. carla_debug("CarlaEngineOsc::handleMsgSetParameterMidiChannel()");
  418. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii");
  419. const int32_t index = argv[0]->i;
  420. const int32_t channel = argv[1]->i;
  421. CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
  422. CARLA_SAFE_ASSERT_RETURN(channel >= 0 && channel < MAX_MIDI_CHANNELS, 0);
  423. plugin->setParameterMidiChannel(static_cast<uint32_t>(index), static_cast<uint8_t>(channel), false, true);
  424. return 0;
  425. }
  426. int CarlaEngineOsc::handleMsgSetProgram(CARLA_ENGINE_OSC_HANDLE_ARGS)
  427. {
  428. carla_debug("CarlaEngineOsc::handleMsgSetProgram()");
  429. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i");
  430. const int32_t index = argv[0]->i;
  431. CARLA_SAFE_ASSERT_RETURN(index >= -1, 0);
  432. plugin->setProgram(index, true, false, true);
  433. return 0;
  434. }
  435. int CarlaEngineOsc::handleMsgSetMidiProgram(CARLA_ENGINE_OSC_HANDLE_ARGS)
  436. {
  437. carla_debug("CarlaEngineOsc::handleMsgSetMidiProgram()");
  438. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(1, "i");
  439. const int32_t index = argv[0]->i;
  440. CARLA_SAFE_ASSERT_RETURN(index >= -1, 0);
  441. plugin->setMidiProgram(index, true, false, true);
  442. return 0;
  443. }
  444. int CarlaEngineOsc::handleMsgNoteOn(CARLA_ENGINE_OSC_HANDLE_ARGS)
  445. {
  446. carla_debug("CarlaEngineOsc::handleMsgNoteOn()");
  447. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(3, "iii");
  448. const int32_t channel = argv[0]->i;
  449. const int32_t note = argv[1]->i;
  450. const int32_t velo = argv[2]->i;
  451. CARLA_SAFE_ASSERT_RETURN(channel >= 0 && channel < MAX_MIDI_CHANNELS, 0);
  452. CARLA_SAFE_ASSERT_RETURN(note >= 0 && note < MAX_MIDI_NOTE, 0);
  453. CARLA_SAFE_ASSERT_RETURN(velo >= 0 && velo < MAX_MIDI_VALUE, 0);
  454. plugin->sendMidiSingleNote(static_cast<uint8_t>(channel), static_cast<uint8_t>(note), static_cast<uint8_t>(velo), true, false, true);
  455. return 0;
  456. }
  457. int CarlaEngineOsc::handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS)
  458. {
  459. carla_debug("CarlaEngineOsc::handleMsgNoteOff()");
  460. CARLA_ENGINE_OSC_CHECK_OSC_TYPES(2, "ii");
  461. const int32_t channel = argv[0]->i;
  462. const int32_t note = argv[1]->i;
  463. CARLA_SAFE_ASSERT_RETURN(channel >= 0 && channel < MAX_MIDI_CHANNELS, 0);
  464. CARLA_SAFE_ASSERT_RETURN(note >= 0 && note < MAX_MIDI_NOTE, 0);
  465. plugin->sendMidiSingleNote(static_cast<uint8_t>(channel), static_cast<uint8_t>(note), 0, true, false, true);
  466. return 0;
  467. }
  468. // -----------------------------------------------------------------------
  469. CARLA_BACKEND_END_NAMESPACE
  470. #endif // HAVE_LIBLO