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.

92 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. CARLA_SAFE_ASSERT(cvs.size() == 0);
  46. }
  47. void cleanup()
  48. {
  49. const CarlaRecursiveMutexLocker crml(rmutex);
  50. for (int i = cvs.size(); --i >= 0;)
  51. delete cvs[i].cvPort;
  52. cvs.clear();
  53. }
  54. CARLA_DECLARE_NON_COPY_STRUCT(ProtectedData)
  55. };
  56. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  57. // -----------------------------------------------------------------------
  58. // Carla Engine Meta CV Port
  59. class CarlaEngineCVSourcePortsForStandalone : public CarlaEngineCVSourcePorts
  60. {
  61. public:
  62. CarlaEngineCVSourcePortsForStandalone() : CarlaEngineCVSourcePorts() {}
  63. ~CarlaEngineCVSourcePortsForStandalone() override {}
  64. inline void setGraphAndPlugin(PatchbayGraph* const graph, CarlaPlugin* const plugin) noexcept
  65. {
  66. pData->graph = graph;
  67. pData->plugin = plugin;
  68. }
  69. };
  70. #endif
  71. // -----------------------------------------------------------------------
  72. CARLA_BACKEND_END_NAMESPACE
  73. #endif // CARLA_ENGINE_PORTS_HPP_INCLUDED