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.

837 lines
21KB

  1. /*
  2. * Carla Plugin bridge code
  3. * Copyright (C) 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. #ifdef BUILD_BRIDGE_PLUGIN
  18. #include "carla_bridge_client.h"
  19. #include "carla_plugin.h"
  20. #include <QtCore/QDir>
  21. #include <QtCore/QFile>
  22. #include <QtCore/QTextStream>
  23. #include <QtCore/QTimerEvent>
  24. #include <QtGui/QApplication>
  25. #include <QtGui/QDialog>
  26. #include <QtGui/QVBoxLayout>
  27. #include <QtGui/QtEvents>
  28. #ifdef Q_OS_UNIX
  29. #include <signal.h>
  30. #endif
  31. static int qargc = 0;
  32. static char** qargv = nullptr;
  33. static bool qCloseNow = false;
  34. #if defined(Q_OS_UNIX)
  35. void closeSignalHandler(int)
  36. {
  37. qCloseNow = true;
  38. }
  39. #elif defined(Q_OS_WIN)
  40. BOOL WINAPI closeSignalHandler(DWORD dwCtrlType)
  41. {
  42. if (dwCtrlType == CTRL_C_EVENT)
  43. {
  44. qCloseNow = true;
  45. return TRUE;
  46. }
  47. return FALSE;
  48. }
  49. #endif
  50. void initSignalHandler()
  51. {
  52. #if defined(Q_OS_UNIX)
  53. struct sigaction sint;
  54. struct sigaction sterm;
  55. sint.sa_handler = closeSignalHandler;
  56. sint.sa_flags = SA_RESTART;
  57. sint.sa_restorer = nullptr;
  58. sigemptyset(&sint.sa_mask);
  59. sigaction(SIGINT, &sint, nullptr);
  60. sterm.sa_handler = closeSignalHandler;
  61. sterm.sa_flags = SA_RESTART;
  62. sterm.sa_restorer = nullptr;
  63. sigemptyset(&sterm.sa_mask);
  64. sigaction(SIGTERM, &sterm, nullptr);
  65. #elif defined(Q_OS_WIN)
  66. SetConsoleCtrlHandler(closeSignalHandler, TRUE);
  67. #endif
  68. }
  69. #ifdef PTW32_STATIC_LIB
  70. #include <pthread.h>
  71. class PThreadScopedInitializer
  72. {
  73. public:
  74. PThreadScopedInitializer()
  75. {
  76. pthread_win32_process_attach_np();
  77. pthread_win32_thread_attach_np();
  78. };
  79. ~PThreadScopedInitializer()
  80. {
  81. pthread_win32_thread_detach_np();
  82. pthread_win32_process_detach_np();
  83. };
  84. };
  85. #endif
  86. CARLA_BRIDGE_START_NAMESPACE
  87. // -------------------------------------------------------------------------
  88. class BridgePluginGUI : public QDialog
  89. {
  90. public:
  91. class Callback
  92. {
  93. public:
  94. virtual ~Callback() {}
  95. virtual void guiClosedCallback() = 0;
  96. };
  97. BridgePluginGUI(QWidget* const parent, Callback* const callback_)
  98. : QDialog(parent),
  99. callback(callback_)
  100. {
  101. qDebug("BridgePluginGUI::BridgePluginGUI(%p, %p", parent, callback);
  102. CARLA_ASSERT(callback);
  103. m_firstShow = true;
  104. m_resizable = true;
  105. vbLayout = new QVBoxLayout(this);
  106. vbLayout->setContentsMargins(0, 0, 0, 0);
  107. setLayout(vbLayout);
  108. container = new GuiContainer(this);
  109. vbLayout->addWidget(container);
  110. setNewSize(50, 50);
  111. #ifdef Q_OS_WIN
  112. if (! resizable)
  113. setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint);
  114. #endif
  115. }
  116. ~BridgePluginGUI()
  117. {
  118. qDebug("BridgePluginGUI::~BridgePluginGUI()");
  119. CARLA_ASSERT(container);
  120. CARLA_ASSERT(vbLayout);
  121. delete container;
  122. delete vbLayout;
  123. }
  124. GuiContainer* getContainer()
  125. {
  126. return container;
  127. }
  128. void setResizable(bool resizable)
  129. {
  130. m_resizable = resizable;
  131. setNewSize(width(), height());
  132. }
  133. void setTitle(const char* title)
  134. {
  135. CARLA_ASSERT(title);
  136. setWindowTitle(QString("%1 (GUI)").arg(title));
  137. }
  138. void setNewSize(int width, int height)
  139. {
  140. qDebug("BridgePluginGUI::setNewSize(%i, %i)", width, height);
  141. if (width < 30)
  142. width = 30;
  143. if (height < 30)
  144. height = 30;
  145. if (m_resizable)
  146. {
  147. resize(width, height);
  148. }
  149. else
  150. {
  151. setFixedSize(width, height);
  152. container->setFixedSize(width, height);
  153. }
  154. }
  155. void setVisible(const bool yesNo)
  156. {
  157. qDebug("BridgePluginGUI::setVisible(%s)", bool2str(yesNo));
  158. if (yesNo)
  159. {
  160. if (m_firstShow)
  161. {
  162. m_firstShow = false;
  163. restoreGeometry(QByteArray());
  164. }
  165. else if (! m_geometry.isNull())
  166. restoreGeometry(m_geometry);
  167. }
  168. else
  169. m_geometry = saveGeometry();
  170. QDialog::setVisible(yesNo);
  171. }
  172. protected:
  173. void hideEvent(QHideEvent* const event)
  174. {
  175. qDebug("BridgePluginGUI::hideEvent(%p)", event);
  176. event->accept();
  177. close();
  178. }
  179. void closeEvent(QCloseEvent* const event)
  180. {
  181. qDebug("BridgePluginGUI::closeEvent(%p)", event);
  182. if (event->spontaneous())
  183. callback->guiClosedCallback();
  184. QDialog::closeEvent(event);
  185. }
  186. void done(int r)
  187. {
  188. QDialog::done(r);
  189. close();
  190. }
  191. private:
  192. Callback* const callback;
  193. QVBoxLayout* vbLayout;
  194. GuiContainer* container;
  195. bool m_firstShow;
  196. bool m_resizable;
  197. QByteArray m_geometry;
  198. };
  199. // -------------------------------------------------------------------------
  200. class BridgePluginClient : public CarlaToolkit,
  201. public CarlaClient,
  202. public BridgePluginGUI::Callback,
  203. public QApplication
  204. {
  205. public:
  206. BridgePluginClient()
  207. : CarlaToolkit("carla-bridge-plugin"),
  208. CarlaClient(this),
  209. QApplication(qargc, qargv)
  210. {
  211. qDebug("BridgePluginClient::BridgePluginClient()");
  212. msgTimer = 0;
  213. nextWidth = 0;
  214. nextHeight = 0;
  215. engine = nullptr;
  216. plugin = nullptr;
  217. pluginGui = new BridgePluginGUI(nullptr, this);
  218. m_client = this;
  219. }
  220. ~BridgePluginClient()
  221. {
  222. qDebug("BridgePluginClient::~BridgePluginClient()");
  223. CARLA_ASSERT(msgTimer == 0);
  224. CARLA_ASSERT(! pluginGui);
  225. }
  226. void setStuff(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin)
  227. {
  228. qDebug("BridgePluginClient::setStuff(%p, %p)", engine, plugin);
  229. CARLA_ASSERT(engine);
  230. CARLA_ASSERT(plugin);
  231. this->engine = engine;
  232. this->plugin = plugin;
  233. }
  234. // ---------------------------------------------------------------------
  235. // toolkit
  236. void init()
  237. {
  238. qDebug("BridgePluginClient::init()");
  239. }
  240. void exec(CarlaClient* const, const bool showGui)
  241. {
  242. qDebug("BridgePluginClient::exec()");
  243. if (showGui)
  244. {
  245. show();
  246. }
  247. else
  248. {
  249. CarlaClient::sendOscUpdate();
  250. CarlaClient::sendOscBridgeUpdate();
  251. QApplication::setQuitOnLastWindowClosed(false);
  252. }
  253. msgTimer = startTimer(50);
  254. QApplication::exec();
  255. }
  256. void quit()
  257. {
  258. qDebug("BridgePluginClient::quit()");
  259. if (msgTimer != 0)
  260. {
  261. QApplication::killTimer(msgTimer);
  262. msgTimer = 0;
  263. }
  264. if (pluginGui)
  265. {
  266. if (pluginGui->isVisible())
  267. hide();
  268. pluginGui->close();
  269. delete pluginGui;
  270. pluginGui = nullptr;
  271. }
  272. if (! QApplication::closingDown())
  273. QApplication::quit();
  274. }
  275. void show()
  276. {
  277. qDebug("BridgePluginClient::show()");
  278. CARLA_ASSERT(pluginGui);
  279. if (plugin)
  280. plugin->showGui(true);
  281. if (pluginGui)
  282. pluginGui->show();
  283. }
  284. void hide()
  285. {
  286. qDebug("BridgePluginClient::hide()");
  287. CARLA_ASSERT(pluginGui);
  288. if (pluginGui)
  289. pluginGui->hide();
  290. if (plugin)
  291. plugin->showGui(false);
  292. }
  293. void resize(int width, int height)
  294. {
  295. qDebug("BridgePluginClient::resize(%i, %i)", width, height);
  296. CARLA_ASSERT(pluginGui);
  297. if (pluginGui)
  298. pluginGui->setNewSize(width, height);
  299. }
  300. // ---------------------------------------------------------------------
  301. void createWindow(const bool resizable)
  302. {
  303. qDebug("BridgePluginClient::createWindow(%s)", bool2str(resizable));
  304. CARLA_ASSERT(plugin);
  305. CARLA_ASSERT(pluginGui);
  306. if (! (plugin && pluginGui))
  307. return;
  308. pluginGui->setResizable(resizable);
  309. pluginGui->setTitle(plugin->name());
  310. plugin->setGuiContainer(pluginGui->getContainer());
  311. }
  312. // ---------------------------------------------------------------------
  313. // processing
  314. void setParameter(const int32_t rindex, const double value)
  315. {
  316. qDebug("CarlaPluginClient::setParameter(%i, %g)", rindex, value);
  317. CARLA_ASSERT(plugin);
  318. if (! plugin)
  319. return;
  320. plugin->setParameterValueByRIndex(rindex, value, true, true, false);
  321. }
  322. void setProgram(const uint32_t index)
  323. {
  324. qDebug("CarlaPluginClient::setProgram(%i)", index);
  325. CARLA_ASSERT(engine);
  326. CARLA_ASSERT(plugin);
  327. CARLA_ASSERT(index < plugin->programCount());
  328. if (! (plugin && engine))
  329. return;
  330. if (index >= plugin->programCount())
  331. return;
  332. plugin->setProgram(index, true, true, false, true);
  333. double value;
  334. for (uint32_t i=0; i < plugin->parameterCount(); i++)
  335. {
  336. value = plugin->getParameterValue(i);
  337. engine->osc_send_bridge_set_parameter_value(i, value);
  338. engine->osc_send_bridge_set_default_value(i, value);
  339. }
  340. }
  341. void setMidiProgram(const uint32_t index)
  342. {
  343. qDebug("CarlaPluginClient::setMidiProgram(%i)", index);
  344. CARLA_ASSERT(engine);
  345. CARLA_ASSERT(plugin);
  346. if (! (plugin && engine))
  347. return;
  348. plugin->setMidiProgram(index, true, true, false, true);
  349. double value;
  350. for (uint32_t i=0; i < plugin->parameterCount(); i++)
  351. {
  352. value = plugin->getParameterValue(i);
  353. engine->osc_send_bridge_set_parameter_value(i, value);
  354. engine->osc_send_bridge_set_default_value(i, value);
  355. }
  356. }
  357. void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo)
  358. {
  359. qDebug("CarlaPluginClient::noteOn(%i, %i, %i)", channel, note, velo);
  360. CARLA_ASSERT(plugin);
  361. CARLA_ASSERT(velo > 0);
  362. if (! plugin)
  363. return;
  364. plugin->sendMidiSingleNote(channel, note, velo, true, true, false);
  365. }
  366. void noteOff(const uint8_t channel, const uint8_t note)
  367. {
  368. qDebug("CarlaPluginClient::noteOff(%i, %i)", channel, note);
  369. CARLA_ASSERT(plugin);
  370. if (! plugin)
  371. return;
  372. plugin->sendMidiSingleNote(channel, note, 0, true, true, false);
  373. }
  374. // ---------------------------------------------------------------------
  375. // plugin
  376. void saveNow()
  377. {
  378. qDebug("CarlaPluginClient::saveNow()");
  379. CARLA_ASSERT(plugin);
  380. CARLA_ASSERT(engine);
  381. if (! (plugin && engine))
  382. return;
  383. plugin->prepareForSave();
  384. for (uint32_t i=0; i < plugin->customDataCount(); i++)
  385. {
  386. const CarlaBackend::CustomData* const cdata = plugin->customData(i);
  387. engine->osc_send_bridge_set_custom_data(CarlaBackend::getCustomDataTypeString(cdata->type), cdata->key, cdata->value);
  388. }
  389. if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS)
  390. {
  391. void* data = nullptr;
  392. int32_t dataSize = plugin->chunkData(&data);
  393. if (data && dataSize >= 4)
  394. {
  395. QString filePath;
  396. filePath = QDir::tempPath();
  397. #ifdef Q_OS_WIN
  398. filePath += "\\.CarlaChunk_";
  399. #else
  400. filePath += "/.CarlaChunk_";
  401. #endif
  402. filePath += plugin->name();
  403. QFile file(filePath);
  404. if (file.open(QIODevice::WriteOnly))
  405. {
  406. QByteArray chunk((const char*)data, dataSize);
  407. file.write(chunk);
  408. file.close();
  409. engine->osc_send_bridge_set_chunk_data(filePath.toUtf8().constData());
  410. }
  411. }
  412. }
  413. engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_SAVED, "");
  414. }
  415. void setCustomData(const char* const type, const char* const key, const char* const value)
  416. {
  417. qDebug("CarlaPluginClient::setCustomData(\"%s\", \"%s\", \"%s\")", type, key, value);
  418. CARLA_ASSERT(plugin);
  419. if (! plugin)
  420. return;
  421. plugin->setCustomData(CarlaBackend::getCustomDataStringType(type), key, value, true);
  422. }
  423. void setChunkData(const char* const filePath)
  424. {
  425. qDebug("CarlaPluginClient::setChunkData(\"%s\")", filePath);
  426. CARLA_ASSERT(plugin);
  427. if (! plugin)
  428. return;
  429. nextChunkFilePath = QString(filePath);
  430. while (! nextChunkFilePath.isEmpty())
  431. carla_msleep(25);
  432. }
  433. // ---------------------------------------------------------------------
  434. // callback
  435. void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const double value3)
  436. {
  437. qDebug("CarlaPluginClient::handleCallback(%s, %i, %i, %g)", CarlaBackend::CallbackType2str(action), value1, value2, value3);
  438. if (! engine)
  439. return;
  440. switch (action)
  441. {
  442. case CarlaBackend::CALLBACK_PARAMETER_VALUE_CHANGED:
  443. engine->osc_send_bridge_set_parameter_value(value1, value3);
  444. break;
  445. case CarlaBackend::CALLBACK_PROGRAM_CHANGED:
  446. engine->osc_send_bridge_set_program(value1);
  447. break;
  448. case CarlaBackend::CALLBACK_MIDI_PROGRAM_CHANGED:
  449. engine->osc_send_bridge_set_midi_program(value1);
  450. break;
  451. case CarlaBackend::CALLBACK_NOTE_ON:
  452. {
  453. //uint8_t mdata[4] = { 0, MIDI_STATUS_NOTE_ON, (uint8_t)value1, (uint8_t)value2 };
  454. //osc_send_midi(mdata);
  455. break;
  456. }
  457. case CarlaBackend::CALLBACK_NOTE_OFF:
  458. {
  459. //uint8_t mdata[4] = { 0, MIDI_STATUS_NOTE_OFF, (uint8_t)value1, (uint8_t)value2 };
  460. //osc_send_midi(mdata);
  461. break;
  462. }
  463. case CarlaBackend::CALLBACK_SHOW_GUI:
  464. if (value1 == 0)
  465. engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, "");
  466. break;
  467. case CarlaBackend::CALLBACK_RESIZE_GUI:
  468. CARLA_ASSERT(value1 > 0 && value2 > 0);
  469. nextWidth = value1;
  470. nextHeight = value2;
  471. break;
  472. case CarlaBackend::CALLBACK_RELOAD_PARAMETERS:
  473. //if (CARLA_PLUGIN)
  474. //{
  475. // for (uint32_t i=0; i < CARLA_PLUGIN->parameterCount(); i++)
  476. // {
  477. // osc_send_control(i, CARLA_PLUGIN->getParameterValue(i));
  478. // }
  479. //}
  480. break;
  481. case CarlaBackend::CALLBACK_QUIT:
  482. //QApplication::quit();
  483. break;
  484. default:
  485. break;
  486. }
  487. Q_UNUSED(value3);
  488. }
  489. // ---------------------------------------------------------------------
  490. static void callback(void* const ptr, CarlaBackend::CallbackType const action, const unsigned short, const int value1, const int value2, const double value3)
  491. {
  492. CARLA_ASSERT(ptr);
  493. if (! ptr)
  494. return;
  495. BridgePluginClient* const _this_ = (BridgePluginClient*)ptr;
  496. _this_->handleCallback(action, value1, value2, value3);
  497. }
  498. protected:
  499. void guiClosedCallback()
  500. {
  501. }
  502. void timerEvent(QTimerEvent* const event)
  503. {
  504. if (qCloseNow)
  505. return quit();
  506. if (event->timerId() == msgTimer)
  507. {
  508. if (! nextChunkFilePath.isEmpty())
  509. {
  510. #ifdef Q_OS_WIN
  511. if (nextChunkFilePath.startsWith("/"))
  512. {
  513. // running under Wine, posix host
  514. nextChunkFilePath = nextChunkFilePath.replace(0, 1, "Z:/");
  515. nextChunkFilePath = QDir::toNativeSeparators(nextChunkFilePath);
  516. }
  517. #endif
  518. QFile chunkFile(nextChunkFilePath);
  519. if (plugin && chunkFile.open(QIODevice::ReadOnly | QIODevice::Text))
  520. {
  521. QTextStream in(&chunkFile);
  522. QString stringData(in.readAll());
  523. chunkFile.close();
  524. chunkFile.remove();
  525. plugin->setChunkData(stringData.toUtf8().constData());
  526. }
  527. nextChunkFilePath.clear();
  528. }
  529. if (nextWidth > 0 && nextHeight > 0 && pluginGui)
  530. {
  531. pluginGui->setNewSize(nextWidth, nextHeight);
  532. nextWidth = 0;
  533. nextHeight = 0;
  534. }
  535. if (plugin)
  536. plugin->idleGui();
  537. if (! CarlaClient::runMessages())
  538. {
  539. CARLA_ASSERT(msgTimer == 0);
  540. msgTimer = 0;
  541. return;
  542. }
  543. }
  544. QApplication::timerEvent(event);
  545. }
  546. // ---------------------------------------------------------------------
  547. private:
  548. int msgTimer;
  549. int nextWidth, nextHeight;
  550. QString nextChunkFilePath;
  551. CarlaBackend::CarlaEngine* engine;
  552. CarlaBackend::CarlaPlugin* plugin;
  553. BridgePluginGUI* pluginGui;
  554. };
  555. // -------------------------------------------------------------------------
  556. CARLA_BRIDGE_END_NAMESPACE
  557. int main(int argc, char* argv[])
  558. {
  559. if (argc != 6)
  560. {
  561. qWarning("usage: %s <osc-url|\"null\"> <type> <filename> <name|\"(none)\"> <label>", argv[0]);
  562. return 1;
  563. }
  564. qargc = argc;
  565. qargv = argv;
  566. const char* const oscUrl = argv[1];
  567. const char* const stype = argv[2];
  568. const char* const filename = argv[3];
  569. const char* name = argv[4];
  570. const char* const label = argv[5];
  571. const bool useOsc = strcmp(oscUrl, "null");
  572. if (strcmp(name, "(none)") == 0)
  573. name = nullptr;
  574. CarlaBackend::PluginType itype;
  575. if (strcmp(stype, "LADSPA") == 0)
  576. itype = CarlaBackend::PLUGIN_LADSPA;
  577. else if (strcmp(stype, "DSSI") == 0)
  578. itype = CarlaBackend::PLUGIN_DSSI;
  579. else if (strcmp(stype, "LV2") == 0)
  580. itype = CarlaBackend::PLUGIN_LV2;
  581. else if (strcmp(stype, "VST") == 0)
  582. itype = CarlaBackend::PLUGIN_VST;
  583. else
  584. {
  585. itype = CarlaBackend::PLUGIN_NONE;
  586. qWarning("Invalid plugin type '%s'", stype);
  587. return 1;
  588. }
  589. #ifdef PTW32_STATIC_LIB
  590. PThreadScopedInitializer pthreadScopedInitializer();
  591. #endif
  592. // Init bridge client
  593. CarlaBridge::BridgePluginClient client;
  594. client.init();
  595. // Init OSC
  596. if (useOsc && ! client.oscInit(oscUrl))
  597. {
  598. client.quit();
  599. return -1;
  600. }
  601. // Init backend engine
  602. CarlaBackend::CarlaEngineJack engine;
  603. engine.setCallback(client.callback, &client);
  604. // bridge client <-> engine
  605. client.registerOscEngine(&engine);
  606. // Init engine
  607. QString engName = QString("%1 (master)").arg(name ? name : label);
  608. engName.truncate(engine.maxClientNameSize());
  609. if (! engine.init(engName.toUtf8().constData()))
  610. {
  611. const char* const lastError = CarlaBackend::getLastError();
  612. qWarning("Bridge engine failed to start, error was:\n%s", lastError);
  613. engine.close();
  614. client.sendOscBridgeError(lastError);
  615. client.quit();
  616. return 2;
  617. }
  618. /// Init plugin
  619. short id = engine.addPlugin(itype, filename, name, label);
  620. int ret;
  621. if (id >= 0 && id < CarlaBackend::MAX_PLUGINS)
  622. {
  623. CarlaBackend::CarlaPlugin* const plugin = engine.getPlugin(id);
  624. client.setStuff(&engine, plugin);
  625. // create window if needed
  626. bool guiResizable;
  627. CarlaBackend::GuiType guiType;
  628. plugin->getGuiInfo(&guiType, &guiResizable);
  629. if (guiType == CarlaBackend::GUI_INTERNAL_QT4 || guiType == CarlaBackend::GUI_INTERNAL_COCOA || guiType == CarlaBackend::GUI_INTERNAL_HWND || guiType == CarlaBackend::GUI_INTERNAL_X11)
  630. {
  631. client.createWindow(guiResizable);
  632. }
  633. if (! useOsc)
  634. plugin->setActive(true, false, false);
  635. ret = 0;
  636. }
  637. else
  638. {
  639. const char* const lastError = CarlaBackend::getLastError();
  640. qWarning("Plugin failed to load, error was:\n%s", lastError);
  641. if (useOsc)
  642. client.sendOscBridgeError(lastError);
  643. ret = 1;
  644. }
  645. if (ret == 0)
  646. {
  647. initSignalHandler();
  648. client.exec(nullptr, !useOsc);
  649. }
  650. engine.removeAllPlugins();
  651. engine.close();
  652. if (useOsc)
  653. {
  654. // Close OSC
  655. client.sendOscExiting();
  656. client.oscClose();
  657. // bridge client can't be closed manually, only by host
  658. }
  659. else
  660. {
  661. // Close bridge client
  662. client.quit();
  663. }
  664. return ret;
  665. }
  666. #endif // BUILD_BRIDGE_PLUGIN