3 * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
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.
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.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef CARLA_ENGINE_CLIENT_HPP_INCLUDED
19 #define CARLA_ENGINE_CLIENT_HPP_INCLUDED
21 #include "CarlaEngine.hpp"
22 #include "CarlaEnginePorts.hpp"
23 #include "CarlaPlugin.hpp"
25 #include "CarlaStringList.hpp"
27 CARLA_BACKEND_START_NAMESPACE
29 // -----------------------------------------------------------------------
30 // Carla Engine Client Protected Data
32 struct CarlaEngineClient::ProtectedData
{
33 const CarlaEngine
& engine
;
38 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
39 CarlaEngineCVSourcePortsForStandalone cvSourcePorts
;
40 EngineInternalGraph
& egraph
;
41 CarlaPluginPtr plugin
;
44 CarlaStringList audioInList
;
45 CarlaStringList audioOutList
;
46 CarlaStringList cvInList
;
47 CarlaStringList cvOutList
;
48 CarlaStringList eventInList
;
49 CarlaStringList eventOutList
;
51 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
52 ProtectedData(const CarlaEngine
& eng
, EngineInternalGraph
& eg
, CarlaPluginPtr p
) noexcept
;
54 ProtectedData(const CarlaEngine
& eng
) noexcept
;
58 void addAudioPortName(bool isInput
, const char* name
);
59 void addCVPortName(bool isInput
, const char* name
);
60 void addEventPortName(bool isInput
, const char* name
);
62 const char* getUniquePortName(const char* name
);
64 #ifdef CARLA_PROPER_CPP11_SUPPORT
65 ProtectedData() = delete;
66 CARLA_DECLARE_NON_COPYABLE(ProtectedData
)
70 // -----------------------------------------------------------------------
71 // Carla Engine Client
73 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
74 class CarlaEngineClientForStandalone
: public CarlaEngineClient
77 CarlaEngineClientForStandalone(const CarlaEngine
& engine
,
78 EngineInternalGraph
& egraph
,
79 const CarlaPluginPtr plugin
)
80 : CarlaEngineClient(new ProtectedData(engine
, egraph
, plugin
)) {}
82 ~CarlaEngineClientForStandalone() noexcept override
84 carla_debug("CarlaEngineClientForStandalone::~CarlaEngineClientForStandalone()");
89 inline PatchbayGraph
* getPatchbayGraphOrNull() const noexcept
91 return pData
->egraph
.getPatchbayGraphOrNull();
94 inline CarlaPluginPtr
getPlugin() const noexcept
99 CARLA_DECLARE_NON_COPYABLE(CarlaEngineClientForStandalone
)
101 typedef CarlaEngineClientForStandalone CarlaEngineClientForSubclassing
;
103 class CarlaEngineClientForBridge
: public CarlaEngineClient
106 CarlaEngineClientForBridge(const CarlaEngine
& engine
)
107 : CarlaEngineClient(new ProtectedData(engine
)) {}
109 ~CarlaEngineClientForBridge() override
111 carla_debug("CarlaEngineClientForBridge::~CarlaEngineClientForBridge()");
115 CARLA_DECLARE_NON_COPYABLE(CarlaEngineClientForBridge
)
117 typedef CarlaEngineClientForBridge CarlaEngineClientForSubclassing
;
120 // -----------------------------------------------------------------------
122 CARLA_BACKEND_END_NAMESPACE
124 #endif // CARLA_ENGINE_CLIENT_HPP_INCLUDED