From 800c329a0b77f9044923885abe0728028eca8350 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 19 Aug 2012 02:24:38 +0000 Subject: Patch => Graph git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4721 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/Connect.cpp | 38 +++++------ src/server/events/Connect.hpp | 8 +-- src/server/events/CreateBlock.cpp | 26 ++++---- src/server/events/CreateBlock.hpp | 10 +-- src/server/events/CreateGraph.cpp | 123 ++++++++++++++++++++++++++++++++++++ src/server/events/CreateGraph.hpp | 62 ++++++++++++++++++ src/server/events/CreatePatch.cpp | 123 ------------------------------------ src/server/events/CreatePatch.hpp | 62 ------------------ src/server/events/CreatePort.cpp | 44 ++++++------- src/server/events/CreatePort.hpp | 10 +-- src/server/events/Delete.cpp | 16 ++--- src/server/events/Delete.hpp | 8 +-- src/server/events/Delta.cpp | 40 ++++++------ src/server/events/Delta.hpp | 8 +-- src/server/events/Disconnect.cpp | 42 ++++++------ src/server/events/Disconnect.hpp | 15 +++-- src/server/events/DisconnectAll.cpp | 20 +++--- src/server/events/DisconnectAll.hpp | 10 +-- src/server/events/Get.cpp | 36 +++++------ src/server/events/Move.cpp | 2 +- src/server/events/Move.hpp | 4 +- 21 files changed, 354 insertions(+), 353 deletions(-) create mode 100644 src/server/events/CreateGraph.cpp create mode 100644 src/server/events/CreateGraph.hpp delete mode 100644 src/server/events/CreatePatch.cpp delete mode 100644 src/server/events/CreatePatch.hpp (limited to 'src/server/events') 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(head_block); + _graph = dynamic_cast(head_block); } else { - _patch = dynamic_cast(tail_block); + _graph = dynamic_cast(tail_block); } - } else if (tail_block == head_block && dynamic_cast(tail_block)) { - // Edge from a patch input to a patch output (pass through) - _patch = dynamic_cast(tail_block); + } else if (tail_block == head_block && dynamic_cast(tail_block)) { + // Edge from a graph input to a graph output (pass through) + _graph = dynamic_cast(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 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 _edge; Raul::Array* _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(_engine.store()->get(_path.parent())); - if (!_patch) { + _graph = dynamic_cast(_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/CreateGraph.cpp b/src/server/events/CreateGraph.cpp new file mode 100644 index 00000000..bfe08043 --- /dev/null +++ b/src/server/events/CreateGraph.cpp @@ -0,0 +1,123 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#include "ingen/Store.hpp" +#include "ingen/URIs.hpp" +#include "raul/Maid.hpp" +#include "raul/Path.hpp" + +#include "Broadcaster.hpp" +#include "Driver.hpp" +#include "Engine.hpp" +#include "GraphImpl.hpp" +#include "events/CreateGraph.hpp" + +namespace Ingen { +namespace Server { +namespace Events { + +CreateGraph::CreateGraph(Engine& engine, + SharedPtr client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Resource::Properties& properties) + : Event(engine, client, id, timestamp) + , _path(path) + , _properties(properties) + , _graph(NULL) + , _parent(NULL) + , _compiled_graph(NULL) +{ +} + +bool +CreateGraph::pre_process() +{ + if (_path.is_root() || _engine.store()->get(_path)) { + return Event::pre_process_done(EXISTS, _path); + } + + _parent = dynamic_cast(_engine.store()->get(_path.parent())); + if (!_parent) { + return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); + } + + const Ingen::URIs& uris = _engine.world()->uris(); + + typedef Resource::Properties::const_iterator iterator; + + uint32_t ext_poly = 1; + uint32_t int_poly = 1; + iterator p = _properties.find(uris.ingen_polyphony); + if (p != _properties.end() && p->second.type() == uris.forge.Int) { + int_poly = p->second.get_int32(); + } + + if (int_poly < 1 || int_poly > 128) { + return Event::pre_process_done(INVALID_POLY, _path); + } + + if (int_poly == _parent->internal_poly()) { + ext_poly = int_poly; + } + + const Raul::Symbol symbol((_path.is_root()) ? "root" : _path.symbol()); + _graph = new GraphImpl(_engine, symbol, ext_poly, _parent, + _engine.driver()->sample_rate(), int_poly); + _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(*_graph); + if (_parent->enabled()) { + _graph->enable(); + _compiled_graph = _parent->compile(); + } + + _graph->activate(*_engine.buffer_factory()); + + // Insert into Store + _engine.store()->add(_graph); + + _update = _graph->properties(); + + return Event::pre_process_done(SUCCESS); +} + +void +CreateGraph::execute(ProcessContext& context) +{ + if (_graph) { + assert(_parent); + assert(!_path.is_root()); + _engine.maid()->dispose(_parent->compiled_graph()); + _parent->compiled_graph(_compiled_graph); + } +} + +void +CreateGraph::post_process() +{ + if (!respond()) { + _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); + } +} + +} // namespace Events +} // namespace Server +} // namespace Ingen diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp new file mode 100644 index 00000000..0f6a95dd --- /dev/null +++ b/src/server/events/CreateGraph.hpp @@ -0,0 +1,62 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_EVENTS_CREATEGRAPH_HPP +#define INGEN_EVENTS_CREATEGRAPH_HPP + +#include "Event.hpp" +#include "ingen/Resource.hpp" + +namespace Ingen { +namespace Server { + +class GraphImpl; +class CompiledGraph; + +namespace Events { + +/** Creates a new Graph. + * + * \ingroup engine + */ +class CreateGraph : public Event +{ +public: + CreateGraph(Engine& engine, + SharedPtr client, + int32_t id, + SampleCount timestamp, + const Raul::Path& path, + const Resource::Properties& properties); + + bool pre_process(); + void execute(ProcessContext& context); + void post_process(); + +private: + const Raul::Path _path; + Resource::Properties _properties; + Resource::Properties _update; + GraphImpl* _graph; + GraphImpl* _parent; + CompiledGraph* _compiled_graph; +}; + +} // namespace Events +} // namespace Server +} // namespace Ingen + +#endif // INGEN_EVENTS_CREATEGRAPH_HPP diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp deleted file mode 100644 index e9adc547..00000000 --- a/src/server/events/CreatePatch.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include "ingen/Store.hpp" -#include "ingen/URIs.hpp" -#include "raul/Maid.hpp" -#include "raul/Path.hpp" - -#include "events/CreatePatch.hpp" -#include "Broadcaster.hpp" -#include "Driver.hpp" -#include "Engine.hpp" -#include "PatchImpl.hpp" - -namespace Ingen { -namespace Server { -namespace Events { - -CreatePatch::CreatePatch(Engine& engine, - SharedPtr client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Resource::Properties& properties) - : Event(engine, client, id, timestamp) - , _path(path) - , _properties(properties) - , _patch(NULL) - , _parent(NULL) - , _compiled_patch(NULL) -{ -} - -bool -CreatePatch::pre_process() -{ - if (_path.is_root() || _engine.store()->get(_path)) { - return Event::pre_process_done(EXISTS, _path); - } - - _parent = dynamic_cast(_engine.store()->get(_path.parent())); - if (!_parent) { - return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); - } - - const Ingen::URIs& uris = _engine.world()->uris(); - - typedef Resource::Properties::const_iterator iterator; - - uint32_t ext_poly = 1; - uint32_t int_poly = 1; - iterator p = _properties.find(uris.ingen_polyphony); - if (p != _properties.end() && p->second.type() == uris.forge.Int) { - int_poly = p->second.get_int32(); - } - - if (int_poly < 1 || int_poly > 128) { - return Event::pre_process_done(INVALID_POLY, _path); - } - - if (int_poly == _parent->internal_poly()) { - ext_poly = int_poly; - } - - const Raul::Symbol symbol((_path.is_root()) ? "root" : _path.symbol()); - _patch = new PatchImpl(_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, - Resource::Property(uris.ingen_Block, Resource::EXTERNAL)); - - _parent->add_block(*_patch); - if (_parent->enabled()) { - _patch->enable(); - _compiled_patch = _parent->compile(); - } - - _patch->activate(*_engine.buffer_factory()); - - // Insert into Store - _engine.store()->add(_patch); - - _update = _patch->properties(); - - return Event::pre_process_done(SUCCESS); -} - -void -CreatePatch::execute(ProcessContext& context) -{ - if (_patch) { - assert(_parent); - assert(!_path.is_root()); - _engine.maid()->dispose(_parent->compiled_patch()); - _parent->compiled_patch(_compiled_patch); - } -} - -void -CreatePatch::post_process() -{ - if (!respond()) { - _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); - } -} - -} // namespace Events -} // namespace Server -} // namespace Ingen diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp deleted file mode 100644 index be19d54e..00000000 --- a/src/server/events/CreatePatch.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_EVENTS_CREATEPATCH_HPP -#define INGEN_EVENTS_CREATEPATCH_HPP - -#include "Event.hpp" -#include "ingen/Resource.hpp" - -namespace Ingen { -namespace Server { - -class PatchImpl; -class CompiledPatch; - -namespace Events { - -/** Creates a new Patch. - * - * \ingroup engine - */ -class CreatePatch : public Event -{ -public: - CreatePatch(Engine& engine, - SharedPtr client, - int32_t id, - SampleCount timestamp, - const Raul::Path& path, - const Resource::Properties& properties); - - bool pre_process(); - void execute(ProcessContext& context); - void post_process(); - -private: - const Raul::Path _path; - Resource::Properties _properties; - Resource::Properties _update; - PatchImpl* _patch; - PatchImpl* _parent; - CompiledPatch* _compiled_patch; -}; - -} // namespace Events -} // namespace Server -} // namespace Ingen - -#endif // INGEN_EVENTS_CREATEPATCH_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(parent))) { + if (!(_graph = dynamic_cast(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(_patch_port)); + dynamic_cast(_graph_port)); } _ports_array = new Raul::Array(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* _ports_array; ///< New external port array for Patch + GraphImpl* _graph; + DuplexPort* _graph_port; + Raul::Array* _ports_array; ///< New external port array for Graph Raul::Array* _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 _block; ///< Non-NULL iff a block SharedPtr _port; ///< Non-NULL iff a port EnginePort* _engine_port; - Raul::Array* _ports_array; ///< New (external) ports for Patch - CompiledPatch* _compiled_patch; ///< Patch's new process order + Raul::Array* _ports_array; ///< New (external) ports for Graph + CompiledGraph* _compiled_graph; ///< Graph's new process order DisconnectAll* _disconnect_event; SharedPtr _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(_object))) { + } else if ((_graph = dynamic_cast(_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(obj->parent()); + GraphImpl* parent = dynamic_cast(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(object->parent()); + GraphImpl* parent = reinterpret_cast(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(dst_block); + _graph = dynamic_cast(dst_block); } else { - _patch = dynamic_cast(src_block); + _graph = dynamic_cast(src_block); } - } else if (src_block == dst_block && dynamic_cast(src_block)) { - // Edge from a patch input to a patch output (pass through) - _patch = dynamic_cast(src_block); + } else if (src_block == dst_block && dynamic_cast(src_block)) { + // Edge from a graph input to a graph output (pass through) + _graph = dynamic_cast(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(tail), dynamic_cast(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 class Array; @@ -30,7 +31,7 @@ template 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 _edge; Raul::Array* _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(object)) , _port(dynamic_cast(object)) - , _compiled_patch(NULL) + , _compiled_graph(NULL) , _deleting(true) { } @@ -87,7 +87,7 @@ DisconnectAll::pre_process() if (!_deleting) { lock.acquire(); - _parent = dynamic_cast(_engine.store()->get(_parent_path)); + _parent = dynamic_cast(_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 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(_object))) { - send_patch(_request_client.get(), patch); + if ((graph = dynamic_cast(_object))) { + send_graph(_request_client.get(), graph); } else if ((block = dynamic_cast(_object))) { send_block(_request_client.get(), block); } else if ((port = dynamic_cast(_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 -- cgit v1.2.1