diff options
author | David Robillard <d@drobilla.net> | 2012-08-19 02:24:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-19 02:24:38 +0000 |
commit | 800c329a0b77f9044923885abe0728028eca8350 (patch) | |
tree | f2d4a9d06fd6978e193de95ba60bfffe3d15a998 /src/server | |
parent | 317627ef40f7654c298aa1ac707851c852259e3a (diff) | |
download | ingen-800c329a0b77f9044923885abe0728028eca8350.tar.gz ingen-800c329a0b77f9044923885abe0728028eca8350.tar.bz2 ingen-800c329a0b77f9044923885abe0728028eca8350.zip |
Patch => Graph
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4721 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
62 files changed, 500 insertions, 499 deletions
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 7d99ca28..2ccb0e2f 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -22,7 +22,7 @@ #include "Buffer.hpp" #include "Engine.hpp" #include "BlockImpl.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" @@ -36,7 +36,7 @@ namespace Server { BlockImpl::BlockImpl(PluginImpl* plugin, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate) : GraphObjectImpl(plugin->uris(), parent, symbol) , _plugin(plugin) @@ -58,7 +58,7 @@ BlockImpl::~BlockImpl() } if (is_linked()) { - parent_patch()->remove_block(*this); + parent_graph()->remove_block(*this); } delete _ports; diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index fd2af927..12318d60 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -43,12 +43,12 @@ namespace Server { class Buffer; class BufferFactory; class Context; -class PatchImpl; +class GraphImpl; class PluginImpl; class PortImpl; class ProcessContext; -/** A Block in a Patch (which is also a Block). +/** A Block in a Graph (which is also a Block). * * This is what is often called a "Module" in modular synthesizers. A Block is * a unit with input/output ports, a process() method, and some other things. @@ -56,13 +56,13 @@ class ProcessContext; * \ingroup engine */ class BlockImpl : public GraphObjectImpl - , public boost::intrusive::slist_base_hook<> // In PatchImpl + , public boost::intrusive::slist_base_hook<> // In GraphImpl { public: BlockImpl(PluginImpl* plugin, const Raul::Symbol& symbol, bool poly, - PatchImpl* parent, + GraphImpl* parent, SampleRate rate); virtual ~BlockImpl(); @@ -72,7 +72,7 @@ public: /** Activate this Block. * * This function must be called in a non-realtime thread before it is - * inserted in to a patch. Any non-realtime actions that need to be + * inserted in to a graph. Any non-realtime actions that need to be * done before the Block is ready for use should be done here. */ virtual void activate(BufferFactory& bufs); @@ -80,7 +80,7 @@ public: /** Deactivate this Block. * * This function must be called in a non-realtime thread after the - * block has been removed from its patch (i.e. processing is finished). + * block has been removed from its graph (i.e. processing is finished). */ virtual void deactivate(); @@ -130,12 +130,12 @@ public: ProcessContext& context, Raul::Maid& maid, uint32_t poly); /** Information about the Plugin this Block is an instance of. - * Not the best name - not all blocks come from plugins (e.g. Patch) + * Not the best name - not all blocks come from plugins (e.g. Graph) */ virtual PluginImpl* plugin_impl() const { return _plugin; } /** Information about the Plugin this Block is an instance of. - * Not the best name - not all blocks come from plugins (ie Patch) + * Not the best name - not all blocks come from plugins (ie Graph) */ virtual const Plugin* plugin() const; @@ -146,8 +146,8 @@ public: LV2_URID type, uint32_t size); - /** The Patch this Block belongs to. */ - inline PatchImpl* parent_patch() const { return (PatchImpl*)_parent; } + /** The Graph this Block belongs to. */ + inline GraphImpl* parent_graph() const { return (GraphImpl*)_parent; } Context::ID context() const { return _context; } uint32_t num_ports() const { return _ports ? _ports->size() : 0; } diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 0bc7576a..3af4e5b7 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -89,9 +89,9 @@ public: BROADCAST(disconnect, tail, head); } - void disconnect_all(const Raul::Path& parent_patch_path, + void disconnect_all(const Raul::Path& graph, const Raul::Path& path) { - BROADCAST(disconnect_all, parent_patch_path, path); + BROADCAST(disconnect_all, graph, path); } void set_property(const Raul::URI& subject, diff --git a/src/server/CompiledPatch.hpp b/src/server/CompiledGraph.hpp index 15d1137a..024aa919 100644 --- a/src/server/CompiledPatch.hpp +++ b/src/server/CompiledGraph.hpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_ENGINE_COMPILEDPATCH_HPP -#define INGEN_ENGINE_COMPILEDPATCH_HPP +#ifndef INGEN_ENGINE_COMPILEDGRAPH_HPP +#define INGEN_ENGINE_COMPILEDGRAPH_HPP #include <vector> #include <list> @@ -54,7 +54,7 @@ private: std::vector<BlockImpl*> _dependants; ///< Blocks this one's output ports are connected to }; -/** A patch ``compiled'' into a flat structure with the correct order so +/** A graph ``compiled'' into a flat structure with the correct order so * the audio thread(s) can execute it without threading problems (since * the preprocessor thread modifies the graph). * @@ -62,7 +62,7 @@ private: * The parallel processing algorithm guarantees no block will be executed * before its providers, using this order as well as semaphores. */ -class CompiledPatch : public std::vector<CompiledBlock> +class CompiledGraph : public std::vector<CompiledBlock> , public Raul::Disposable , public Raul::Noncopyable { @@ -71,4 +71,4 @@ class CompiledPatch : public std::vector<CompiledBlock> } // namespace Server } // namespace Ingen -#endif // INGEN_ENGINE_COMPILEDPATCH_HPP +#endif // INGEN_ENGINE_COMPILEDGRAPH_HPP diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index de6818ff..e8f595fa 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -429,7 +429,7 @@ ControlBindings::pre_process(ProcessContext& context, Buffer* buffer) void ControlBindings::post_process(ProcessContext& context, Buffer* buffer) { - // TODO: merge buffer's existing contents (anything send to it in the patch) + // TODO: merge buffer's existing contents (anything send to it in the graph) buffer->copy(context, _feedback.get()); } diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp index 76cd3cbc..5fde93d9 100644 --- a/src/server/DirectDriver.hpp +++ b/src/server/DirectDriver.hpp @@ -38,7 +38,7 @@ public: virtual void deactivate() {} - virtual EnginePort* create_port(DuplexPort* patch_port) { + virtual EnginePort* create_port(DuplexPort* graph_port) { return NULL; } diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp index e038b2bc..e5c62623 100644 --- a/src/server/Driver.hpp +++ b/src/server/Driver.hpp @@ -34,7 +34,7 @@ class EnginePort; /** Engine driver base class. * - * A Driver is, from the perspective of GraphObjects (blocks, patches, ports) + * A Driver is, from the perspective of GraphObjects (blocks, graphs, ports) * an interface for managing system ports. An implementation of Driver * basically needs to manage EnginePorts, and handle writing/reading data * to/from them. @@ -54,12 +54,12 @@ public: /** Create a port ready to be inserted with add_input (non realtime). * May return NULL if the Driver can not create the port for some reason. */ - virtual EnginePort* create_port(DuplexPort* patch_port) = 0; + virtual EnginePort* create_port(DuplexPort* graph_port) = 0; /** Find a system port by path. */ virtual EnginePort* get_port(const Raul::Path& path) = 0; - /** Add a system visible port (e.g. a port on the root patch). */ + /** Add a system visible port (e.g. a port on the root graph). */ virtual void add_port(ProcessContext& context, EnginePort* port) = 0; /** Remove a system visible port. diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 43197844..34c9b590 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -18,8 +18,8 @@ #include "Buffer.hpp" #include "DuplexPort.hpp" +#include "GraphImpl.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" using namespace std; @@ -49,7 +49,7 @@ DuplexPort::DuplexPort(BufferFactory& bufs, DuplexPort::~DuplexPort() { if (is_linked()) { - parent_patch()->remove_port(*this); + parent_graph()->remove_port(*this); } } @@ -69,34 +69,34 @@ DuplexPort::get_buffers(BufferFactory& bufs, uint32_t DuplexPort::max_tail_poly(Context& context) const { - return parent_patch()->internal_poly_process(); + return parent_graph()->internal_poly_process(); } -/** Prepare for the execution of parent patch */ +/** Prepare for the execution of parent graph */ void DuplexPort::pre_process(Context& context) { if (_is_output) { - /* This is a patch output, which is an input from the internal + /* This is a graph output, which is an input from the internal perspective. Prepare buffers for write so plugins can deliver to them */ for (uint32_t v = 0; v < _poly; ++v) { _buffers->at(v)->prepare_write(context); } } else { - /* This is a a patch input, which is an output from the internal + /* This is a a graph input, which is an output from the internal perspective. Do whatever a normal block's input port does to prepare input for reading. */ InputPort::pre_process(context); } } -/** Finalize after the execution of parent patch (deliver outputs) */ +/** Finalize after the execution of parent graph (deliver outputs) */ void DuplexPort::post_process(Context& context) { if (_is_output) { - /* This is a patch output, which is an input from the internal + /* This is a graph output, which is an input from the internal perspective. Mix down input delivered by plugins so output (external perspective) is ready. */ InputPort::pre_process(context); diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index 25d389c5..55ba8fa0 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -28,18 +28,18 @@ namespace Server { class BlockImpl; -/** A duplex Port (both an InputPort and an OutputPort on a Patch) +/** A duplex Port (both an InputPort and an OutputPort on a Graph) * - * This is used for Patch ports, since they need to appear as both an input and + * This is used for Graph ports, since they need to appear as both an input and * an output port based on context. There are no actual duplex ports in Ingen, - * a Port is either an Input or Output. This class only exists to allow Patch - * outputs to appear as inputs from within that Patch, and vice versa. + * a Port is either an Input or Output. This class only exists to allow Graph + * outputs to appear as inputs from within that Graph, and vice versa. * * \ingroup engine */ class DuplexPort : public InputPort , public OutputPort - , public boost::intrusive::slist_base_hook<> // In PatchImpl + , public boost::intrusive::slist_base_hook<> // In GraphImpl { public: DuplexPort(BufferFactory& bufs, diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index eada608a..7c053884 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -34,7 +34,7 @@ #include "Engine.hpp" #include "Event.hpp" #include "EventWriter.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PostProcessor.hpp" #include "PreProcessor.hpp" #include "ProcessContext.hpp" @@ -59,7 +59,7 @@ Engine::Engine(Ingen::World* world) , _pre_processor(new PreProcessor()) , _post_processor(new PostProcessor(*this)) , _event_writer(new EventWriter(*this)) - , _root_patch(NULL) + , _root_graph(NULL) , _worker(new Worker(world->log(), event_queue_size())) , _process_context(*this) , _quit_flag(false) @@ -185,20 +185,20 @@ Engine::activate() const Ingen::URIs& uris = world()->uris(); Forge& forge = world()->forge(); - // Create root patch - if (!_root_patch) { - _root_patch = new PatchImpl( + // Create root graph + if (!_root_graph) { + _root_graph = new GraphImpl( *this, Raul::Symbol("root"), 1, NULL, _driver->sample_rate(), 1); - _root_patch->set_property( + _root_graph->set_property( uris.rdf_type, - Resource::Property(uris.ingen_Patch, Resource::INTERNAL)); - _root_patch->set_property( + Resource::Property(uris.ingen_Graph, Resource::INTERNAL)); + _root_graph->set_property( uris.ingen_polyphony, Resource::Property(_world->forge().make(int32_t(1)), Resource::INTERNAL)); - _root_patch->activate(*_buffer_factory); - _world->store()->add(_root_patch); - _root_patch->compiled_patch(_root_patch->compile()); + _root_graph->activate(*_buffer_factory); + _world->store()->add(_root_graph); + _root_graph->compiled_graph(_root_graph->compile()); ProcessContext context(*this); @@ -249,7 +249,7 @@ Engine::activate() } _driver->activate(); - _root_patch->enable(); + _root_graph->enable(); ThreadManager::single_threaded = false; @@ -265,8 +265,8 @@ Engine::deactivate() _driver->deactivate(); } - if (_root_patch) { - _root_patch->deactivate(); + if (_root_graph) { + _root_graph->deactivate(); } ThreadManager::single_threaded = true; @@ -279,7 +279,7 @@ Engine::run(uint32_t sample_count) // Apply control bindings to input control_bindings()->pre_process( - _process_context, _root_patch->port_impl(0)->buffer(0).get()); + _process_context, _root_graph->port_impl(0)->buffer(0).get()); post_processor()->set_end_time(_process_context.end()); @@ -287,14 +287,14 @@ Engine::run(uint32_t sample_count) // (Aiming for jitter-free 1 block event latency, ideally) const unsigned n_processed_events = process_events(); - // Run root patch - if (_root_patch) { - _root_patch->process(_process_context); + // Run root graph + if (_root_graph) { + _root_graph->process(_process_context); } // Emit control binding feedback control_bindings()->post_process( - _process_context, _root_patch->port_impl(1)->buffer(0).get()); + _process_context, _root_graph->port_impl(1)->buffer(0).get()); return n_processed_events; } diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 66930938..2d49bde0 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -34,17 +34,17 @@ class World; namespace Server { +class BlockFactory; class Broadcaster; class BufferFactory; class ControlBindings; class Driver; class Event; class EventWriter; -class BlockFactory; +class GraphImpl; class PostProcessor; class PreProcessor; class ProcessContext; -class PatchImpl; class Worker; /** @@ -98,7 +98,7 @@ public: ControlBindings* control_bindings() const { return _control_bindings; } Driver* driver() const { return _driver.get(); } Log& log() const { return _world->log(); } - PatchImpl* root_patch() const { return _root_patch; } + GraphImpl* root_graph() const { return _root_graph; } PostProcessor* post_processor() const { return _post_processor; } Raul::Maid* maid() const { return _maid; } Worker* worker() const { return _worker; } @@ -121,7 +121,7 @@ private: PreProcessor* _pre_processor; PostProcessor* _post_processor; EventWriter* _event_writer; - PatchImpl* _root_patch; + GraphImpl* _root_graph; Worker* _worker; ProcessContext _process_context; diff --git a/src/server/EnginePort.hpp b/src/server/EnginePort.hpp index 3bda2998..7154920b 100644 --- a/src/server/EnginePort.hpp +++ b/src/server/EnginePort.hpp @@ -37,7 +37,7 @@ class EnginePort : public Raul::Noncopyable { public: explicit EnginePort(DuplexPort* port) - : _patch_port(port) + : _graph_port(port) , _buffer(NULL) , _handle(NULL) {} @@ -47,11 +47,11 @@ public: void* buffer() const { return _buffer; } void* handle() const { return _handle; } - DuplexPort* patch_port() const { return _patch_port; } - bool is_input() const { return _patch_port->is_input(); } + DuplexPort* graph_port() const { return _graph_port; } + bool is_input() const { return _graph_port->is_input(); } protected: - DuplexPort* _patch_port; + DuplexPort* _graph_port; void* _buffer; void* _handle; }; diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index b4f95294..2b1b1bf6 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -103,12 +103,12 @@ EventWriter::disconnect(const Raul::Path& src, } void -EventWriter::disconnect_all(const Raul::Path& patch_path, +EventWriter::disconnect_all(const Raul::Path& graph, const Raul::Path& path) { _engine.enqueue_event( new Events::DisconnectAll(_engine, _respondee, _request_id, now(), - patch_path, path)); + graph, path)); } void diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 67b3b83b..5c44c5b6 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -79,7 +79,7 @@ public: virtual void del(const Raul::URI& uri); - virtual void disconnect_all(const Raul::Path& parent_patch_path, + virtual void disconnect_all(const Raul::Path& graph, const Raul::Path& path); virtual void get(const Raul::URI& uri); diff --git a/src/server/PatchImpl.cpp b/src/server/GraphImpl.cpp index ae16c634..81c69b46 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -25,8 +25,8 @@ #include "DuplexPort.hpp" #include "EdgeImpl.hpp" #include "Engine.hpp" -#include "PatchImpl.hpp" -#include "PatchPlugin.hpp" +#include "GraphImpl.hpp" +#include "GraphPlugin.hpp" #include "PortImpl.hpp" #include "ThreadManager.hpp" @@ -35,35 +35,35 @@ using namespace std; namespace Ingen { namespace Server { -PatchImpl::PatchImpl(Engine& engine, +GraphImpl::GraphImpl(Engine& engine, const Raul::Symbol& symbol, uint32_t poly, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate, uint32_t internal_poly) - : BlockImpl(new PatchPlugin(engine.world()->uris(), - engine.world()->uris().ingen_Patch, - Raul::Symbol("patch"), - "Ingen Patch"), + : BlockImpl(new GraphPlugin(engine.world()->uris(), + engine.world()->uris().ingen_Graph, + Raul::Symbol("graph"), + "Ingen Graph"), symbol, poly, parent, srate) , _engine(engine) , _poly_pre(internal_poly) , _poly_process(internal_poly) - , _compiled_patch(NULL) + , _compiled_graph(NULL) , _process(false) { assert(internal_poly >= 1); assert(internal_poly <= 128); } -PatchImpl::~PatchImpl() +GraphImpl::~GraphImpl() { - delete _compiled_patch; + delete _compiled_graph; delete _plugin; } void -PatchImpl::activate(BufferFactory& bufs) +GraphImpl::activate(BufferFactory& bufs) { BlockImpl::activate(bufs); @@ -75,7 +75,7 @@ PatchImpl::activate(BufferFactory& bufs) } void -PatchImpl::deactivate() +GraphImpl::deactivate() { if (_activated) { BlockImpl::deactivate(); @@ -89,7 +89,7 @@ PatchImpl::deactivate() } void -PatchImpl::disable(ProcessContext& context) +GraphImpl::disable(ProcessContext& context) { _process = false; for (Ports::iterator i = _outputs.begin(); i != _outputs.end(); ++i) { @@ -98,11 +98,11 @@ PatchImpl::disable(ProcessContext& context) } bool -PatchImpl::prepare_internal_poly(BufferFactory& bufs, uint32_t poly) +GraphImpl::prepare_internal_poly(BufferFactory& bufs, uint32_t poly) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - // TODO: Subpatch dynamic polyphony (i.e. changing port polyphony) + // TODO: Subgraph dynamic polyphony (i.e. changing port polyphony) for (Blocks::iterator i = _blocks.begin(); i != _blocks.end(); ++i) { i->prepare_poly(bufs, poly); @@ -113,12 +113,12 @@ PatchImpl::prepare_internal_poly(BufferFactory& bufs, uint32_t poly) } bool -PatchImpl::apply_internal_poly(ProcessContext& context, +GraphImpl::apply_internal_poly(ProcessContext& context, BufferFactory& bufs, Raul::Maid& maid, uint32_t poly) { - // TODO: Subpatch dynamic polyphony (i.e. changing port polyphony) + // TODO: Subgraph dynamic polyphony (i.e. changing port polyphony) for (Blocks::iterator i = _blocks.begin(); i != _blocks.end(); ++i) { i->apply_poly(context, maid, poly); @@ -133,7 +133,7 @@ PatchImpl::apply_internal_poly(ProcessContext& context, } } - const bool polyphonic = parent_patch() && (poly == parent_patch()->internal_poly_process()); + const bool polyphonic = parent_graph() && (poly == parent_graph()->internal_poly_process()); for (Ports::iterator i = _outputs.begin(); i != _outputs.end(); ++i) i->setup_buffers(bufs, polyphonic ? poly : 1, true); @@ -141,22 +141,22 @@ PatchImpl::apply_internal_poly(ProcessContext& context, return true; } -/** Run the patch for the specified number of frames. +/** Run the graph for the specified number of frames. * - * Calls all Blocks in (roughly, if parallel) the order _compiled_patch specifies. + * Calls all Blocks in (roughly, if parallel) the order _compiled_graph specifies. */ void -PatchImpl::process(ProcessContext& context) +GraphImpl::process(ProcessContext& context) { if (!_process) return; BlockImpl::pre_process(context); - if (_compiled_patch && _compiled_patch->size() > 0) { + if (_compiled_graph && _compiled_graph->size() > 0) { // Run all blocks - for (size_t i = 0; i < _compiled_patch->size(); ++i) { - (*_compiled_patch)[i].block()->process(context); + for (size_t i = 0; i < _compiled_graph->size(); ++i) { + (*_compiled_graph)[i].block()->process(context); } } @@ -164,24 +164,24 @@ PatchImpl::process(ProcessContext& context) } void -PatchImpl::set_buffer_size(Context& context, +GraphImpl::set_buffer_size(Context& context, BufferFactory& bufs, LV2_URID type, uint32_t size) { BlockImpl::set_buffer_size(context, bufs, type, size); - for (size_t i = 0; i < _compiled_patch->size(); ++i) - (*_compiled_patch)[i].block()->set_buffer_size(context, bufs, type, size); + for (size_t i = 0; i < _compiled_graph->size(); ++i) + (*_compiled_graph)[i].block()->set_buffer_size(context, bufs, type, size); } -// Patch specific stuff +// Graph specific stuff /** Add a block. * Preprocessing thread only. */ void -PatchImpl::add_block(BlockImpl& block) +GraphImpl::add_block(BlockImpl& block) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); _blocks.push_front(block); @@ -191,13 +191,13 @@ PatchImpl::add_block(BlockImpl& block) * Preprocessing thread only. */ void -PatchImpl::remove_block(BlockImpl& block) +GraphImpl::remove_block(BlockImpl& block) { _blocks.erase(_blocks.iterator_to(block)); } void -PatchImpl::add_edge(SharedPtr<EdgeImpl> c) +GraphImpl::add_edge(SharedPtr<EdgeImpl> c) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); _edges.insert(make_pair(make_pair(c->tail(), c->head()), c)); @@ -207,7 +207,7 @@ PatchImpl::add_edge(SharedPtr<EdgeImpl> c) * Preprocessing thread only. */ SharedPtr<EdgeImpl> -PatchImpl::remove_edge(const PortImpl* tail, const PortImpl* dst_port) +GraphImpl::remove_edge(const PortImpl* tail, const PortImpl* dst_port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); Edges::iterator i = _edges.find(make_pair(tail, dst_port)); @@ -221,7 +221,7 @@ PatchImpl::remove_edge(const PortImpl* tail, const PortImpl* dst_port) } bool -PatchImpl::has_edge(const PortImpl* tail, const PortImpl* dst_port) const +GraphImpl::has_edge(const PortImpl* tail, const PortImpl* dst_port) const { ThreadManager::assert_thread(THREAD_PRE_PROCESS); Edges::const_iterator i = _edges.find(make_pair(tail, dst_port)); @@ -229,7 +229,7 @@ PatchImpl::has_edge(const PortImpl* tail, const PortImpl* dst_port) const } uint32_t -PatchImpl::num_ports_non_rt() const +GraphImpl::num_ports_non_rt() const { ThreadManager::assert_not_thread(THREAD_PROCESS); return _inputs.size() + _outputs.size(); @@ -238,7 +238,7 @@ PatchImpl::num_ports_non_rt() const /** Create a port. Not realtime safe. */ DuplexPort* -PatchImpl::create_port(BufferFactory& bufs, +GraphImpl::create_port(BufferFactory& bufs, const Raul::Symbol& symbol, PortType type, LV2_URID buffer_type, @@ -268,7 +268,7 @@ PatchImpl::create_port(BufferFactory& bufs, * Realtime safe. Preprocessing thread only. */ void -PatchImpl::remove_port(DuplexPort& port) +GraphImpl::remove_port(DuplexPort& port) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); @@ -287,7 +287,7 @@ PatchImpl::remove_port(DuplexPort& port) * Realtime safe. Preprocessing thread only. */ void -PatchImpl::clear_ports() +GraphImpl::clear_ports() { ThreadManager::assert_thread(THREAD_PRE_PROCESS); @@ -296,7 +296,7 @@ PatchImpl::clear_ports() } Raul::Array<PortImpl*>* -PatchImpl::build_ports_array() +GraphImpl::build_ports_array() { ThreadManager::assert_thread(THREAD_PRE_PROCESS); @@ -317,7 +317,7 @@ PatchImpl::build_ports_array() } static inline void -compile_recursive(BlockImpl* n, CompiledPatch* output) +compile_recursive(BlockImpl* n, CompiledGraph* output) { if (n == NULL || n->traversed()) return; @@ -333,9 +333,9 @@ compile_recursive(BlockImpl* n, CompiledPatch* output) output->push_back(CompiledBlock(n, n->providers().size(), n->dependants())); } -/** Find the process order for this Patch. +/** Find the process order for this Graph. * - * The process order is a flat list that the patch will execute in order + * The process order is a flat list that the graph will execute in order * when its run() method is called. Return value is a newly allocated list * which the caller is reponsible to delete. Note that this function does * NOT actually set the process order, it is returned so it can be inserted @@ -343,12 +343,12 @@ compile_recursive(BlockImpl* n, CompiledPatch* output) * * Not realtime safe. */ -CompiledPatch* -PatchImpl::compile() +CompiledGraph* +GraphImpl::compile() { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - CompiledPatch* const compiled_patch = new CompiledPatch(); + CompiledGraph* const compiled_graph = new CompiledGraph(); for (Blocks::iterator i = _blocks.begin(); i != _blocks.end(); ++i) { i->traversed(false); @@ -357,24 +357,24 @@ PatchImpl::compile() for (Blocks::iterator i = _blocks.begin(); i != _blocks.end(); ++i) { // Either a sink or connected to our output ports: if (!i->traversed() && i->dependants().empty()) { - compile_recursive(&*i, compiled_patch); + compile_recursive(&*i, compiled_graph); } } // Traverse any blocks we didn't hit yet for (Blocks::iterator i = _blocks.begin(); i != _blocks.end(); ++i) { if (!i->traversed()) { - compile_recursive(&*i, compiled_patch); + compile_recursive(&*i, compiled_graph); } } - if (compiled_patch->size() != _blocks.size()) { - _engine.log().error(Raul::fmt("Failed to compile patch %1%\n") % _path); - delete compiled_patch; + if (compiled_graph->size() != _blocks.size()) { + _engine.log().error(Raul::fmt("Failed to compile graph %1%\n") % _path); + delete compiled_graph; return NULL; } - return compiled_patch; + return compiled_graph; } } // namespace Server diff --git a/src/server/PatchImpl.hpp b/src/server/GraphImpl.hpp index fa212b1a..1eb0945e 100644 --- a/src/server/PatchImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -14,13 +14,13 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_ENGINE_PATCHIMPL_HPP -#define INGEN_ENGINE_PATCHIMPL_HPP +#ifndef INGEN_ENGINE_GRAPHIMPL_HPP +#define INGEN_ENGINE_GRAPHIMPL_HPP #include <cstdlib> #include "BlockImpl.hpp" -#include "CompiledPatch.hpp" +#include "CompiledGraph.hpp" #include "DuplexPort.hpp" #include "PluginImpl.hpp" #include "PortType.hpp" @@ -32,33 +32,33 @@ class Edge; namespace Server { -class CompiledPatch; -class EdgeImpl; +class CompiledGraph; class Context; +class EdgeImpl; class Engine; class ProcessContext; /** A group of blocks in a graph, possibly polyphonic. * * Note that this is also a Block, just one which contains Blocks. - * Therefore infinite subpatching is possible, of polyphonic - * patches of polyphonic blocks etc. etc. + * Therefore infinite subgraphing is possible, of polyphonic + * graphes of polyphonic blocks etc. etc. * * \ingroup engine */ -class PatchImpl : public BlockImpl +class GraphImpl : public BlockImpl { public: - PatchImpl(Engine& engine, + GraphImpl(Engine& engine, const Raul::Symbol& symbol, uint32_t poly, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate, uint32_t local_poly); - virtual ~PatchImpl(); + virtual ~GraphImpl(); - virtual GraphType graph_type() const { return PATCH; } + virtual GraphType graph_type() const { return GRAPH; } void activate(BufferFactory& bufs); void deactivate(); @@ -91,7 +91,7 @@ public: Raul::Maid& maid, uint32_t poly); - // Patch specific stuff not inherited from Block + // Graph specific stuff not inherited from Block typedef boost::intrusive::slist< BlockImpl, boost::intrusive::constant_time_size<true> > Blocks; @@ -135,16 +135,16 @@ public: bool has_edge(const PortImpl* tail, const PortImpl* head) const; - CompiledPatch* compiled_patch() { return _compiled_patch; } - void compiled_patch(CompiledPatch* cp) { _compiled_patch = cp; } + CompiledGraph* compiled_graph() { return _compiled_graph; } + void compiled_graph(CompiledGraph* cp) { _compiled_graph = cp; } Raul::Array<PortImpl*>* external_ports() { return _ports; } void external_ports(Raul::Array<PortImpl*>* pa) { _ports = pa; } - CompiledPatch* compile(); + CompiledGraph* compile(); Raul::Array<PortImpl*>* build_ports_array(); - /** Whether to run this patch's DSP bits in the audio thread */ + /** Whether to run this graph's DSP bits in the audio thread */ bool enabled() const { return _process; } void enable() { _process = true; } void disable(ProcessContext& context); @@ -158,7 +158,7 @@ private: Engine& _engine; uint32_t _poly_pre; ///< Pre-process thread only uint32_t _poly_process; ///< Process thread only - CompiledPatch* _compiled_patch; ///< Process thread only + CompiledGraph* _compiled_graph; ///< Process thread only Ports _inputs; ///< Pre-process thread only Ports _outputs; ///< Pre-process thread only Blocks _blocks; ///< Pre-process thread only @@ -168,4 +168,4 @@ private: } // namespace Server } // namespace Ingen -#endif // INGEN_ENGINE_PATCHIMPL_HPP +#endif // INGEN_ENGINE_GRAPHIMPL_HPP diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp index d5608b0f..2df7943f 100644 --- a/src/server/GraphObjectImpl.cpp +++ b/src/server/GraphObjectImpl.cpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include "GraphImpl.hpp" #include "GraphObjectImpl.hpp" -#include "PatchImpl.hpp" #include "ThreadManager.hpp" using namespace std; @@ -42,10 +42,10 @@ GraphObjectImpl::get_property(const Raul::URI& key) const return (i != properties().end()) ? i->second : null_atom; } -PatchImpl* -GraphObjectImpl::parent_patch() const +GraphImpl* +GraphObjectImpl::parent_graph() const { - return dynamic_cast<PatchImpl*>((BlockImpl*)_parent); + return dynamic_cast<GraphImpl*>((BlockImpl*)_parent); } } // namespace Server diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp index 5388981f..07a59727 100644 --- a/src/server/GraphObjectImpl.hpp +++ b/src/server/GraphObjectImpl.hpp @@ -35,12 +35,12 @@ namespace Shared { class URIs; } namespace Server { -class PatchImpl; +class BufferFactory; class Context; +class GraphImpl; class ProcessContext; -class BufferFactory; -/** An object on the audio graph (a Patch, Block, or Port). +/** An object on the audio graph (a Graph, Block, or Port). * * Each of these is a Raul::Deletable and so can be deleted in a realtime safe * way from anywhere, and they all have a map of variable for clients to store @@ -70,8 +70,8 @@ public: const Raul::Atom& get_property(const Raul::URI& key) const; - /** The Patch this object is a child of. */ - virtual PatchImpl* parent_patch() const; + /** The Graph this object is a child of. */ + virtual GraphImpl* parent_graph() const; const Raul::Path& path() const { return _path; } diff --git a/src/server/PatchPlugin.hpp b/src/server/GraphPlugin.hpp index 1fd9069f..3b1e9bfa 100644 --- a/src/server/PatchPlugin.hpp +++ b/src/server/GraphPlugin.hpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_ENGINE_PATCHPLUGIN_HPP -#define INGEN_ENGINE_PATCHPLUGIN_HPP +#ifndef INGEN_ENGINE_GRAPHPLUGIN_HPP +#define INGEN_ENGINE_GRAPHPLUGIN_HPP #include <string> #include "PluginImpl.hpp" @@ -25,31 +25,31 @@ namespace Server { class BlockImpl; -/** Implementation of a Patch plugin. +/** Implementation of a Graph plugin. * - * Patches don't actually work like this yet... + * Graphs don't actually work like this yet... */ -class PatchPlugin : public PluginImpl +class GraphPlugin : public PluginImpl { public: - PatchPlugin(URIs& uris, + GraphPlugin(URIs& uris, const Raul::URI& uri, const Raul::Symbol& symbol, const std::string& name) - : PluginImpl(uris, Plugin::Patch, uri) + : PluginImpl(uris, Plugin::Graph, uri) {} BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, Engine& engine) { return NULL; } - const Raul::Symbol symbol() const { return Raul::Symbol("patch"); } - const std::string name() const { return "Ingen Patch"; } + const Raul::Symbol symbol() const { return Raul::Symbol("graph"); } + const std::string name() const { return "Ingen Graph"; } private: const std::string _symbol; @@ -59,5 +59,5 @@ private: } // namespace Server } // namespace Ingen -#endif // INGEN_ENGINE_PATCHPLUGIN_HPP +#endif // INGEN_ENGINE_GRAPHPLUGIN_HPP diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index fff29f30..e2f97896 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -25,9 +25,9 @@ #include "BufferFactory.hpp" #include "EdgeImpl.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "ProcessContext.hpp" #include "mix.hpp" @@ -50,7 +50,7 @@ InputPort::InputPort(BufferFactory& bufs, { const Ingen::URIs& uris = bufs.uris(); - if (parent->graph_type() != GraphObject::PATCH) { + if (parent->graph_type() != GraphObject::GRAPH) { add_property(uris.rdf_type, uris.lv2_InputPort); } @@ -159,7 +159,7 @@ InputPort::remove_edge(ProcessContext& context, const OutputPort* tail) uint32_t InputPort::max_tail_poly(Context& context) const { - return parent_block()->parent_patch()->internal_poly_process(); + return parent_block()->parent_graph()->internal_poly_process(); } static void diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index 40650415..7a4c7669 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -36,7 +36,7 @@ class BlockImpl; class OutputPort; class ProcessContext; -/** An input port on a Block or Patch. +/** An input port on a Block or Graph. * * All ports have a Buffer, but the actual contents (data) of that buffer may be * set directly to the incoming edge's buffer if there's only one inbound diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index 0e15fd9d..39e32580 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -46,7 +46,7 @@ BlockImpl* InternalPlugin::instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, Engine& engine) { assert(_type == Internal); diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp index 29753c69..5bd842dd 100644 --- a/src/server/InternalPlugin.hpp +++ b/src/server/InternalPlugin.hpp @@ -44,7 +44,7 @@ public: BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, Engine& engine); const Raul::Symbol symbol() const { return _symbol; } diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index b950c350..5f1ba1d3 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -35,8 +35,8 @@ #include "Buffer.hpp" #include "DuplexPort.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "JackDriver.hpp" -#include "PatchImpl.hpp" #include "PortImpl.hpp" #include "ThreadManager.hpp" #include "util.hpp" @@ -182,7 +182,7 @@ EnginePort* JackDriver::get_port(const Raul::Path& path) { for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { - if (i->patch_port()->path() == path) { + if (i->graph_port()->path() == path) { return &*i; } } @@ -207,10 +207,10 @@ JackDriver::register_port(EnginePort& port) { jack_port_t* jack_port = jack_port_register( _client, - port.patch_port()->path().substr(1).c_str(), - (port.patch_port()->is_a(PortType::AUDIO) + port.graph_port()->path().substr(1).c_str(), + (port.graph_port()->is_a(PortType::AUDIO) ? JACK_DEFAULT_AUDIO_TYPE : JACK_DEFAULT_MIDI_TYPE), - (port.patch_port()->is_input() + (port.graph_port()->is_input() ? JackPortIsInput : JackPortIsOutput), 0); @@ -241,16 +241,16 @@ JackDriver::rename_port(const Raul::Path& old_path, } EnginePort* -JackDriver::create_port(DuplexPort* patch_port) +JackDriver::create_port(DuplexPort* graph_port) { - if (patch_port && - (patch_port->is_a(PortType::AUDIO) || - (patch_port->is_a(PortType::ATOM) && - patch_port->buffer_type() == _engine.world()->uris().atom_Sequence))) { - EnginePort* eport = new EnginePort(patch_port); + if (graph_port && + (graph_port->is_a(PortType::AUDIO) || + (graph_port->is_a(PortType::ATOM) && + graph_port->buffer_type() == _engine.world()->uris().atom_Sequence))) { + EnginePort* eport = new EnginePort(graph_port); register_port(*eport); - patch_port->setup_buffers(*_engine.buffer_factory(), - patch_port->poly(), + graph_port->setup_buffers(*_engine.buffer_factory(), + graph_port->poly(), false); return eport; } else { @@ -263,33 +263,33 @@ JackDriver::pre_process_port(ProcessContext& context, EnginePort* port) { const SampleCount nframes = context.nframes(); jack_port_t* jack_port = (jack_port_t*)port->handle(); - PortImpl* patch_port = port->patch_port(); + PortImpl* graph_port = port->graph_port(); void* buffer = jack_port_get_buffer(jack_port, nframes); port->set_buffer(buffer); - if (!patch_port->is_input()) { - patch_port->buffer(0)->clear(); + if (!graph_port->is_input()) { + graph_port->buffer(0)->clear(); return; } - if (patch_port->is_a(PortType::AUDIO)) { - Buffer* patch_buf = patch_port->buffer(0).get(); - memcpy(patch_buf->samples(), buffer, nframes * sizeof(float)); + if (graph_port->is_a(PortType::AUDIO)) { + Buffer* graph_buf = graph_port->buffer(0).get(); + memcpy(graph_buf->samples(), buffer, nframes * sizeof(float)); - } else if (patch_port->buffer_type() == patch_port->bufs().uris().atom_Sequence) { - Buffer* patch_buf = (Buffer*)patch_port->buffer(0).get(); + } else if (graph_port->buffer_type() == graph_port->bufs().uris().atom_Sequence) { + Buffer* graph_buf = (Buffer*)graph_port->buffer(0).get(); const jack_nframes_t event_count = jack_midi_get_event_count(buffer); - patch_buf->prepare_write(context); + graph_buf->prepare_write(context); - // Copy events from Jack port buffer into patch port buffer + // Copy events from Jack port buffer into graph port buffer for (jack_nframes_t i = 0; i < event_count; ++i) { jack_midi_event_t ev; jack_midi_event_get(&ev, buffer, i); - if (!patch_buf->append_event( + if (!graph_buf->append_event( ev.time, ev.size, _midi_event_type, ev.buffer)) { _engine.log().warn("Failed to write to MIDI buffer, events lost!\n"); } @@ -302,10 +302,10 @@ JackDriver::post_process_port(ProcessContext& context, EnginePort* port) { const SampleCount nframes = context.nframes(); jack_port_t* jack_port = (jack_port_t*)port->handle(); - PortImpl* patch_port = port->patch_port(); + PortImpl* graph_port = port->graph_port(); void* buffer = port->buffer(); - if (patch_port->is_input()) { + if (graph_port->is_input()) { return; } @@ -315,16 +315,16 @@ JackDriver::post_process_port(ProcessContext& context, EnginePort* port) port->set_buffer(buffer); } - patch_port->post_process(context); - Buffer* const patch_buf = patch_port->buffer(0).get(); - if (patch_port->is_a(PortType::AUDIO)) { - memcpy(buffer, patch_buf->samples(), nframes * sizeof(Sample)); - } else if (patch_port->buffer_type() == patch_port->bufs().uris().atom_Sequence) { + graph_port->post_process(context); + Buffer* const graph_buf = graph_port->buffer(0).get(); + if (graph_port->is_a(PortType::AUDIO)) { + memcpy(buffer, graph_buf->samples(), nframes * sizeof(Sample)); + } else if (graph_port->buffer_type() == graph_port->bufs().uris().atom_Sequence) { jack_midi_clear_buffer(buffer); - LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)patch_buf->atom(); + LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)graph_buf->atom(); LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { const uint8_t* buf = (const uint8_t*)LV2_ATOM_BODY(&ev->body); - if (ev->body.type == patch_port->bufs().uris().midi_MidiEvent) { + if (ev->body.type == graph_port->bufs().uris().midi_MidiEvent) { jack_midi_event_write(buffer, ev->time.frames, buf, ev->body.size); } } @@ -388,9 +388,9 @@ JackDriver::_shutdown_cb() int JackDriver::_block_length_cb(jack_nframes_t nframes) { - if (_engine.root_patch()) { + if (_engine.root_graph()) { _block_length = nframes; - _engine.root_patch()->set_buffer_size( + _engine.root_graph()->set_buffer_size( _engine.process_context(), *_engine.buffer_factory(), PortType::AUDIO, _engine.buffer_factory()->audio_buffer_size(nframes)); } @@ -409,7 +409,7 @@ JackDriver::_session_cb(jack_session_event_t* event) SharedPtr<Serialisation::Serialiser> serialiser = _engine.world()->serialiser(); if (serialiser) { - SharedPtr<GraphObject> root(_engine.root_patch(), NullDeleter<GraphObject>); + SharedPtr<GraphObject> root(_engine.root_graph(), NullDeleter<GraphObject>); serialiser->write_bundle(root, string("file://") + event->session_dir); } diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index c9bda939..8ea84fd6 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -38,16 +38,16 @@ namespace Raul { class Path; } namespace Ingen { namespace Server { -class Engine; -class PatchImpl; -class PortImpl; class DuplexPort; +class Engine; +class GraphImpl; class JackDriver; +class PortImpl; /** The Jack Driver. * * The process callback here drives the entire audio thread by "pulling" - * events from queues, processing them, running the patches, and passing + * events from queues, processing them, running the graphes, and passing * events along to the PostProcessor. * * \ingroup engine @@ -67,7 +67,7 @@ public: void enable(); void disable(); - EnginePort* create_port(DuplexPort* patch_port); + EnginePort* create_port(DuplexPort* graph_port); EnginePort* get_port(const Raul::Path& path); void rename_port(const Raul::Path& old_path, const Raul::Path& new_path); diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index d26f7417..e121f270 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -32,11 +32,11 @@ #include "Buffer.hpp" #include "Driver.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "LV2Block.hpp" #include "LV2Plugin.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "ProcessContext.hpp" using namespace std; @@ -52,7 +52,7 @@ namespace Server { LV2Block::LV2Block(LV2Plugin* plugin, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate) : BlockImpl(plugin, symbol, polyphonic, parent, srate) , _lv2_plugin(plugin) @@ -78,7 +78,7 @@ LV2Block::make_instance(URIs& uris, _lv2_plugin->lilv_plugin(), rate, _features->array()); if (!inst) { - parent_patch()->engine().log().error( + parent_graph()->engine().log().error( Raul::fmt("Failed to instantiate <%1%>\n") % _lv2_plugin->uri().c_str()); return SharedPtr<LilvInstance>(); @@ -119,7 +119,7 @@ LV2Block::make_instance(URIs& uris, } else if (type == _uris.lv2_CVPort) { port->set_type(PortType::CV, 0); } else { - parent_patch()->engine().log().error( + parent_graph()->engine().log().error( Raul::fmt("%1% auto-morphed to unknown type %2%\n") % port->path().c_str() % type); return SharedPtr<LilvInstance>(); @@ -304,7 +304,7 @@ LV2Block::instantiate(BufferFactory& bufs) } if (port_type == PortType::UNKNOWN || direction == UNKNOWN) { - parent_patch()->engine().log().error( + parent_graph()->engine().log().error( Raul::fmt("<%1%> port %2% has unknown type or direction\n") % _lv2_plugin->uri().c_str() % port_sym.c_str()); ret = false; @@ -422,7 +422,7 @@ LV2Block::work(uint32_t size, const void* data) if (_worker_iface) { LV2_Handle inst = lilv_instance_get_handle(instance(0)); if (_worker_iface->work(inst, work_respond, this, size, data)) { - parent_patch()->engine().log().error( + parent_graph()->engine().log().error( Raul::fmt("Error calling %1% work method\n") % _path); } } diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 3746b201..2e45d350 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -39,10 +39,10 @@ class LV2Block : public BlockImpl { public: LV2Block(LV2Plugin* plugin, - const Raul::Symbol& symbol, - bool polyphonic, - PatchImpl* parent, - SampleRate srate); + const Raul::Symbol& symbol, + bool polyphonic, + GraphImpl* parent, + SampleRate srate); ~LV2Block(); diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 0febfc7d..cc0aee4c 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -60,7 +60,7 @@ BlockImpl* LV2Plugin::instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, Engine& engine) { LV2Block* b = new LV2Block( diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index ed26b4ae..bec1b588 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -29,7 +29,7 @@ namespace Ingen { namespace Server { -class PatchImpl; +class GraphImpl; class BlockImpl; /** Implementation of an LV2 plugin (loaded shared library). @@ -42,7 +42,7 @@ public: BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, Engine& engine); const Raul::Symbol symbol() const; diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index 1fa53451..48f7eb22 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -38,7 +38,7 @@ OutputPort::OutputPort(BufferFactory& bufs, size_t buffer_size) : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) { - if (parent->graph_type() != GraphObject::PATCH) { + if (parent->graph_type() != GraphObject::GRAPH) { add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort); } diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp index 624b3f6d..342225ef 100644 --- a/src/server/PluginImpl.hpp +++ b/src/server/PluginImpl.hpp @@ -35,7 +35,7 @@ namespace Server { class BlockImpl; class BufferFactory; class Engine; -class PatchImpl; +class GraphImpl; /** Implementation of a plugin (internal code, or a loaded shared library). * @@ -55,8 +55,8 @@ public: virtual BlockImpl* instantiate(BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, - Engine& engine) = 0; + GraphImpl* parent, + Engine& engine) = 0; virtual const Raul::Symbol symbol() const = 0; diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 6a39cba8..9fbc4825 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -20,8 +20,8 @@ #include "Driver.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "LV2Block.hpp" -#include "PatchImpl.hpp" #include "Worker.hpp" namespace Ingen { @@ -40,7 +40,7 @@ schedule(LV2_Worker_Schedule_Handle handle, const void* data) { LV2Block* block = (LV2Block*)handle; - Engine& engine = block->parent_patch()->engine(); + Engine& engine = block->parent_graph()->engine(); Worker* worker = engine.worker(); return worker->request(block, size, data); @@ -51,7 +51,7 @@ Worker::request(LV2Block* block, uint32_t size, const void* data) { - Engine& engine = block->parent_patch()->engine(); + Engine& engine = block->parent_graph()->engine(); if (_requests.write_space() < sizeof(MessageHeader) + size) { engine.log().error("Work request ring overflow\n"); return LV2_WORKER_ERR_NO_SPACE; diff --git a/src/server/events.hpp b/src/server/events.hpp index 95f3d35f..24ac8593 100644 --- a/src/server/events.hpp +++ b/src/server/events.hpp @@ -19,7 +19,7 @@ #include "events/Connect.hpp" #include "events/CreateBlock.hpp" -#include "events/CreatePatch.hpp" +#include "events/CreateGraph.hpp" #include "events/CreatePort.hpp" #include "events/Delete.hpp" #include "events/Delta.hpp" diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index db8e044f..eeaa1904 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -24,9 +24,9 @@ #include "Connect.hpp" #include "EdgeImpl.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "PortImpl.hpp" #include "types.hpp" @@ -43,9 +43,9 @@ Connect::Connect(Engine& engine, : Event(engine, client, id, timestamp) , _tail_path(tail_path) , _head_path(head_path) - , _patch(NULL) + , _graph(NULL) , _head(NULL) - , _compiled_patch(NULL) + , _compiled_graph(NULL) , _buffers(NULL) {} @@ -86,23 +86,23 @@ Connect::pre_process() return Event::pre_process_done(TYPE_MISMATCH, _head_path); } - if (tail_block->parent_patch() != head_block->parent_patch()) { - // Edge to a patch port from inside the patch + if (tail_block->parent_graph() != head_block->parent_graph()) { + // Edge to a graph port from inside the graph assert(tail_block->parent() == head_block || head_block->parent() == tail_block); if (tail_block->parent() == head_block) { - _patch = dynamic_cast<PatchImpl*>(head_block); + _graph = dynamic_cast<GraphImpl*>(head_block); } else { - _patch = dynamic_cast<PatchImpl*>(tail_block); + _graph = dynamic_cast<GraphImpl*>(tail_block); } - } else if (tail_block == head_block && dynamic_cast<PatchImpl*>(tail_block)) { - // Edge from a patch input to a patch output (pass through) - _patch = dynamic_cast<PatchImpl*>(tail_block); + } else if (tail_block == head_block && dynamic_cast<GraphImpl*>(tail_block)) { + // Edge from a graph input to a graph output (pass through) + _graph = dynamic_cast<GraphImpl*>(tail_block); } else { // Normal edge between blocks with the same parent - _patch = tail_block->parent_patch(); + _graph = tail_block->parent_graph(); } - if (_patch->has_edge(tail_output, _head)) { + if (_graph->has_edge(tail_output, _head)) { return Event::pre_process_done(EXISTS, _head_path); } @@ -113,8 +113,8 @@ Connect::pre_process() { Glib::RWLock::ReaderLock wlock(_engine.store()->lock()); - /* Need to be careful about patch port edges here and adding a - block's parent as a dependant/provider, or adding a patch as its own + /* Need to be careful about graph port edges here and adding a + block's parent as a dependant/provider, or adding a graph as its own provider... */ if (tail_block != head_block && tail_block->parent() == head_block->parent()) { @@ -122,7 +122,7 @@ Connect::pre_process() tail_block->dependants().push_back(head_block); } - _patch->add_edge(_edge); + _graph->add_edge(_edge); _head->increment_num_edges(); } @@ -132,8 +132,8 @@ Connect::pre_process() _head->poly(), false); - if (_patch->enabled()) { - _compiled_patch = _patch->compile(); + if (_graph->enabled()) { + _compiled_graph = _graph->compile(); } return Event::pre_process_done(SUCCESS); @@ -146,8 +146,8 @@ Connect::execute(ProcessContext& context) _head->add_edge(context, _edge.get()); _engine.maid()->dispose(_head->set_buffers(context, _buffers)); _head->connect_buffers(); - _engine.maid()->dispose(_patch->compiled_patch()); - _patch->compiled_patch(_compiled_patch); + _engine.maid()->dispose(_graph->compiled_graph()); + _graph->compiled_graph(_compiled_graph); } } diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 8d75d2da..445ee80e 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -30,11 +30,11 @@ template <typename T> class Array; namespace Ingen { namespace Server { -class CompiledPatch; +class CompiledGraph; class EdgeImpl; class InputPort; class OutputPort; -class PatchImpl; +class GraphImpl; namespace Events { @@ -59,9 +59,9 @@ public: private: const Raul::Path _tail_path; const Raul::Path _head_path; - PatchImpl* _patch; + GraphImpl* _graph; InputPort* _head; - CompiledPatch* _compiled_patch; + CompiledGraph* _compiled_graph; SharedPtr<EdgeImpl> _edge; Raul::Array<BufferRef>* _buffers; }; diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 73ff7ba2..bc234b97 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -24,7 +24,7 @@ #include "Broadcaster.hpp" #include "CreateBlock.hpp" #include "Engine.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" @@ -41,9 +41,9 @@ CreateBlock::CreateBlock(Engine& engine, : Event(engine, client, id, timestamp) , _path(path) , _properties(properties) - , _patch(NULL) + , _graph(NULL) , _block(NULL) - , _compiled_patch(NULL) + , _compiled_graph(NULL) {} bool @@ -69,8 +69,8 @@ CreateBlock::pre_process() return Event::pre_process_done(EXISTS, _path); } - _patch = dynamic_cast<PatchImpl*>(_engine.store()->get(_path.parent())); - if (!_patch) { + _graph = dynamic_cast<GraphImpl*>(_engine.store()->get(_path.parent())); + if (!_graph) { return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } @@ -89,7 +89,7 @@ CreateBlock::pre_process() if (!(_block = plugin->instantiate(*_engine.buffer_factory(), Raul::Symbol(_path.symbol()), polyphonic, - _patch, + _graph, _engine))) { return Event::pre_process_done(CREATION_FAILED, _path); } @@ -97,15 +97,15 @@ CreateBlock::pre_process() _block->properties().insert(_properties.begin(), _properties.end()); _block->activate(*_engine.buffer_factory()); - // Add block to the store and the patch's pre-processor only block list - _patch->add_block(*_block); + // Add block to the store and the graph's pre-processor only block list + _graph->add_block(*_block); _engine.store()->add(_block); - /* Compile patch with new block added for insertion in audio thread + /* Compile graph with new block added for insertion in audio thread TODO: Since the block is not connected at this point, a full compilation could be avoided and the block simply appended. */ - if (_patch->enabled()) { - _compiled_patch = _patch->compile(); + if (_graph->enabled()) { + _compiled_graph = _graph->compile(); } _update.push_back(make_pair(_block->uri(), _block->properties())); @@ -124,8 +124,8 @@ void CreateBlock::execute(ProcessContext& context) { if (_block) { - _engine.maid()->dispose(_patch->compiled_patch()); - _patch->compiled_patch(_compiled_patch); + _engine.maid()->dispose(_graph->compiled_graph()); + _graph->compiled_graph(_compiled_graph); } } diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index ea3c4b5c..da444b1f 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -28,12 +28,12 @@ namespace Ingen { namespace Server { class BlockImpl; -class CompiledPatch; -class PatchImpl; +class CompiledGraph; +class GraphImpl; namespace Events { -/** An event to load a Block and insert it into a Patch. +/** An event to load a Block and insert it into a Graph. * * \ingroup engine */ @@ -58,9 +58,9 @@ private: Raul::Path _path; Resource::Properties _properties; Update _update; - PatchImpl* _patch; + GraphImpl* _graph; BlockImpl* _block; - CompiledPatch* _compiled_patch; + CompiledGraph* _compiled_graph; }; } // namespace Events diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreateGraph.cpp index e9adc547..bfe08043 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreateGraph.cpp @@ -19,17 +19,17 @@ #include "raul/Maid.hpp" #include "raul/Path.hpp" -#include "events/CreatePatch.hpp" #include "Broadcaster.hpp" #include "Driver.hpp" #include "Engine.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" +#include "events/CreateGraph.hpp" namespace Ingen { namespace Server { namespace Events { -CreatePatch::CreatePatch(Engine& engine, +CreateGraph::CreateGraph(Engine& engine, SharedPtr<Interface> client, int32_t id, SampleCount timestamp, @@ -38,20 +38,20 @@ CreatePatch::CreatePatch(Engine& engine, : Event(engine, client, id, timestamp) , _path(path) , _properties(properties) - , _patch(NULL) + , _graph(NULL) , _parent(NULL) - , _compiled_patch(NULL) + , _compiled_graph(NULL) { } bool -CreatePatch::pre_process() +CreateGraph::pre_process() { if (_path.is_root() || _engine.store()->get(_path)) { return Event::pre_process_done(EXISTS, _path); } - _parent = dynamic_cast<PatchImpl*>(_engine.store()->get(_path.parent())); + _parent = dynamic_cast<GraphImpl*>(_engine.store()->get(_path.parent())); if (!_parent) { return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } @@ -76,42 +76,42 @@ CreatePatch::pre_process() } const Raul::Symbol symbol((_path.is_root()) ? "root" : _path.symbol()); - _patch = new PatchImpl(_engine, symbol, ext_poly, _parent, + _graph = new GraphImpl(_engine, symbol, ext_poly, _parent, _engine.driver()->sample_rate(), int_poly); - _patch->properties().insert(_properties.begin(), _properties.end()); - _patch->add_property(uris.rdf_type, uris.ingen_Patch); - _patch->add_property(uris.rdf_type, + _graph->properties().insert(_properties.begin(), _properties.end()); + _graph->add_property(uris.rdf_type, uris.ingen_Graph); + _graph->add_property(uris.rdf_type, Resource::Property(uris.ingen_Block, Resource::EXTERNAL)); - _parent->add_block(*_patch); + _parent->add_block(*_graph); if (_parent->enabled()) { - _patch->enable(); - _compiled_patch = _parent->compile(); + _graph->enable(); + _compiled_graph = _parent->compile(); } - _patch->activate(*_engine.buffer_factory()); + _graph->activate(*_engine.buffer_factory()); // Insert into Store - _engine.store()->add(_patch); + _engine.store()->add(_graph); - _update = _patch->properties(); + _update = _graph->properties(); return Event::pre_process_done(SUCCESS); } void -CreatePatch::execute(ProcessContext& context) +CreateGraph::execute(ProcessContext& context) { - if (_patch) { + if (_graph) { assert(_parent); assert(!_path.is_root()); - _engine.maid()->dispose(_parent->compiled_patch()); - _parent->compiled_patch(_compiled_patch); + _engine.maid()->dispose(_parent->compiled_graph()); + _parent->compiled_graph(_compiled_graph); } } void -CreatePatch::post_process() +CreateGraph::post_process() { if (!respond()) { _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreateGraph.hpp index be19d54e..0f6a95dd 100644 --- a/src/server/events/CreatePatch.hpp +++ b/src/server/events/CreateGraph.hpp @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_EVENTS_CREATEPATCH_HPP -#define INGEN_EVENTS_CREATEPATCH_HPP +#ifndef INGEN_EVENTS_CREATEGRAPH_HPP +#define INGEN_EVENTS_CREATEGRAPH_HPP #include "Event.hpp" #include "ingen/Resource.hpp" @@ -23,19 +23,19 @@ namespace Ingen { namespace Server { -class PatchImpl; -class CompiledPatch; +class GraphImpl; +class CompiledGraph; namespace Events { -/** Creates a new Patch. +/** Creates a new Graph. * * \ingroup engine */ -class CreatePatch : public Event +class CreateGraph : public Event { public: - CreatePatch(Engine& engine, + CreateGraph(Engine& engine, SharedPtr<Interface> client, int32_t id, SampleCount timestamp, @@ -50,13 +50,13 @@ private: const Raul::Path _path; Resource::Properties _properties; Resource::Properties _update; - PatchImpl* _patch; - PatchImpl* _parent; - CompiledPatch* _compiled_patch; + GraphImpl* _graph; + GraphImpl* _parent; + CompiledGraph* _compiled_graph; }; } // namespace Events } // namespace Server } // namespace Ingen -#endif // INGEN_EVENTS_CREATEPATCH_HPP +#endif // INGEN_EVENTS_CREATEGRAPH_HPP diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 49ceed95..a32faaee 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -29,7 +29,7 @@ #include "Driver.hpp" #include "DuplexPort.hpp" #include "Engine.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PortImpl.hpp" namespace Ingen { @@ -47,8 +47,8 @@ CreatePort::CreatePort(Engine& engine, , _path(path) , _port_type(PortType::UNKNOWN) , _buf_type(0) - , _patch(NULL) - , _patch_port(NULL) + , _graph(NULL) + , _graph_port(NULL) , _ports_array(NULL) , _old_ports_array(NULL) , _engine_port(NULL) @@ -102,7 +102,7 @@ CreatePort::pre_process() return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } - if (!(_patch = dynamic_cast<PatchImpl*>(parent))) { + if (!(_graph = dynamic_cast<GraphImpl*>(parent))) { return Event::pre_process_done(INVALID_PARENT_PATH, _path.parent()); } @@ -110,7 +110,7 @@ CreatePort::pre_process() const BufferFactory& buffer_factory = *_engine.buffer_factory(); const uint32_t buf_size = buffer_factory.default_size(_buf_type); - const int32_t old_n_ports = _patch->num_ports_non_rt(); + const int32_t old_n_ports = _graph->num_ports_non_rt(); typedef Resource::Properties::const_iterator PropIter; @@ -130,34 +130,34 @@ CreatePort::pre_process() poly_i->second.type() == uris.forge.Bool && poly_i->second.get_bool()); - if (!(_patch_port = _patch->create_port( + if (!(_graph_port = _graph->create_port( *_engine.buffer_factory(), Raul::Symbol(_path.symbol()), _port_type, _buf_type, buf_size, _is_output, polyphonic))) { return Event::pre_process_done(CREATION_FAILED, _path); } - _patch_port->properties().insert(_properties.begin(), _properties.end()); + _graph_port->properties().insert(_properties.begin(), _properties.end()); - _engine.store()->add(_patch_port); + _engine.store()->add(_graph_port); if (_is_output) { - _patch->add_output(*_patch_port); + _graph->add_output(*_graph_port); } else { - _patch->add_input(*_patch_port); + _graph->add_input(*_graph_port); } - if (!_patch->parent()) { + if (!_graph->parent()) { _engine_port = _engine.driver()->create_port( - dynamic_cast<DuplexPort*>(_patch_port)); + dynamic_cast<DuplexPort*>(_graph_port)); } _ports_array = new Raul::Array<PortImpl*>(old_n_ports + 1, NULL); - _update = _patch_port->properties(); + _update = _graph_port->properties(); - assert(_patch_port->index() == (uint32_t)index_i->second.get_int32()); - assert(_patch->num_ports_non_rt() == (uint32_t)old_n_ports + 1); - assert(_patch_port->index() == (uint32_t)old_n_ports); - assert(_ports_array->size() == _patch->num_ports_non_rt()); - assert(_patch_port->index() < _ports_array->size()); + assert(_graph_port->index() == (uint32_t)index_i->second.get_int32()); + assert(_graph->num_ports_non_rt() == (uint32_t)old_n_ports + 1); + assert(_graph_port->index() == (uint32_t)old_n_ports); + assert(_ports_array->size() == _graph->num_ports_non_rt()); + assert(_graph_port->index() < _ports_array->size()); return Event::pre_process_done(SUCCESS); } @@ -165,15 +165,15 @@ void CreatePort::execute(ProcessContext& context) { if (!_status) { - _old_ports_array = _patch->external_ports(); + _old_ports_array = _graph->external_ports(); if (_old_ports_array) { for (uint32_t i = 0; i < _old_ports_array->size(); ++i) { (*_ports_array)[i] = (*_old_ports_array)[i]; } } - assert(!(*_ports_array)[_patch_port->index()]); - (*_ports_array)[_patch_port->index()] = _patch_port; - _patch->external_ports(_ports_array); + assert(!(*_ports_array)[_graph_port->index()]); + (*_ports_array)[_graph_port->index()] = _graph_port; + _graph->external_ports(_ports_array); if (_engine_port) { _engine.driver()->add_port(context, _engine_port); diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index c8e4c695..d35b58af 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -30,12 +30,12 @@ namespace Server { class DuplexPort; class EnginePort; -class PatchImpl; +class GraphImpl; class PortImpl; namespace Events { -/** An event to add a Port to a Patch. +/** An event to add a Port to a Graph. * * \ingroup engine */ @@ -58,9 +58,9 @@ private: Raul::Path _path; PortType _port_type; LV2_URID _buf_type; - PatchImpl* _patch; - DuplexPort* _patch_port; - Raul::Array<PortImpl*>* _ports_array; ///< New external port array for Patch + GraphImpl* _graph; + DuplexPort* _graph_port; + Raul::Array<PortImpl*>* _ports_array; ///< New external port array for Graph Raul::Array<PortImpl*>* _old_ports_array; EnginePort* _engine_port; ///< Driver port if on the root Resource::Properties _properties; diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index dbda331c..a6207ba1 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -26,7 +26,7 @@ #include "Driver.hpp" #include "Engine.hpp" #include "EnginePort.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" @@ -43,7 +43,7 @@ Delete::Delete(Engine& engine, , _uri(uri) , _engine_port(NULL) , _ports_array(NULL) - , _compiled_patch(NULL) + , _compiled_graph(NULL) , _disconnect_event(NULL) , _lock(engine.store()->lock(), Glib::NOT_LOCK) { @@ -81,7 +81,7 @@ Delete::pre_process() return Event::pre_process_done(NOT_DELETABLE, _path); } - PatchImpl* parent = _block ? _block->parent_patch() : _port->parent_patch(); + GraphImpl* parent = _block ? _block->parent_graph() : _port->parent_graph(); if (!parent) { return Event::pre_process_done(INTERNAL_ERROR, _path); } @@ -94,7 +94,7 @@ Delete::pre_process() _disconnect_event->pre_process(); if (parent->enabled()) { - _compiled_patch = parent->compile(); + _compiled_graph = parent->compile(); } } else if (_port) { parent->remove_port(*_port); @@ -102,7 +102,7 @@ Delete::pre_process() _disconnect_event->pre_process(); if (parent->enabled()) { - _compiled_patch = parent->compile(); + _compiled_graph = parent->compile(); _ports_array = parent->build_ports_array(); assert(_ports_array->size() == parent->num_ports_non_rt()); } @@ -122,7 +122,7 @@ Delete::execute(ProcessContext& context) _disconnect_event->execute(context); } - PatchImpl* parent = _block ? _block->parent_patch() : _port->parent_patch(); + GraphImpl* parent = _block ? _block->parent_graph() : _port->parent_graph(); if (_port) { _engine.maid()->dispose(parent->external_ports()); parent->external_ports(_ports_array); @@ -133,8 +133,8 @@ Delete::execute(ProcessContext& context) } if (parent) { - _engine.maid()->dispose(parent->compiled_patch()); - parent->compiled_patch(_compiled_patch); + _engine.maid()->dispose(parent->compiled_graph()); + parent->compiled_graph(_compiled_graph); } } diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index c14c5567..74046f82 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -20,7 +20,7 @@ #include "ingen/Store.hpp" #include "Event.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "ControlBindings.hpp" namespace Raul { @@ -31,7 +31,7 @@ namespace Ingen { namespace Server { class BlockImpl; -class CompiledPatch; +class CompiledGraph; class DuplexPort; class EnginePort; class PortImpl; @@ -75,8 +75,8 @@ private: SharedPtr<BlockImpl> _block; ///< Non-NULL iff a block SharedPtr<DuplexPort> _port; ///< Non-NULL iff a port EnginePort* _engine_port; - Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch - CompiledPatch* _compiled_patch; ///< Patch's new process order + Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Graph + CompiledGraph* _compiled_graph; ///< Graph's new process order DisconnectAll* _disconnect_event; SharedPtr<ControlBindings::Bindings> _removed_bindings; diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 3b31cedb..06bd150c 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -25,11 +25,11 @@ #include "Broadcaster.hpp" #include "ControlBindings.hpp" #include "CreateBlock.hpp" -#include "CreatePatch.hpp" +#include "CreateGraph.hpp" #include "CreatePort.hpp" #include "Delta.hpp" #include "Engine.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" #include "PortType.hpp" @@ -59,8 +59,8 @@ Delta::Delta(Engine& engine, , _properties(properties) , _remove(remove) , _object(NULL) - , _patch(NULL) - , _compiled_patch(NULL) + , _graph(NULL) + , _compiled_graph(NULL) , _context(context) , _create(create) { @@ -122,11 +122,11 @@ Delta::pre_process() if (is_graph_object && !_object) { Raul::Path path(GraphObject::uri_to_path(_subject)); - bool is_patch = false, is_block = false, is_port = false, is_output = false; - Ingen::Resource::type(uris, _properties, is_patch, is_block, is_port, is_output); + bool is_graph = false, is_block = false, is_port = false, is_output = false; + Ingen::Resource::type(uris, _properties, is_graph, is_block, is_port, is_output); - if (is_patch) { - _create_event = new CreatePatch( + if (is_graph) { + _create_event = new CreateGraph( _engine, _request_client, _request_id, _time, path, _properties); } else if (is_block) { _create_event = new CreateBlock( @@ -194,13 +194,13 @@ Delta::pre_process() _status = BAD_OBJECT_TYPE; } } - } else if ((_patch = dynamic_cast<PatchImpl*>(_object))) { + } else if ((_graph = dynamic_cast<GraphImpl*>(_object))) { if (key == uris.ingen_enabled) { if (value.type() == uris.forge.Bool) { op = ENABLE; // FIXME: defer this until all other metadata has been processed - if (value.get_bool() && !_patch->enabled()) - _compiled_patch = _patch->compile(); + if (value.get_bool() && !_graph->enabled()) + _compiled_graph = _graph->compile(); } else { _status = BAD_VALUE_TYPE; } @@ -210,7 +210,7 @@ Delta::pre_process() _status = INVALID_POLY; } else { op = POLYPHONY; - _patch->prepare_internal_poly( + _graph->prepare_internal_poly( *_engine.buffer_factory(), value.get_int32()); } } else { @@ -218,7 +218,7 @@ Delta::pre_process() } } } else if (key == uris.ingen_polyphonic) { - PatchImpl* parent = dynamic_cast<PatchImpl*>(obj->parent()); + GraphImpl* parent = dynamic_cast<GraphImpl*>(obj->parent()); if (parent) { if (value.type() == uris.forge.Bool) { op = POLYPHONIC; @@ -286,17 +286,17 @@ Delta::execute(ProcessContext& context) break; case ENABLE: if (value.get_bool()) { - if (_compiled_patch) { - _engine.maid()->dispose(_patch->compiled_patch()); - _patch->compiled_patch(_compiled_patch); + if (_compiled_graph) { + _engine.maid()->dispose(_graph->compiled_graph()); + _graph->compiled_graph(_compiled_graph); } - _patch->enable(); + _graph->enable(); } else { - _patch->disable(context); + _graph->disable(context); } break; case POLYPHONIC: { - PatchImpl* parent = reinterpret_cast<PatchImpl*>(object->parent()); + GraphImpl* parent = reinterpret_cast<GraphImpl*>(object->parent()); if (value.get_bool()) { object->apply_poly( context, *_engine.maid(), parent->internal_poly_process()); @@ -305,7 +305,7 @@ Delta::execute(ProcessContext& context) } } break; case POLYPHONY: - if (!_patch->apply_internal_poly(context, + if (!_graph->apply_internal_poly(context, *_engine.buffer_factory(), *_engine.maid(), value.get_int32())) { diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index 6bb6508a..c3a28fbb 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -30,9 +30,9 @@ class Resource; namespace Server { -class CompiledPatch; +class CompiledGraph; class Engine; -class PatchImpl; +class GraphImpl; class ProcessContext; namespace Events { @@ -105,8 +105,8 @@ private: Resource::Properties _properties; Resource::Properties _remove; Ingen::Resource* _object; - PatchImpl* _patch; - CompiledPatch* _compiled_patch; + GraphImpl* _graph; + CompiledGraph* _compiled_graph; Resource::Graph _context; ControlBindings::Key _binding; bool _create; diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 9cf2974a..914e3375 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -27,9 +27,9 @@ #include "DuplexPort.hpp" #include "EdgeImpl.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "PortImpl.hpp" #include "ProcessContext.hpp" #include "ThreadManager.hpp" @@ -48,21 +48,21 @@ Disconnect::Disconnect(Engine& engine, : Event(engine, client, id, timestamp) , _tail_path(tail_path) , _head_path(head_path) - , _patch(NULL) + , _graph(NULL) , _impl(NULL) - , _compiled_patch(NULL) + , _compiled_graph(NULL) { } Disconnect::Impl::Impl(Engine& e, - PatchImpl* patch, + GraphImpl* graph, OutputPort* s, InputPort* d) : _engine(e) , _src_output_port(s) , _dst_input_port(d) - , _patch(patch) - , _edge(patch->remove_edge(_src_output_port, _dst_input_port)) + , _graph(graph) + , _edge(graph->remove_edge(_src_output_port, _dst_input_port)) , _buffers(NULL) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); @@ -133,25 +133,25 @@ Disconnect::pre_process() BlockImpl* const src_block = tail->parent_block(); BlockImpl* const dst_block = head->parent_block(); - if (src_block->parent_patch() != dst_block->parent_patch()) { - // Edge to a patch port from inside the patch + if (src_block->parent_graph() != dst_block->parent_graph()) { + // Edge to a graph port from inside the graph assert(src_block->parent() == dst_block || dst_block->parent() == src_block); if (src_block->parent() == dst_block) { - _patch = dynamic_cast<PatchImpl*>(dst_block); + _graph = dynamic_cast<GraphImpl*>(dst_block); } else { - _patch = dynamic_cast<PatchImpl*>(src_block); + _graph = dynamic_cast<GraphImpl*>(src_block); } - } else if (src_block == dst_block && dynamic_cast<PatchImpl*>(src_block)) { - // Edge from a patch input to a patch output (pass through) - _patch = dynamic_cast<PatchImpl*>(src_block); + } else if (src_block == dst_block && dynamic_cast<GraphImpl*>(src_block)) { + // Edge from a graph input to a graph output (pass through) + _graph = dynamic_cast<GraphImpl*>(src_block); } else { // Normal edge between blocks with the same parent - _patch = src_block->parent_patch(); + _graph = src_block->parent_graph(); } - assert(_patch); + assert(_graph); - if (!_patch->has_edge(tail, head)) { + if (!_graph->has_edge(tail, head)) { return Event::pre_process_done(NOT_FOUND, _head_path); } @@ -160,12 +160,12 @@ Disconnect::pre_process() } _impl = new Impl(_engine, - _patch, + _graph, dynamic_cast<OutputPort*>(tail), dynamic_cast<InputPort*>(head)); - if (_patch->enabled()) - _compiled_patch = _patch->compile(); + if (_graph->enabled()) + _compiled_graph = _graph->compile(); return Event::pre_process_done(SUCCESS); } @@ -207,8 +207,8 @@ Disconnect::execute(ProcessContext& context) return; } - _engine.maid()->dispose(_patch->compiled_patch()); - _patch->compiled_patch(_compiled_patch); + _engine.maid()->dispose(_graph->compiled_graph()); + _graph->compiled_graph(_compiled_graph); } } diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index b008025a..feb1d17f 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -18,10 +18,11 @@ #define INGEN_EVENTS_DISCONNECT_HPP #include "raul/Path.hpp" + +#include "BufferFactory.hpp" #include "Event.hpp" +#include "GraphImpl.hpp" #include "types.hpp" -#include "PatchImpl.hpp" -#include "BufferFactory.hpp" namespace Raul { template <typename T> class Array; @@ -30,7 +31,7 @@ template <typename T> class Array; namespace Ingen { namespace Server { -class CompiledPatch; +class CompiledGraph; class InputPort; class OutputPort; class PortImpl; @@ -58,7 +59,7 @@ public: class Impl { public: Impl(Engine& e, - PatchImpl* patch, + GraphImpl* graph, OutputPort* s, InputPort* d); @@ -70,7 +71,7 @@ public: Engine& _engine; OutputPort* _src_output_port; InputPort* _dst_input_port; - PatchImpl* _patch; + GraphImpl* _graph; SharedPtr<EdgeImpl> _edge; Raul::Array<BufferRef>* _buffers; }; @@ -78,9 +79,9 @@ public: private: const Raul::Path _tail_path; const Raul::Path _head_path; - PatchImpl* _patch; + GraphImpl* _graph; Impl* _impl; - CompiledPatch* _compiled_patch; + CompiledGraph* _compiled_graph; }; } // namespace Events diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 4169622d..dbff2ab3 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -28,9 +28,9 @@ #include "Broadcaster.hpp" #include "EdgeImpl.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "PortImpl.hpp" #include "events/Disconnect.hpp" #include "events/DisconnectAll.hpp" @@ -52,7 +52,7 @@ DisconnectAll::DisconnectAll(Engine& engine, , _parent(NULL) , _block(NULL) , _port(NULL) - , _compiled_patch(NULL) + , _compiled_graph(NULL) , _deleting(false) { } @@ -60,7 +60,7 @@ DisconnectAll::DisconnectAll(Engine& engine, /** Internal version for use by other events. */ DisconnectAll::DisconnectAll(Engine& engine, - PatchImpl* parent, + GraphImpl* parent, GraphObject* object) : Event(engine) , _parent_path(parent->path()) @@ -68,7 +68,7 @@ DisconnectAll::DisconnectAll(Engine& engine, , _parent(parent) , _block(dynamic_cast<BlockImpl*>(object)) , _port(dynamic_cast<PortImpl*>(object)) - , _compiled_patch(NULL) + , _compiled_graph(NULL) , _deleting(true) { } @@ -87,7 +87,7 @@ DisconnectAll::pre_process() if (!_deleting) { lock.acquire(); - _parent = dynamic_cast<PatchImpl*>(_engine.store()->get(_parent_path)); + _parent = dynamic_cast<GraphImpl*>(_engine.store()->get(_parent_path)); if (!_parent) { return Event::pre_process_done(PARENT_NOT_FOUND, _parent_path); } @@ -98,8 +98,8 @@ DisconnectAll::pre_process() return Event::pre_process_done(NOT_FOUND, _path); } - if (object->parent_patch() != _parent - && object->parent()->parent_patch() != _parent) { + if (object->parent_graph() != _parent + && object->parent()->parent_graph() != _parent) { return Event::pre_process_done(INVALID_PARENT_PATH, _parent_path); } @@ -138,7 +138,7 @@ DisconnectAll::pre_process() } if (!_deleting && _parent->enabled()) - _compiled_patch = _parent->compile(); + _compiled_graph = _parent->compile(); return Event::pre_process_done(SUCCESS); } @@ -153,8 +153,8 @@ DisconnectAll::execute(ProcessContext& context) } } - _engine.maid()->dispose(_parent->compiled_patch()); - _parent->compiled_patch(_compiled_patch); + _engine.maid()->dispose(_parent->compiled_graph()); + _parent->compiled_graph(_compiled_graph); } void diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index 68ba8ebe..8a785722 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -28,8 +28,8 @@ namespace Ingen { namespace Server { class BlockImpl; -class CompiledPatch; -class PatchImpl; +class CompiledGraph; +class GraphImpl; class PortImpl; namespace Events { @@ -51,7 +51,7 @@ public: const Raul::Path& object); DisconnectAll(Engine& engine, - PatchImpl* parent, + GraphImpl* parent, GraphObject* object); ~DisconnectAll(); @@ -65,11 +65,11 @@ private: Raul::Path _parent_path; Raul::Path _path; - PatchImpl* _parent; + GraphImpl* _parent; BlockImpl* _block; PortImpl* _port; Impls _impls; - CompiledPatch* _compiled_patch; + CompiledGraph* _compiled_graph; bool _deleting; }; diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 24b4daae..c452328e 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -26,7 +26,7 @@ #include "Driver.hpp" #include "Engine.hpp" #include "Get.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" @@ -35,7 +35,7 @@ namespace Server { namespace Events { static void -send_patch(Interface* client, const PatchImpl* patch); +send_graph(Interface* client, const GraphImpl* graph); Get::Get(Engine& engine, SharedPtr<Interface> client, @@ -87,8 +87,8 @@ static void send_block(Interface* client, const BlockImpl* block) { PluginImpl* const plugin = block->plugin_impl(); - if (plugin->type() == Plugin::Patch) { - send_patch(client, (const PatchImpl*)block); + if (plugin->type() == Plugin::Graph) { + send_graph(client, (const GraphImpl*)block); } else { client->put(block->uri(), block->properties()); for (size_t j = 0; j < block->num_ports(); ++j) { @@ -98,30 +98,30 @@ send_block(Interface* client, const BlockImpl* block) } static void -send_patch(Interface* client, const PatchImpl* patch) +send_graph(Interface* client, const GraphImpl* graph) { - client->put(patch->uri(), - patch->properties(Resource::INTERNAL), + client->put(graph->uri(), + graph->properties(Resource::INTERNAL), Resource::INTERNAL); - client->put(patch->uri(), - patch->properties(Resource::EXTERNAL), + client->put(graph->uri(), + graph->properties(Resource::EXTERNAL), Resource::EXTERNAL); // Send blocks - for (PatchImpl::Blocks::const_iterator j = patch->blocks().begin(); - j != patch->blocks().end(); ++j) { + for (GraphImpl::Blocks::const_iterator j = graph->blocks().begin(); + j != graph->blocks().end(); ++j) { send_block(client, &*j); } // Send ports - for (uint32_t i = 0; i < patch->num_ports_non_rt(); ++i) { - send_port(client, patch->port_impl(i)); + for (uint32_t i = 0; i < graph->num_ports_non_rt(); ++i) { + send_port(client, graph->port_impl(i)); } // Send edges - for (PatchImpl::Edges::const_iterator j = patch->edges().begin(); - j != patch->edges().end(); ++j) { + for (GraphImpl::Edges::const_iterator j = graph->edges().begin(); + j != graph->edges().end(); ++j) { client->connect(j->second->tail_path(), j->second->head_path()); } } @@ -142,10 +142,10 @@ Get::post_process() } else if (_object) { _request_client->bundle_begin(); const BlockImpl* block = NULL; - const PatchImpl* patch = NULL; + const GraphImpl* graph = NULL; const PortImpl* port = NULL; - if ((patch = dynamic_cast<const PatchImpl*>(_object))) { - send_patch(_request_client.get(), patch); + if ((graph = dynamic_cast<const GraphImpl*>(_object))) { + send_graph(_request_client.get(), graph); } else if ((block = dynamic_cast<const BlockImpl*>(_object))) { send_block(_request_client.get(), block); } else if ((port = dynamic_cast<const PortImpl*>(_object))) { diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index d5b4d116..58f47e13 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -24,7 +24,7 @@ #include "Driver.hpp" #include "Engine.hpp" #include "EnginePort.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "events/Move.hpp" namespace Ingen { diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 6c38347f..6e30cba6 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -25,7 +25,7 @@ namespace Ingen { namespace Server { -class PatchImpl; +class GraphImpl; class PortImpl; namespace Events { @@ -62,7 +62,7 @@ public: private: const Raul::Path _old_path; const Raul::Path _new_path; - PatchImpl* _parent_patch; + GraphImpl* _parent_graph; }; } // namespace Events diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 5158e441..26f239da 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -49,7 +49,7 @@ #include "Engine.hpp" #include "EnginePort.hpp" #include "EventWriter.hpp" -#include "PatchImpl.hpp" +#include "GraphImpl.hpp" #include "PostProcessor.hpp" #include "ProcessContext.hpp" #include "ThreadManager.hpp" @@ -58,9 +58,9 @@ #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" -/** Record of a patch in this bundle. */ -struct LV2Patch { - LV2Patch(const std::string& u, const std::string& f); +/** Record of a graph in this bundle. */ +struct LV2Graph { + LV2Graph(const std::string& u, const std::string& f); const std::string uri; const std::string filename; @@ -72,9 +72,9 @@ class Lib { public: explicit Lib(const char* bundle_path); - typedef std::vector< SharedPtr<const LV2Patch> > Patches; + typedef std::vector< SharedPtr<const LV2Graph> > Graphes; - Patches patches; + Graphes graphes; }; namespace Ingen { @@ -101,7 +101,7 @@ public: *this) , _from_ui(block_length * sizeof(float)) // FIXME: size , _to_ui(block_length * sizeof(float)) // FIXME: size - , _root_patch(NULL) + , _root_graph(NULL) , _notify_capacity(0) , _block_length(block_length) , _sample_rate(sample_rate) @@ -111,28 +111,28 @@ public: {} void pre_process_port(ProcessContext& context, EnginePort* port) { - PortImpl* patch_port = port->patch_port(); + PortImpl* graph_port = port->graph_port(); void* buffer = port->buffer(); - if (!patch_port->is_input() || !buffer) { + if (!graph_port->is_input() || !buffer) { return; } - Buffer* const patch_buf = patch_port->buffer(0).get(); - if (patch_port->is_a(PortType::AUDIO) || - patch_port->is_a(PortType::CV)) { - memcpy(patch_buf->samples(), + Buffer* const graph_buf = graph_port->buffer(0).get(); + if (graph_port->is_a(PortType::AUDIO) || + graph_port->is_a(PortType::CV)) { + memcpy(graph_buf->samples(), buffer, context.nframes() * sizeof(float)); - } else if (patch_port->is_a(PortType::CONTROL)) { - patch_buf->samples()[0] = ((float*)buffer)[0]; + } else if (graph_port->is_a(PortType::CONTROL)) { + graph_buf->samples()[0] = ((float*)buffer)[0]; } else { LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)buffer; bool enqueued = false; - URIs& uris = patch_port->bufs().uris(); - patch_buf->prepare_write(context); + URIs& uris = graph_port->bufs().uris(); + graph_buf->prepare_write(context); LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { - if (!patch_buf->append_event( + if (!graph_buf->append_event( ev->time.frames, ev->body.size, ev->body.type, (const uint8_t*)LV2_ATOM_BODY(&ev->body))) { _engine.log().warn("Failed to write to buffer, event lost!\n"); @@ -151,27 +151,27 @@ public: } void post_process_port(ProcessContext& context, EnginePort* port) { - PortImpl* patch_port = port->patch_port(); + PortImpl* graph_port = port->graph_port(); void* buffer = port->buffer(); - if (patch_port->is_input() || !buffer) { + if (graph_port->is_input() || !buffer) { return; } - Buffer* patch_buf = patch_port->buffer(0).get(); - if (patch_port->is_a(PortType::AUDIO) || - patch_port->is_a(PortType::CV)) { + Buffer* graph_buf = graph_port->buffer(0).get(); + if (graph_port->is_a(PortType::AUDIO) || + graph_port->is_a(PortType::CV)) { memcpy(buffer, - patch_buf->samples(), + graph_buf->samples(), context.nframes() * sizeof(float)); - } else if (patch_port->is_a(PortType::CONTROL)) { - ((float*)buffer)[0] = patch_buf->samples()[0]; - } else if (patch_port->index() != 1) { + } else if (graph_port->is_a(PortType::CONTROL)) { + ((float*)buffer)[0] = graph_buf->samples()[0]; + } else if (graph_port->index() != 1) { /* Copy Sequence output to LV2 buffer, except notify output which is written by flush_to_ui() (TODO: merge) */ memcpy(buffer, - patch_buf->atom(), - sizeof(LV2_Atom) + patch_buf->atom()->size); + graph_buf->atom(), + sizeof(LV2_Atom) + graph_buf->atom()->size); } } @@ -204,12 +204,12 @@ public: _main_sem.post(); } - virtual void set_root_patch(PatchImpl* patch) { _root_patch = patch; } - virtual PatchImpl* root_patch() { return _root_patch; } + virtual void set_root_graph(GraphImpl* graph) { _root_graph = graph; } + virtual GraphImpl* root_graph() { return _root_graph; } virtual EnginePort* get_port(const Raul::Path& path) { for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) { - if ((*i)->patch_port()->path() == path) { + if ((*i)->graph_port()->path() == path) { return *i; } } @@ -221,7 +221,7 @@ public: * It is only called on initial load. */ virtual void add_port(ProcessContext& context, EnginePort* port) { - const uint32_t index = port->patch_port()->index(); + const uint32_t index = port->graph_port()->index(); if (_ports.size() <= index) { _ports.resize(index + 1); } @@ -241,8 +241,8 @@ public: virtual void rename_port(const Raul::Path& old_path, const Raul::Path& new_path) {} - virtual EnginePort* create_port(DuplexPort* patch_port) { - return new EnginePort(patch_port); + virtual EnginePort* create_port(DuplexPort* graph_port) { + return new EnginePort(graph_port); } /** Called in run thread for events received at control input port. */ @@ -359,7 +359,7 @@ private: AtomWriter _writer; Raul::RingBuffer _from_ui; Raul::RingBuffer _to_ui; - PatchImpl* _root_patch; + GraphImpl* _root_graph; uint32_t _notify_capacity; SampleCount _block_length; SampleCount _sample_rate; @@ -422,13 +422,13 @@ struct IngenPlugin { char** argv; }; -static Lib::Patches -find_patches(const Glib::ustring& manifest_uri) +static Lib::Graphes +find_graphes(const Glib::ustring& manifest_uri) { Sord::World world; const Sord::URI base(world, manifest_uri); const Sord::Node nil; - const Sord::URI ingen_Patch (world, NS_INGEN "Patch"); + const Sord::URI ingen_Graph (world, NS_INGEN "Graph"); const Sord::URI rdf_type (world, NS_RDF "type"); const Sord::URI rdfs_seeAlso(world, NS_RDFS "seeAlso"); @@ -436,22 +436,22 @@ find_patches(const Glib::ustring& manifest_uri) Sord::Model model(world, manifest_uri); model.load_file(env, SERD_TURTLE, manifest_uri); - Lib::Patches patches; - for (Sord::Iter i = model.find(nil, rdf_type, ingen_Patch); !i.end(); ++i) { - const Sord::Node patch = i.get_subject(); - Sord::Iter f = model.find(patch, rdfs_seeAlso, nil); - const std::string patch_uri = patch.to_c_string(); + Lib::Graphes graphes; + for (Sord::Iter i = model.find(nil, rdf_type, ingen_Graph); !i.end(); ++i) { + const Sord::Node graph = i.get_subject(); + Sord::Iter f = model.find(graph, rdfs_seeAlso, nil); + const std::string graph_uri = graph.to_c_string(); if (!f.end()) { const uint8_t* file_uri = f.get_object().to_u_string(); uint8_t* file_path = serd_file_uri_parse(file_uri, NULL); - patches.push_back(boost::shared_ptr<const LV2Patch>( - new LV2Patch(patch_uri, (const char*)file_path))); + graphes.push_back(boost::shared_ptr<const LV2Graph>( + new LV2Graph(graph_uri, (const char*)file_path))); free(file_path); } } serd_env_free(env); - return patches; + return graphes; } static LV2_Handle @@ -482,19 +482,19 @@ ingen_instantiate(const LV2_Descriptor* descriptor, } set_bundle_path(bundle_path); - Lib::Patches patches = find_patches( + Lib::Graphes graphes = find_graphes( Glib::filename_to_uri(Ingen::bundle_file_path("manifest.ttl"))); - const LV2Patch* patch = NULL; - for (Lib::Patches::iterator i = patches.begin(); i != patches.end(); ++i) { + const LV2Graph* graph = NULL; + for (Lib::Graphes::iterator i = graphes.begin(); i != graphes.end(); ++i) { if ((*i)->uri == descriptor->URI) { - patch = (*i).get(); + graph = (*i).get(); break; } } - if (!patch) { - const std::string msg((Raul::fmt("Could not find patch %1%\n") + if (!graph) { + const std::string msg((Raul::fmt("Could not find graph %1%\n") % descriptor->URI).str()); if (log) { log->vprintf(log->handle, @@ -560,14 +560,14 @@ ingen_instantiate(const LV2_Descriptor* descriptor, plugin->world->parser()->parse_file(plugin->world, plugin->world->interface().get(), - patch->filename); + graph->filename); while (engine->pending_events()) { engine->process_events(); engine->post_processor()->process(); } - /* Register client after loading patch so the to-ui ring does not overflow. + /* Register client after loading graph so the to-ui ring does not overflow. Since we are not yet rolling, it won't be drained, causing a deadlock. */ SharedPtr<Interface> client(&driver->writer(), NullDeleter<Interface>); interface->set_respondee(client); @@ -586,7 +586,7 @@ ingen_connect_port(LV2_Handle instance, uint32_t port, void* data) LV2Driver* driver = (LV2Driver*)engine->driver(); if (port < driver->ports().size()) { driver->ports().at(port)->set_buffer(data); - assert(driver->ports().at(port)->patch_port()->index() == port); + assert(driver->ports().at(port)->graph_port()->index() == port); assert(driver->ports().at(port)->buffer() == data); } else { engine->log().error(Raul::fmt("Connect to non-existent port %1%\n") @@ -668,7 +668,7 @@ ingen_save(LV2_Handle instance, LV2_URID atom_Path = plugin->map->map(plugin->map->handle, LV2_ATOM__Path); - char* real_path = make_path->path(make_path->handle, "patch.ttl"); + char* real_path = make_path->path(make_path->handle, "graph.ttl"); char* state_path = map_path->abstract_path(map_path->handle, real_path); Ingen::Store::iterator root = plugin->world->store()->find(Raul::Path("/")); @@ -736,7 +736,7 @@ ingen_extension_data(const char* uri) return NULL; } -LV2Patch::LV2Patch(const std::string& u, const std::string& f) +LV2Graph::LV2Graph(const std::string& u, const std::string& f) : uri(u) , filename(f) { @@ -753,7 +753,7 @@ LV2Patch::LV2Patch(const std::string& u, const std::string& f) Lib::Lib(const char* bundle_path) { Ingen::set_bundle_path(bundle_path); - patches = find_patches( + graphes = find_graphes( Glib::filename_to_uri(Ingen::bundle_file_path("manifest.ttl"))); } @@ -768,7 +768,7 @@ static const LV2_Descriptor* lib_get_plugin(LV2_Lib_Handle handle, uint32_t index) { Lib* lib = (Lib*)handle; - return index < lib->patches.size() ? &lib->patches[index]->descriptor : NULL; + return index < lib->graphes.size() ? &lib->graphes[index]->descriptor : NULL; } /** LV2 plugin library entry point */ diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 0e8d125e..f38545d3 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -45,7 +45,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate) : BlockImpl(plugin, symbol, false, parent, srate) , _learning(false) diff --git a/src/server/internals/Controller.hpp b/src/server/internals/Controller.hpp index 23401826..6cb78397 100644 --- a/src/server/internals/Controller.hpp +++ b/src/server/internals/Controller.hpp @@ -42,7 +42,7 @@ public: BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate); void process(ProcessContext& context); diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index 1e7ed5a5..c528a068 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -25,10 +25,10 @@ #include "Buffer.hpp" #include "Driver.hpp" #include "Engine.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "ProcessContext.hpp" #include "internals/Delay.hpp" #include "util.hpp" @@ -53,7 +53,7 @@ DelayNode::DelayNode(InternalPlugin* plugin, BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate) : BlockImpl(plugin, symbol, polyphonic, parent, srate) , _buffer(0) diff --git a/src/server/internals/Delay.hpp b/src/server/internals/Delay.hpp index 8f4b758b..0dc5fb21 100644 --- a/src/server/internals/Delay.hpp +++ b/src/server/internals/Delay.hpp @@ -39,7 +39,7 @@ public: BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate); ~DelayNode(); diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 00ab0835..a373d4de 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -24,10 +24,10 @@ #include "Buffer.hpp" #include "Driver.hpp" +#include "GraphImpl.hpp" #include "InputPort.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" -#include "PatchImpl.hpp" #include "ProcessContext.hpp" #include "ingen_config.h" #include "internals/Note.hpp" @@ -50,7 +50,7 @@ NoteNode::NoteNode(InternalPlugin* plugin, BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate) : BlockImpl(plugin, symbol, polyphonic, parent, srate) , _voices(new Raul::Array<Voice>(_polyphony)) diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 290908e8..dbdc59e7 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -42,7 +42,7 @@ public: BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate); ~NoteNode(); diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 31943425..2c353636 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -45,7 +45,7 @@ TriggerNode::TriggerNode(InternalPlugin* plugin, BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate) : BlockImpl(plugin, symbol, false, parent, srate) , _learning(false) diff --git a/src/server/internals/Trigger.hpp b/src/server/internals/Trigger.hpp index 750cd287..b9ae4849 100644 --- a/src/server/internals/Trigger.hpp +++ b/src/server/internals/Trigger.hpp @@ -45,7 +45,7 @@ public: BufferFactory& bufs, const Raul::Symbol& symbol, bool polyphonic, - PatchImpl* parent, + GraphImpl* parent, SampleRate srate); void process(ProcessContext& context); diff --git a/src/server/wscript b/src/server/wscript index 9664545a..b6ec6e98 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -14,6 +14,7 @@ def build(bld): EdgeImpl.cpp Engine.cpp EventWriter.cpp + GraphImpl.cpp GraphObjectImpl.cpp InputPort.cpp InternalPlugin.cpp @@ -21,14 +22,13 @@ def build(bld): LV2Info.cpp LV2Plugin.cpp OutputPort.cpp - PatchImpl.cpp PortImpl.cpp PostProcessor.cpp PreProcessor.cpp Worker.cpp events/Connect.cpp events/CreateBlock.cpp - events/CreatePatch.cpp + events/CreateGraph.cpp events/CreatePort.cpp events/Delete.cpp events/Delta.cpp |