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.

127 lines
3.5KB

  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. #ifndef CARLA_ENGINE_CLIENT_HPP_INCLUDED
  18. #define CARLA_ENGINE_CLIENT_HPP_INCLUDED
  19. #include "CarlaEngine.hpp"
  20. #include "CarlaEnginePorts.hpp"
  21. #include "CarlaStringList.hpp"
  22. CARLA_BACKEND_START_NAMESPACE
  23. // -----------------------------------------------------------------------
  24. // Carla Engine Client Protected Data
  25. struct CarlaEngineClient::ProtectedData {
  26. const CarlaEngine& engine;
  27. bool active;
  28. uint32_t latency;
  29. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  30. CarlaEngineCVSourcePortsForStandalone cvSourcePorts;
  31. EngineInternalGraph& egraph;
  32. CarlaPlugin* const plugin;
  33. #endif
  34. CarlaStringList audioInList;
  35. CarlaStringList audioOutList;
  36. CarlaStringList cvInList;
  37. CarlaStringList cvOutList;
  38. CarlaStringList eventInList;
  39. CarlaStringList eventOutList;
  40. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  41. ProtectedData(const CarlaEngine& eng, EngineInternalGraph& eg, CarlaPlugin* const p) noexcept
  42. #else
  43. ProtectedData(const CarlaEngine& eng) noexcept
  44. #endif
  45. : engine(eng),
  46. active(false),
  47. latency(0),
  48. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  49. cvSourcePorts(),
  50. egraph(eg),
  51. plugin(p),
  52. #endif
  53. audioInList(),
  54. audioOutList(),
  55. cvInList(),
  56. cvOutList(),
  57. eventInList(),
  58. eventOutList() {}
  59. #ifdef CARLA_PROPER_CPP11_SUPPORT
  60. ProtectedData() = delete;
  61. CARLA_DECLARE_NON_COPY_STRUCT(ProtectedData)
  62. #endif
  63. };
  64. // -----------------------------------------------------------------------
  65. // Carla Engine Client
  66. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  67. class CarlaEngineClientForStandalone : public CarlaEngineClient
  68. {
  69. public:
  70. CarlaEngineClientForStandalone(const CarlaEngine& engine, EngineInternalGraph& egraph, CarlaPlugin* const plugin)
  71. : CarlaEngineClient(new ProtectedData(engine, egraph, plugin)) {}
  72. ~CarlaEngineClientForStandalone() override
  73. {
  74. delete pData;
  75. }
  76. protected:
  77. inline PatchbayGraph* getPatchbayGraph() const noexcept
  78. {
  79. return pData->egraph.getPatchbayGraph();
  80. }
  81. inline CarlaPlugin* getPlugin() const noexcept
  82. {
  83. return pData->plugin;
  84. }
  85. CARLA_DECLARE_NON_COPY_CLASS(CarlaEngineClientForStandalone)
  86. };
  87. typedef CarlaEngineClientForStandalone CarlaEngineClientForSubclassing;
  88. #else
  89. class CarlaEngineClientForBridge : public CarlaEngineClient
  90. {
  91. public:
  92. CarlaEngineClientForBridge(const CarlaEngine& engine)
  93. : CarlaEngineClient(new ProtectedData(engine)) {}
  94. ~CarlaEngineClientForBridge() override
  95. {
  96. delete pData;
  97. }
  98. CARLA_DECLARE_NON_COPY_CLASS(CarlaEngineClientForBridge)
  99. };
  100. typedef CarlaEngineClientForBridge CarlaEngineClientForSubclassing;
  101. #endif
  102. // -----------------------------------------------------------------------
  103. CARLA_BACKEND_END_NAMESPACE
  104. #endif // CARLA_ENGINE_CLIENT_HPP_INCLUDED