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.

CarlaEngineClient.hpp 3.7KB

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