summaryrefslogtreecommitdiffstats
path: root/src/server/GraphImpl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/GraphImpl.hpp')
-rw-r--r--src/server/GraphImpl.hpp87
1 files changed, 52 insertions, 35 deletions
diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp
index 3e3c6159..6c852106 100644
--- a/src/server/GraphImpl.hpp
+++ b/src/server/GraphImpl.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2023 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -20,22 +20,31 @@
#include "BlockImpl.hpp"
#include "DuplexPort.hpp"
#include "ThreadManager.hpp"
+#include "server.h"
+#include "types.hpp"
-#include "ingen/types.hpp"
+#include <lv2/urid/urid.h>
+#include <raul/Maid.hpp>
+
+#include <boost/intrusive/options.hpp>
+#include <boost/intrusive/slist.hpp>
#include <cassert>
#include <cstdint>
#include <memory>
#include <utility>
-namespace raul { class Maid; }
+namespace raul {
+class Symbol;
+} // namespace raul
-namespace ingen {
-namespace server {
+namespace ingen::server {
class ArcImpl;
+class BufferFactory;
class CompiledGraph;
class Engine;
+class PortImpl;
class RunContext;
/** A group of blocks in a graph, possibly polyphonic.
@@ -46,32 +55,32 @@ class RunContext;
*
* \ingroup engine
*/
-class GraphImpl final : public BlockImpl
+class INGEN_SERVER_API GraphImpl final : public BlockImpl
{
public:
GraphImpl(Engine& engine,
- const Raul::Symbol& symbol,
+ const raul::Symbol& symbol,
uint32_t poly,
GraphImpl* parent,
SampleRate srate,
uint32_t internal_poly);
- virtual ~GraphImpl();
+ ~GraphImpl() override;
GraphType graph_type() const override { return GraphType::GRAPH; }
BlockImpl* duplicate(Engine& engine,
- const Raul::Symbol& symbol,
+ const raul::Symbol& symbol,
GraphImpl* parent) override;
void activate(BufferFactory& bufs) override;
void deactivate() override;
- void pre_process(RunContext& context) override;
- void process(RunContext& context) override;
- void run(RunContext& context) override;
+ void pre_process(RunContext& ctx) override;
+ void process(RunContext& ctx) override;
+ void run(RunContext& ctx) override;
- void set_buffer_size(RunContext& context,
+ void set_buffer_size(RunContext& ctx,
BufferFactory& bufs,
LV2_URID type,
uint32_t size) override;
@@ -87,14 +96,19 @@ public:
*
* Audio thread.
*
- * \param context Process context
+ * \param ctx Process context
+ *
* \param bufs New set of buffers
- * \param poly Must be < the most recent value passed to prepare_internal_poly.
- * \param maid Any objects no longer needed will be pushed to this
+ *
+ * \param poly Must be < the most recent value passed to
+ * prepare_internal_poly.
+ *
+ * \param maid Any objects no longer needed will be
+ * pushed to this
*/
- bool apply_internal_poly(RunContext& context,
+ bool apply_internal_poly(RunContext& ctx,
BufferFactory& bufs,
- Raul::Maid& maid,
+ raul::Maid& maid,
uint32_t poly);
// Graph specific stuff not inherited from Block
@@ -156,28 +170,30 @@ public:
/** Add an arc to this graph.
* Pre-processing thread only.
*/
- void add_arc(const SPtr<ArcImpl>& a);
+ void add_arc(const std::shared_ptr<ArcImpl>& a);
/** Remove an arc from this graph.
* Pre-processing thread only.
*/
- SPtr<ArcImpl> remove_arc(const PortImpl* tail, const PortImpl* dst_port);
+ std::shared_ptr<ArcImpl>
+ remove_arc(const PortImpl* tail, const PortImpl* dst_port);
bool has_arc(const PortImpl* tail, const PortImpl* dst_port) const;
/** Set a new compiled graph to run, and return the old one. */
- void set_compiled_graph(MPtr<CompiledGraph>&& cg);
+ [[nodiscard]] std::unique_ptr<CompiledGraph>
+ swap_compiled_graph(std::unique_ptr<CompiledGraph> cg);
- const MPtr<Ports>& external_ports() { return _ports; }
+ const raul::managed_ptr<Ports>& external_ports() { return _ports; }
- void set_external_ports(MPtr<Ports>&& pa) { _ports = std::move(pa); }
+ void set_external_ports(raul::managed_ptr<Ports>&& pa) { _ports = std::move(pa); }
- MPtr<Ports> build_ports_array(Raul::Maid& maid);
+ raul::managed_ptr<Ports> build_ports_array(raul::Maid& maid);
/** Whether to run this graph's DSP bits in the audio thread */
bool enabled() const { return _process; }
void enable() { _process = true; }
- void disable(RunContext& context);
+ void disable(RunContext& ctx);
uint32_t internal_poly() const { return _poly_pre; }
uint32_t internal_poly_process() const { return _poly_process; }
@@ -185,17 +201,18 @@ public:
Engine& engine() { return _engine; }
private:
- Engine& _engine;
- uint32_t _poly_pre; ///< Pre-process thread only
- uint32_t _poly_process; ///< Process thread only
- MPtr<CompiledGraph> _compiled_graph; ///< Process thread only
- PortList _inputs; ///< Pre-process thread only
- PortList _outputs; ///< Pre-process thread only
- Blocks _blocks; ///< Pre-process thread only
- bool _process; ///< True iff graph is enabled
+ using CompiledGraphPtr = std::unique_ptr<CompiledGraph>;
+
+ Engine& _engine;
+ uint32_t _poly_pre; ///< Pre-process thread only
+ uint32_t _poly_process; ///< Process thread only
+ CompiledGraphPtr _compiled_graph; ///< Process thread only
+ PortList _inputs; ///< Pre-process thread only
+ PortList _outputs; ///< Pre-process thread only
+ Blocks _blocks; ///< Pre-process thread only
+ bool _process{false}; ///< True iff graph is enabled
};
-} // namespace server
-} // namespace ingen
+} // namespace ingen::server
#endif // INGEN_ENGINE_GRAPHIMPL_HPP