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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 "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* p) noexcept;
  42. #else
  43. ProtectedData(const CarlaEngine& eng) noexcept;
  44. #endif
  45. void addAudioPortName(bool isInput, const char* name);
  46. void addCVPortName(bool isInput, const char* name);
  47. void addEventPortName(bool isInput, const char* name);
  48. void clearPorts();
  49. const char* getUniquePortName(const char* name);
  50. #ifdef CARLA_PROPER_CPP11_SUPPORT
  51. ProtectedData() = delete;
  52. CARLA_DECLARE_NON_COPY_STRUCT(ProtectedData)
  53. #endif
  54. };
  55. // -----------------------------------------------------------------------
  56. // Carla Engine Client
  57. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  58. class CarlaEngineClientForStandalone : public CarlaEngineClient
  59. {
  60. public:
  61. CarlaEngineClientForStandalone(const CarlaEngine& engine, EngineInternalGraph& egraph, CarlaPlugin* const plugin)
  62. : CarlaEngineClient(new ProtectedData(engine, egraph, plugin)) {}
  63. ~CarlaEngineClientForStandalone() noexcept override
  64. {
  65. delete pData;
  66. }
  67. protected:
  68. inline PatchbayGraph* getPatchbayGraphOrNull() const noexcept
  69. {
  70. return pData->egraph.getPatchbayGraphOrNull();
  71. }
  72. inline CarlaPlugin* getPlugin() const noexcept
  73. {
  74. return pData->plugin;
  75. }
  76. CARLA_DECLARE_NON_COPY_CLASS(CarlaEngineClientForStandalone)
  77. };
  78. typedef CarlaEngineClientForStandalone CarlaEngineClientForSubclassing;
  79. #else
  80. class CarlaEngineClientForBridge : public CarlaEngineClient
  81. {
  82. public:
  83. CarlaEngineClientForBridge(const CarlaEngine& engine)
  84. : CarlaEngineClient(new ProtectedData(engine)) {}
  85. ~CarlaEngineClientForBridge() override
  86. {
  87. delete pData;
  88. }
  89. CARLA_DECLARE_NON_COPY_CLASS(CarlaEngineClientForBridge)
  90. };
  91. typedef CarlaEngineClientForBridge CarlaEngineClientForSubclassing;
  92. #endif
  93. // -----------------------------------------------------------------------
  94. CARLA_BACKEND_END_NAMESPACE
  95. #endif // CARLA_ENGINE_CLIENT_HPP_INCLUDED