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.

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