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.

89 lines
2.4KB

  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_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. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  32. PatchbayGraph* graph;
  33. CarlaPlugin* plugin;
  34. #endif
  35. water::Array<CarlaEngineEventCV> cvs;
  36. ProtectedData() noexcept
  37. : rmutex(),
  38. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  39. graph(nullptr),
  40. plugin(nullptr),
  41. #endif
  42. cvs() {}
  43. ~ProtectedData()
  44. {
  45. {
  46. const CarlaRecursiveMutexLocker crml(rmutex);
  47. for (int i = cvs.size(); --i >= 0;)
  48. delete cvs[i].cvPort;
  49. cvs.clear();
  50. }
  51. }
  52. CARLA_DECLARE_NON_COPY_STRUCT(ProtectedData)
  53. };
  54. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  55. // -----------------------------------------------------------------------
  56. // Carla Engine Meta CV Port
  57. class CarlaEngineCVSourcePortsForStandalone : public CarlaEngineCVSourcePorts
  58. {
  59. public:
  60. CarlaEngineCVSourcePortsForStandalone() : CarlaEngineCVSourcePorts() {}
  61. ~CarlaEngineCVSourcePortsForStandalone() override {}
  62. inline void setGraphAndPlugin(PatchbayGraph* const graph, CarlaPlugin* const plugin) noexcept
  63. {
  64. pData->graph = graph;
  65. pData->plugin = plugin;
  66. }
  67. };
  68. #endif
  69. // -----------------------------------------------------------------------
  70. CARLA_BACKEND_END_NAMESPACE
  71. #endif // CARLA_ENGINE_PORTS_HPP_INCLUDED