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.

92 lines
2.2KB

  1. /*
  2. * Carla Backend
  3. * Copyright (C) 2011-2012 Filipe Coelho <falktx@gmail.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. #ifndef CARLA_THREADS_H
  18. #define CARLA_THREADS_H
  19. #include "carla_backend.h"
  20. #include <QtCore/QMutex>
  21. #include <QtCore/QThread>
  22. class QProcess;
  23. // --------------------------------------------------------------------------------------------------------
  24. // CarlaCheckThread
  25. class CarlaCheckThread : public QThread
  26. {
  27. public:
  28. CarlaCheckThread(CarlaBackend::CarlaEngine* const engine, QObject* const parent = nullptr);
  29. ~CarlaCheckThread();
  30. void stopNow();
  31. void lock()
  32. {
  33. mutex.lock();
  34. }
  35. void unlock()
  36. {
  37. mutex.unlock();
  38. }
  39. protected:
  40. void run();
  41. private:
  42. CarlaBackend::CarlaEngine* const engine;
  43. QMutex mutex;
  44. bool m_stopNow;
  45. };
  46. // --------------------------------------------------------------------------------------------------------
  47. // CarlaPluginThread
  48. class CarlaPluginThread : public QThread
  49. {
  50. public:
  51. enum PluginThreadMode {
  52. PLUGIN_THREAD_DSSI_GUI,
  53. PLUGIN_THREAD_LV2_GUI,
  54. PLUGIN_THREAD_VST_GUI,
  55. PLUGIN_THREAD_BRIDGE
  56. };
  57. CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin, const PluginThreadMode mode, QObject* const parent = nullptr);
  58. ~CarlaPluginThread();
  59. void setOscData(const char* const binary, const char* const label, const char* const data1="");
  60. protected:
  61. void run();
  62. private:
  63. CarlaBackend::CarlaEngine* const engine;
  64. CarlaBackend::CarlaPlugin* const plugin;
  65. const PluginThreadMode mode;
  66. QString m_binary;
  67. QString m_label;
  68. QString m_data1;
  69. QProcess* m_process;
  70. };
  71. #endif // CARLA_THREADS_H