Collection of tools useful for audio production
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.

614 lines
20KB

  1. /*
  2. * Carla Backend
  3. * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #include "carla_osc.h"
  18. #include "carla_plugin.h"
  19. CARLA_BACKEND_START_NAMESPACE
  20. void osc_error_handler(const int num, const char* const msg, const char* const path)
  21. {
  22. qCritical("osc_error_handler(%i, %s, %s)", num, msg, path);
  23. }
  24. CarlaOsc::CarlaOsc(CarlaEngine* const engine_) :
  25. engine(engine_)
  26. {
  27. CARLA_ASSERT(engine);
  28. qDebug("CarlaOsc::CarlaOsc(%p)", engine_);
  29. m_serverPathTCP = nullptr;
  30. m_serverPathUDP = nullptr;
  31. m_serverThreadTCP = nullptr;
  32. m_serverThreadUDP = nullptr;
  33. m_controlData.path = nullptr;
  34. m_controlData.source = nullptr;
  35. m_controlData.target = nullptr;
  36. m_name = nullptr;
  37. m_name_len = 0;
  38. }
  39. CarlaOsc::~CarlaOsc()
  40. {
  41. qDebug("CarlaOsc::~CarlaOsc()");
  42. }
  43. void CarlaOsc::init(const char* const name)
  44. {
  45. CARLA_ASSERT(name);
  46. CARLA_ASSERT(m_name_len == 0);
  47. qDebug("CarlaOsc::init(\"%s\")", name);
  48. m_name = strdup(name);
  49. m_name_len = strlen(name);
  50. // create new OSC thread
  51. m_serverThreadTCP = lo_server_thread_new_with_proto(nullptr, LO_TCP, osc_error_handler);
  52. m_serverThreadUDP = lo_server_thread_new_with_proto(nullptr, LO_UDP, osc_error_handler);
  53. // get our full OSC server path
  54. char* const threadPathTCP = lo_server_thread_get_url(m_serverThreadTCP);
  55. m_serverPathTCP = strdup(QString("%1%2").arg(threadPathTCP).arg(name).toUtf8().constData());
  56. free(threadPathTCP);
  57. char* const threadPathUDP = lo_server_thread_get_url(m_serverThreadUDP);
  58. m_serverPathUDP = strdup(QString("%1%2").arg(threadPathUDP).arg(name).toUtf8().constData());
  59. free(threadPathUDP);
  60. // register message handler and start OSC thread
  61. lo_server_thread_add_method(m_serverThreadTCP, nullptr, nullptr, osc_message_handler, this);
  62. lo_server_thread_add_method(m_serverThreadUDP, nullptr, nullptr, osc_message_handler, this);
  63. lo_server_thread_start(m_serverThreadTCP);
  64. lo_server_thread_start(m_serverThreadUDP);
  65. }
  66. void CarlaOsc::close()
  67. {
  68. CARLA_ASSERT(m_name);
  69. qDebug("CarlaOsc::close()");
  70. osc_clear_data(&m_controlData);
  71. lo_server_thread_stop(m_serverThreadTCP);
  72. lo_server_thread_stop(m_serverThreadUDP);
  73. lo_server_thread_del_method(m_serverThreadTCP, nullptr, nullptr);
  74. lo_server_thread_del_method(m_serverThreadUDP, nullptr, nullptr);
  75. lo_server_thread_free(m_serverThreadTCP);
  76. lo_server_thread_free(m_serverThreadUDP);
  77. free((void*)m_serverPathTCP);
  78. free((void*)m_serverPathUDP);
  79. m_serverPathTCP = nullptr;
  80. m_serverPathUDP = nullptr;
  81. free((void*)m_name);
  82. m_name = nullptr;
  83. m_name_len = 0;
  84. }
  85. // -------------------------------------------------------------------------------------------------------------------
  86. int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg)
  87. {
  88. #if DEBUG
  89. if (! QString(path).contains("put_peak_value"))
  90. qDebug("CarlaOsc::handleMessage(%s, %i, %p, %s, %p)", path, argc, argv, types, msg);
  91. #endif
  92. CARLA_ASSERT(m_serverThreadTCP || m_serverPathUDP);
  93. CARLA_ASSERT(path);
  94. // Initial path check
  95. if (strcmp(path, "/register") == 0)
  96. {
  97. const lo_address source = lo_message_get_source(msg);
  98. return handleMsgRegister(argc, argv, types, source);
  99. }
  100. if (strcmp(path, "/unregister") == 0)
  101. {
  102. return handleMsgUnregister();
  103. }
  104. // Check if message is for this client
  105. if (strlen(path) <= m_name_len || strncmp(path+1, m_name, m_name_len) != 0)
  106. {
  107. qWarning("CarlaOsc::handleMessage() - message not for this client -> '%s' != '/%s/'", path, m_name);
  108. return 1;
  109. }
  110. // Get plugin id from message
  111. int pluginId = 0;
  112. if (std::isdigit(path[m_name_len+2]))
  113. pluginId += path[m_name_len+2]-'0';
  114. if (std::isdigit(path[m_name_len+3]))
  115. pluginId += (path[m_name_len+3]-'0')*10;
  116. if (pluginId < 0 || pluginId > CarlaEngine::maxPluginNumber())
  117. {
  118. qCritical("CarlaOsc::handleMessage() - failed to get plugin, wrong id -> %i", pluginId);
  119. return 1;
  120. }
  121. // Get plugin
  122. CarlaPlugin* const plugin = engine->getPluginUnchecked(pluginId);
  123. if (plugin == nullptr || plugin->id() != pluginId)
  124. {
  125. qWarning("CarlaOsc::handleMessage() - invalid plugin '%i', probably has been removed", pluginId);
  126. return 1;
  127. }
  128. // Get method from path, "/Carla/i/method"
  129. int offset = (pluginId >= 10) ? 4 : 3;
  130. char method[32] = { 0 };
  131. memcpy(method, path + (m_name_len + offset), 32);
  132. // Common OSC methods
  133. if (strcmp(method, "/update") == 0)
  134. {
  135. const lo_address source = lo_message_get_source(msg);
  136. return handleMsgUpdate(plugin, argc, argv, types, source);
  137. }
  138. if (strcmp(method, "/configure") == 0)
  139. return handleMsgConfigure(plugin, argc, argv, types);
  140. if (strcmp(method, "/control") == 0)
  141. return handleMsgControl(plugin, argc, argv, types);
  142. if (strcmp(method, "/program") == 0)
  143. return handleMsgProgram(plugin, argc, argv, types);
  144. if (strcmp(method, "/midi") == 0)
  145. return handleMsgMidi(plugin, argc, argv, types);
  146. if (strcmp(method, "/exiting") == 0)
  147. return handleMsgExiting(plugin);
  148. // Internal methods
  149. if (strcmp(method, "/set_active") == 0)
  150. return handleMsgSetActive(plugin, argc, argv, types);
  151. if (strcmp(method, "/set_drywet") == 0)
  152. return handleMsgSetDryWet(plugin, argc, argv, types);
  153. if (strcmp(method, "/set_volume") == 0)
  154. return handleMsgSetVolume(plugin, argc, argv, types);
  155. if (strcmp(method, "/set_balance_left") == 0)
  156. return handleMsgSetBalanceLeft(plugin, argc, argv, types);
  157. if (strcmp(method, "/set_balance_right") == 0)
  158. return handleMsgSetBalanceRight(plugin, argc, argv, types);
  159. if (strcmp(method, "/set_parameter_value") == 0)
  160. return handleMsgSetParameterValue(plugin, argc, argv, types);
  161. if (strcmp(method, "/set_parameter_midi_cc") == 0)
  162. return handleMsgSetParameterMidiCC(plugin, argc, argv, types);
  163. if (strcmp(method, "/set_parameter_midi_channel") == 0)
  164. return handleMsgSetParameterMidiChannel(plugin, argc, argv, types);
  165. if (strcmp(method, "/set_program") == 0)
  166. return handleMsgSetProgram(plugin, argc, argv, types);
  167. if (strcmp(method, "/set_midi_program") == 0)
  168. return handleMsgSetMidiProgram(plugin, argc, argv, types);
  169. if (strcmp(method, "/note_on") == 0)
  170. return handleMsgNoteOn(plugin, argc, argv, types);
  171. if (strcmp(method, "/note_off") == 0)
  172. return handleMsgNoteOff(plugin, argc, argv, types);
  173. // Plugin-specific methods
  174. #ifdef WANT_LV2
  175. if (strcmp(method, "/lv2_atom_transfer") == 0)
  176. return handleMsgLv2AtomTransfer(plugin, argc, argv, types);
  177. if (strcmp(method, "/lv2_event_transfer") == 0)
  178. return handleMsgLv2EventTransfer(plugin, argc, argv, types);
  179. #endif
  180. // Plugin Bridges
  181. if (plugin->hints() & PLUGIN_IS_BRIDGE)
  182. {
  183. if (strcmp(method, "/bridge_set_input_peak_value") == 0)
  184. return handleMsgBridgeSetInputPeakValue(plugin, argc, argv, types);
  185. if (strcmp(method, "/bridge_set_output_peak_value") == 0)
  186. return handleMsgBridgeSetOutputPeakValue(plugin, argc, argv, types);
  187. if (strcmp(method, "/bridge_audio_count") == 0)
  188. return plugin->setOscBridgeInfo(PluginBridgeAudioCount, argc, argv, types);
  189. if (strcmp(method, "/bridge_midi_count") == 0)
  190. return plugin->setOscBridgeInfo(PluginBridgeMidiCount, argc, argv, types);
  191. if (strcmp(method, "/bridge_parameter_count") == 0)
  192. return plugin->setOscBridgeInfo(PluginBridgeParameterCount, argc, argv, types);
  193. if (strcmp(method, "/bridge_program_count") == 0)
  194. return plugin->setOscBridgeInfo(PluginBridgeProgramCount, argc, argv, types);
  195. if (strcmp(method, "/bridge_midi_program_count") == 0)
  196. return plugin->setOscBridgeInfo(PluginBridgeMidiProgramCount, argc, argv, types);
  197. if (strcmp(method, "/bridge_plugin_info") == 0)
  198. return plugin->setOscBridgeInfo(PluginBridgePluginInfo, argc, argv, types);
  199. if (strcmp(method, "/bridge_parameter_info") == 0)
  200. return plugin->setOscBridgeInfo(PluginBridgeParameterInfo, argc, argv, types);
  201. if (strcmp(method, "/bridge_parameter_data") == 0)
  202. return plugin->setOscBridgeInfo(PluginBridgeParameterData, argc, argv, types);
  203. if (strcmp(method, "/bridge_parameter_ranges") == 0)
  204. return plugin->setOscBridgeInfo(PluginBridgeParameterRanges, argc, argv, types);
  205. if (strcmp(method, "/bridge_program_info") == 0)
  206. return plugin->setOscBridgeInfo(PluginBridgeProgramInfo, argc, argv, types);
  207. if (strcmp(method, "/bridge_midi_program_info") == 0)
  208. return plugin->setOscBridgeInfo(PluginBridgeMidiProgramInfo, argc, argv, types);
  209. if (strcmp(method, "/bridge_configure") == 0)
  210. return plugin->setOscBridgeInfo(PluginBridgeConfigure, argc, argv, types);
  211. if (strcmp(method, "/bridge_set_parameter_value") == 0)
  212. return plugin->setOscBridgeInfo(PluginBridgeSetParameterValue, argc, argv, types);
  213. if (strcmp(method, "/bridge_set_default_value") == 0)
  214. return plugin->setOscBridgeInfo(PluginBridgeSetDefaultValue, argc, argv, types);
  215. if (strcmp(method, "/bridge_set_program") == 0)
  216. return plugin->setOscBridgeInfo(PluginBridgeSetProgram, argc, argv, types);
  217. if (strcmp(method, "/bridge_set_midi_program") == 0)
  218. return plugin->setOscBridgeInfo(PluginBridgeSetMidiProgram, argc, argv, types);
  219. if (strcmp(method, "/bridge_set_custom_data") == 0)
  220. return plugin->setOscBridgeInfo(PluginBridgeSetCustomData, argc, argv, types);
  221. if (strcmp(method, "/bridge_set_chunk_data") == 0)
  222. return plugin->setOscBridgeInfo(PluginBridgeSetChunkData, argc, argv, types);
  223. if (strcmp(method, "/bridge_update") == 0)
  224. return plugin->setOscBridgeInfo(PluginBridgeUpdateNow, argc, argv, types);
  225. if (strcmp(method, "/bridge_error") == 0)
  226. return plugin->setOscBridgeInfo(PluginBridgeError, argc, argv, types);
  227. }
  228. qWarning("CarlaOsc::handleMessage() - unsupported OSC method '%s'", method);
  229. return 1;
  230. }
  231. // -------------------------------------------------------------------------------------------------------------------
  232. int CarlaOsc::handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source)
  233. {
  234. qDebug("CarlaOsc::handleMsgRegister()");
  235. CARLA_OSC_CHECK_OSC_TYPES(1, "s");
  236. if (m_controlData.path)
  237. {
  238. qWarning("CarlaOsc::handleMsgRegister() - OSC backend already registered to %s", m_controlData.path);
  239. return 1;
  240. }
  241. const char* const url = (const char*)&argv[0]->s;
  242. const char* host;
  243. const char* port;
  244. qDebug("CarlaOsc::handleMsgRegister() - OSC backend registered to %s", url);
  245. host = lo_address_get_hostname(source);
  246. port = lo_address_get_port(source);
  247. m_controlData.source = lo_address_new_with_proto(LO_TCP, host, port);
  248. host = lo_url_get_hostname(url);
  249. port = lo_url_get_port(url);
  250. m_controlData.path = lo_url_get_path(url);
  251. m_controlData.target = lo_address_new_with_proto(LO_TCP, host, port);
  252. free((void*)host);
  253. free((void*)port);
  254. // FIXME - max plugins
  255. for (unsigned short i=0; i < CarlaEngine::maxPluginNumber(); i++)
  256. {
  257. CarlaPlugin* const plugin = engine->getPluginUnchecked(i);
  258. if (plugin && plugin->enabled())
  259. plugin->registerToOscControl();
  260. }
  261. return 0;
  262. }
  263. int CarlaOsc::handleMsgUnregister()
  264. {
  265. qDebug("CarlaOsc::handleMsgUnregister()");
  266. if (! m_controlData.path)
  267. {
  268. qWarning("CarlaOsc::handleMsgUnregister() - OSC backend is not registered yet");
  269. return 1;
  270. }
  271. osc_clear_data(&m_controlData);
  272. return 0;
  273. }
  274. // -------------------------------------------------------------------------------------------------------------------
  275. int CarlaOsc::handleMsgUpdate(CARLA_OSC_HANDLE_ARGS2, const lo_address source)
  276. {
  277. qDebug("CarlaOsc::handleMsgUpdate()");
  278. CARLA_OSC_CHECK_OSC_TYPES(1, "s");
  279. const char* const url = (const char*)&argv[0]->s;
  280. plugin->updateOscData(source, url);
  281. return 0;
  282. }
  283. int CarlaOsc::handleMsgConfigure(CARLA_OSC_HANDLE_ARGS2)
  284. {
  285. qDebug("CarlaOsc::handleMsgConfigure()");
  286. CARLA_OSC_CHECK_OSC_TYPES(2, "ss");
  287. const char* const key = (const char*)&argv[0]->s;
  288. const char* const value = (const char*)&argv[1]->s;
  289. plugin->setCustomData(CUSTOM_DATA_STRING, key, value, false);
  290. return 0;
  291. }
  292. int CarlaOsc::handleMsgControl(CARLA_OSC_HANDLE_ARGS2)
  293. {
  294. qDebug("CarlaOsc::handleMsgControl()");
  295. CARLA_OSC_CHECK_OSC_TYPES(2, "if");
  296. const int rindex = argv[0]->i;
  297. const float value = argv[1]->f;
  298. plugin->setParameterValueByRIndex(rindex, value, false, true, true);
  299. return 0;
  300. }
  301. int CarlaOsc::handleMsgProgram(CARLA_OSC_HANDLE_ARGS2)
  302. {
  303. qDebug("CarlaOsc::handleMsgProgram()");
  304. if (argc == 2)
  305. {
  306. CARLA_OSC_CHECK_OSC_TYPES(2, "ii");
  307. const uint32_t bank_id = argv[0]->i;
  308. const uint32_t program_id = argv[1]->i;
  309. plugin->setMidiProgramById(bank_id, program_id, false, true, true, true);
  310. return 0;
  311. }
  312. else
  313. {
  314. CARLA_OSC_CHECK_OSC_TYPES(1, "i");
  315. const uint32_t program_id = argv[0]->i;
  316. if (program_id < plugin->programCount())
  317. {
  318. plugin->setProgram(program_id, false, true, true, true);
  319. return 0;
  320. }
  321. qCritical("CarlaOsc::handleMsgProgram() - program_id '%i' out of bounds", program_id);
  322. }
  323. return 1;
  324. }
  325. int CarlaOsc::handleMsgMidi(CARLA_OSC_HANDLE_ARGS2)
  326. {
  327. qDebug("CarlaOsc::handleMsgMidi()");
  328. CARLA_OSC_CHECK_OSC_TYPES(1, "m");
  329. if (plugin->midiInCount() > 0)
  330. {
  331. const uint8_t* const data = argv[0]->m;
  332. uint8_t status = data[1];
  333. uint8_t channel = status & 0x0F;
  334. // Fix bad note-off
  335. if (MIDI_IS_STATUS_NOTE_ON(status) && data[3] == 0)
  336. status -= 0x10;
  337. if (MIDI_IS_STATUS_NOTE_OFF(status))
  338. {
  339. uint8_t note = data[2];
  340. plugin->sendMidiSingleNote(channel, note, 0, false, true, true);
  341. }
  342. else if (MIDI_IS_STATUS_NOTE_ON(status))
  343. {
  344. uint8_t note = data[2];
  345. uint8_t velo = data[3];
  346. plugin->sendMidiSingleNote(channel, note, velo, false, true, true);
  347. }
  348. return 0;
  349. }
  350. qWarning("CarlaOsc::handleMsgMidi() - recived midi when plugin has no midi inputs");
  351. return 1;
  352. }
  353. int CarlaOsc::handleMsgExiting(CARLA_OSC_HANDLE_ARGS1)
  354. {
  355. qDebug("CarlaOsc::handleMsgExiting()");
  356. // TODO - check for non-UIs (dssi-vst) and set to -1 instead
  357. engine->callback(CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0);
  358. plugin->clearOscData();
  359. return 0;
  360. }
  361. // -------------------------------------------------------------------------------------------------------------------
  362. int CarlaOsc::handleMsgSetActive(CARLA_OSC_HANDLE_ARGS2)
  363. {
  364. qDebug("CarlaOsc::handleMsgSetActive()");
  365. CARLA_OSC_CHECK_OSC_TYPES(1, "i");
  366. const bool active = (bool)argv[0]->i;
  367. plugin->setActive(active, false, true);
  368. return 0;
  369. }
  370. int CarlaOsc::handleMsgSetDryWet(CARLA_OSC_HANDLE_ARGS2)
  371. {
  372. qDebug("CarlaOsc::handleMsgSetDryWet()");
  373. CARLA_OSC_CHECK_OSC_TYPES(1, "f");
  374. const float value = argv[0]->f;
  375. plugin->setDryWet(value, false, true);
  376. return 0;
  377. }
  378. int CarlaOsc::handleMsgSetVolume(CARLA_OSC_HANDLE_ARGS2)
  379. {
  380. qDebug("CarlaOsc::handleMsgSetVolume()");
  381. CARLA_OSC_CHECK_OSC_TYPES(1, "f");
  382. const float value = argv[0]->f;
  383. plugin->setVolume(value, false, true);
  384. return 0;
  385. }
  386. int CarlaOsc::handleMsgSetBalanceLeft(CARLA_OSC_HANDLE_ARGS2)
  387. {
  388. qDebug("CarlaOsc::handleMsgSetBalanceLeft()");
  389. CARLA_OSC_CHECK_OSC_TYPES(1, "f");
  390. const float value = argv[0]->f;
  391. plugin->setBalanceLeft(value, false, true);
  392. return 0;
  393. }
  394. int CarlaOsc::handleMsgSetBalanceRight(CARLA_OSC_HANDLE_ARGS2)
  395. {
  396. qDebug("CarlaOsc::handleMsgSetBalanceRight()");
  397. CARLA_OSC_CHECK_OSC_TYPES(1, "f");
  398. const float value = argv[0]->f;
  399. plugin->setBalanceRight(value, false, true);
  400. return 0;
  401. }
  402. int CarlaOsc::handleMsgSetParameterValue(CARLA_OSC_HANDLE_ARGS2)
  403. {
  404. qDebug("CarlaOsc::handleMsgSetParameterValue()");
  405. CARLA_OSC_CHECK_OSC_TYPES(2, "if");
  406. const int32_t index = argv[0]->i;
  407. const float value = argv[1]->f;
  408. plugin->setParameterValue(index, value, true, false, true);
  409. return 0;
  410. }
  411. int CarlaOsc::handleMsgSetParameterMidiCC(CARLA_OSC_HANDLE_ARGS2)
  412. {
  413. qDebug("CarlaOsc::handleMsgSetParameterMidiCC()");
  414. CARLA_OSC_CHECK_OSC_TYPES(2, "ii");
  415. const int32_t index = argv[0]->i;
  416. const int32_t cc = argv[1]->i;
  417. plugin->setParameterMidiCC(index, cc, false, true);
  418. return 0;
  419. }
  420. int CarlaOsc::handleMsgSetParameterMidiChannel(CARLA_OSC_HANDLE_ARGS2)
  421. {
  422. qDebug("CarlaOsc::handleMsgSetParameterMidiChannel()");
  423. CARLA_OSC_CHECK_OSC_TYPES(2, "ii");
  424. const int32_t index = argv[0]->i;
  425. const int32_t channel = argv[1]->i;
  426. plugin->setParameterMidiChannel(index, channel, false, true);
  427. return 0;
  428. }
  429. int CarlaOsc::handleMsgSetProgram(CARLA_OSC_HANDLE_ARGS2)
  430. {
  431. qDebug("CarlaOsc::handleMsgSetProgram()");
  432. CARLA_OSC_CHECK_OSC_TYPES(1, "i");
  433. const int32_t index = argv[0]->i;
  434. plugin->setProgram(index, true, false, true, true);
  435. if (index >= 0)
  436. {
  437. for (uint32_t i=0; i < plugin->parameterCount(); i++)
  438. engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
  439. }
  440. return 0;
  441. }
  442. int CarlaOsc::handleMsgSetMidiProgram(CARLA_OSC_HANDLE_ARGS2)
  443. {
  444. qDebug("CarlaOsc::handleMsgSetMidiProgram()");
  445. CARLA_OSC_CHECK_OSC_TYPES(1, "i");
  446. const int32_t index = argv[0]->i;
  447. plugin->setMidiProgram(index, true, false, true, true);
  448. if (index >= 0)
  449. {
  450. for (uint32_t i=0; i < plugin->parameterCount(); i++)
  451. engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
  452. }
  453. return 0;
  454. }
  455. int CarlaOsc::handleMsgNoteOn(CARLA_OSC_HANDLE_ARGS2)
  456. {
  457. qDebug("CarlaOsc::handleMsgNoteOn()");
  458. CARLA_OSC_CHECK_OSC_TYPES(3, "iii");
  459. const int32_t channel = argv[0]->i;
  460. const int32_t note = argv[1]->i;
  461. const int32_t velo = argv[2]->i;
  462. plugin->sendMidiSingleNote(channel, note, velo, true, false, true);
  463. return 0;
  464. }
  465. int CarlaOsc::handleMsgNoteOff(CARLA_OSC_HANDLE_ARGS2)
  466. {
  467. qDebug("CarlaOsc::handleMsgNoteOff()");
  468. CARLA_OSC_CHECK_OSC_TYPES(2, "ii");
  469. const int32_t channel = argv[0]->i;
  470. const int32_t note = argv[1]->i;
  471. plugin->sendMidiSingleNote(channel, note, 0, true, false, true);
  472. return 0;
  473. }
  474. int CarlaOsc::handleMsgBridgeSetInputPeakValue(CARLA_OSC_HANDLE_ARGS2)
  475. {
  476. CARLA_OSC_CHECK_OSC_TYPES(2, "id");
  477. const int32_t index = argv[0]->i;
  478. const double value = argv[1]->d;
  479. engine->setInputPeak(plugin->id(), index-1, value);
  480. return 0;
  481. }
  482. int CarlaOsc::handleMsgBridgeSetOutputPeakValue(CARLA_OSC_HANDLE_ARGS2)
  483. {
  484. CARLA_OSC_CHECK_OSC_TYPES(2, "id");
  485. const int32_t index = argv[0]->i;
  486. const double value = argv[1]->d;
  487. engine->setOutputPeak(plugin->id(), index-1, value);
  488. return 0;
  489. }
  490. CARLA_BACKEND_END_NAMESPACE