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.

97 lines
2.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_PORTS_HPP_INCLUDED
  18. #define CARLA_ENGINE_PORTS_HPP_INCLUDED
  19. #include "CarlaEngine.hpp"
  20. #include "CarlaEngineInternal.hpp"
  21. CARLA_BACKEND_START_NAMESPACE
  22. // -----------------------------------------------------------------------
  23. // Carla Engine Meta CV Port Protected Data
  24. struct CarlaEngineEventCV {
  25. CarlaEngineCVPort* cvPort;
  26. uint32_t indexOffset;
  27. float previousValue;
  28. };
  29. struct CarlaEngineCVSourcePorts::ProtectedData {
  30. CarlaRecursiveMutex rmutex;
  31. EngineEvent* buffer;
  32. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  33. PatchbayGraph* graph;
  34. CarlaPlugin* plugin;
  35. #endif
  36. water::Array<CarlaEngineEventCV> cvs;
  37. ProtectedData() noexcept
  38. : rmutex(),
  39. buffer(nullptr),
  40. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  41. graph(nullptr),
  42. plugin(nullptr),
  43. #endif
  44. cvs() {}
  45. ~ProtectedData()
  46. {
  47. {
  48. const CarlaRecursiveMutexLocker crml(rmutex);
  49. for (int i = cvs.size(); --i >= 0;)
  50. delete cvs[i].cvPort;
  51. cvs.clear();
  52. }
  53. if (buffer != nullptr)
  54. {
  55. delete[] buffer;
  56. buffer = nullptr;
  57. }
  58. }
  59. CARLA_DECLARE_NON_COPY_STRUCT(ProtectedData)
  60. };
  61. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  62. // -----------------------------------------------------------------------
  63. // Carla Engine Meta CV Port
  64. class CarlaEngineCVSourcePortsForStandalone : public CarlaEngineCVSourcePorts
  65. {
  66. public:
  67. CarlaEngineCVSourcePortsForStandalone() : CarlaEngineCVSourcePorts() {}
  68. ~CarlaEngineCVSourcePortsForStandalone() override {}
  69. inline void setGraphAndPlugin(PatchbayGraph* const graph, CarlaPlugin* const plugin) noexcept
  70. {
  71. pData->graph = graph;
  72. pData->plugin = plugin;
  73. }
  74. };
  75. #endif
  76. // -----------------------------------------------------------------------
  77. CARLA_BACKEND_END_NAMESPACE
  78. #endif // CARLA_ENGINE_PORTS_HPP_INCLUDED