diff options
Diffstat (limited to 'src')
34 files changed, 188 insertions, 221 deletions
diff --git a/src/common/interface/Connection.hpp b/src/common/interface/Connection.hpp new file mode 100644 index 00000000..4d5ea1aa --- /dev/null +++ b/src/common/interface/Connection.hpp @@ -0,0 +1,42 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard <http://drobilla.net> + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CONNECTION_H +#define CONNECTION_H + +#include <raul/Path.hpp> + +namespace Ingen { +namespace Shared { + + +/** A connection between two ports. + * + * \ingroup interface + */ +class Connection +{ +public: + virtual const Raul::Path src_port_path() const = 0; + virtual const Raul::Path dst_port_path() const = 0; +}; + + +} // namespace Shared +} // namespace Ingen + +#endif // CONNECTION_H diff --git a/src/common/interface/Makefile.am b/src/common/interface/Makefile.am index 8442df77..7fc68563 100644 --- a/src/common/interface/Makefile.am +++ b/src/common/interface/Makefile.am @@ -1,8 +1,9 @@ EXTRA_DIST = \ - README \ ClientInterface.hpp \ + Connection.hpp \ + DataType.hpp \ EngineInterface.hpp \ - Plugin.hpp \ Node.hpp \ + Plugin.hpp \ Port.hpp \ - DataType.hpp \ + README diff --git a/src/libs/client/ConnectionModel.cpp b/src/libs/client/ConnectionModel.cpp deleted file mode 100644 index d35457d1..00000000 --- a/src/libs/client/ConnectionModel.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <cassert> -#include "ConnectionModel.hpp" -#include "PortModel.hpp" -#include "PatchModel.hpp" - -namespace Ingen { -namespace Client { - - -ConnectionModel::ConnectionModel(const Path& src_port, const Path& dst_port) -: _src_port_path(src_port), - _dst_port_path(dst_port) -{ - // Be sure connection is within one patch - //assert(_src_port_path.parent().parent() - // == _dst_port_path.parent().parent()); -} - - -ConnectionModel::ConnectionModel(SharedPtr<PortModel> src, SharedPtr<PortModel> dst) -: _src_port_path(src->path()), - _dst_port_path(dst->path()), - _src_port(src), - _dst_port(dst) -{ - assert(_src_port); - assert(_dst_port); - assert(_src_port->parent()); - assert(_dst_port->parent()); - - // Be sure connection is within one patch - //assert(_src_port_path.parent().parent() - // == _dst_port_path.parent().parent()); -} - - -const Path -ConnectionModel::src_port_path() const -{ - if (!_src_port) - return _src_port_path; - else - return _src_port->path(); -} - - -const Path -ConnectionModel::dst_port_path() const -{ - if (!_dst_port) - return _dst_port_path; - else - return _dst_port->path(); -} - - -typedef list<SharedPtr<ConnectionModel> > ConnectionList; - - -} // namespace Client -} // namespace Ingen diff --git a/src/libs/client/ConnectionModel.hpp b/src/libs/client/ConnectionModel.hpp index 1a73b123..83ddbd58 100644 --- a/src/libs/client/ConnectionModel.hpp +++ b/src/libs/client/ConnectionModel.hpp @@ -18,12 +18,13 @@ #ifndef CONNECTIONMODEL_H #define CONNECTIONMODEL_H +#include <cassert> #include <string> #include <list> #include <raul/Path.hpp> #include <raul/SharedPtr.hpp> +#include "interface/Connection.hpp" #include "PortModel.hpp" -#include <cassert> namespace Ingen { namespace Client { @@ -41,35 +42,32 @@ class Store; * * \ingroup IngenClient */ -class ConnectionModel +class ConnectionModel : public Shared::Connection { public: SharedPtr<PortModel> src_port() const { return _src_port; } SharedPtr<PortModel> dst_port() const { return _dst_port; } - const Path src_port_path() const; - const Path dst_port_path() const; + const Path src_port_path() const { return _src_port->path(); } + const Path dst_port_path() const { return _dst_port->path(); } private: friend class Store; - ConnectionModel(const Path& src_port, const Path& dst_port); - ConnectionModel(SharedPtr<PortModel> src, SharedPtr<PortModel> dst); + ConnectionModel(SharedPtr<PortModel> src, SharedPtr<PortModel> dst) + : _src_port(src) + , _dst_port(dst) + { + assert(_src_port); + assert(_dst_port); + assert(_src_port->parent()); + assert(_dst_port->parent()); + } - void set_src_port(SharedPtr<PortModel> port) { _src_port = port; _src_port_path = port->path(); } - void set_dst_port(SharedPtr<PortModel> port) { _dst_port = port; _dst_port_path = port->path(); } - - void src_port_path(const std::string& s) { _src_port_path = s; } - void dst_port_path(const std::string& s) { _dst_port_path = s; } - - Path _src_port_path; ///< Only used if _src_port == NULL - Path _dst_port_path; ///< Only used if _dst_port == NULL SharedPtr<PortModel> _src_port; SharedPtr<PortModel> _dst_port; }; -typedef std::list<SharedPtr<ConnectionModel> > ConnectionList; - } // namespace Client } // namespace Ingen diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index 45ec0bea..9ee32b84 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -22,7 +22,6 @@ libingen_client_la_LIBADD = \ libingen_client_la_SOURCES = \ $(top_srcdir)/ingen/src/common/interface/ClientInterface.hpp \ $(top_srcdir)/ingen/src/common/interface/EngineInterface.hpp \ - ConnectionModel.cpp \ ConnectionModel.hpp \ ControlModel.hpp \ DeprecatedLoader.cpp \ diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index b50e4fd0..2bd514f3 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -64,7 +64,7 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o) // Remove any connections which referred to this object, // since they can't possibly exist anymore - for (ConnectionList::iterator j = _connections.begin(); j != _connections.end() ; ) { + for (Connections::iterator j = _connections.begin(); j != _connections.end() ; ) { list<SharedPtr<ConnectionModel> >::iterator next = j; ++next; diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp index 21e89cee..1c35b959 100644 --- a/src/libs/client/PatchModel.hpp +++ b/src/libs/client/PatchModel.hpp @@ -41,7 +41,9 @@ class Store; class PatchModel : public NodeModel { public: - const ConnectionList& connections() const { return _connections; } + typedef std::list<SharedPtr<ConnectionModel> > Connections; + + const Connections& connections() const { return _connections; } SharedPtr<ConnectionModel> get_connection(const string& src_port_path, const string& dst_port_path) const; SharedPtr<NodeModel> get_node(const string& node_name) const; @@ -97,11 +99,11 @@ private: void rename_node(const Path& old_path, const Path& new_path); void rename_node_port(const Path& old_path, const Path& new_path); - ConnectionList _connections; - string _filename; - bool _enabled; - size_t _poly; - bool _editable; + Connections _connections; + string _filename; + bool _enabled; + size_t _poly; + bool _editable; }; typedef Table<string, SharedPtr<PatchModel> > PatchModelMap; diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index a5fbb614..a8683d00 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -36,7 +36,7 @@ #include <raul/TableImpl.hpp> #include "interface/EngineInterface.hpp" #include "interface/Port.hpp" -#include "ConnectionModel.hpp" +#include "interface/Connection.hpp" #include "PatchModel.hpp" #include "Serializer.hpp" @@ -311,7 +311,7 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch) serialize_port(p, port_id); } - for (ConnectionList::const_iterator c = patch->connections().begin(); c != patch->connections().end(); ++c) { + for (PatchModel::Connections::const_iterator c = patch->connections().begin(); c != patch->connections().end(); ++c) { serialize_connection(*c); } } @@ -420,7 +420,7 @@ Serializer::serialize_port(const Port* port, const RDF::Node& port_id) void -Serializer::serialize_connection(SharedPtr<ConnectionModel> connection) throw (std::logic_error) +Serializer::serialize_connection(SharedPtr<Connection> connection) throw (std::logic_error) { if (!_model) throw std::logic_error("serialize_connection called without serialization in progress"); diff --git a/src/libs/client/Serializer.hpp b/src/libs/client/Serializer.hpp index fafedfa5..7a739f94 100644 --- a/src/libs/client/Serializer.hpp +++ b/src/libs/client/Serializer.hpp @@ -39,12 +39,12 @@ namespace Shared { class GraphObject; class Node; class Port; + class Connection; } namespace Client { class PatchModel; -class ConnectionModel; /** Serializes Ingen objects (patches, nodes, etc) to RDF. @@ -61,7 +61,7 @@ public: void start_to_string(); void serialize(SharedPtr<GraphObject> object) throw (std::logic_error); - void serialize_connection(SharedPtr<ConnectionModel> c) throw (std::logic_error); + void serialize_connection(SharedPtr<Shared::Connection> c) throw (std::logic_error); string finish(); private: diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 2838ca12..af6b33c5 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -106,12 +106,12 @@ Store::resolve_plugin_orphans(SharedPtr<PluginModel> plugin) void -Store::add_connection_orphan(SharedPtr<ConnectionModel> connection) +Store::add_connection_orphan(std::pair<Path, Path> orphan) { - cerr << "WARNING: Orphan connection " << connection->src_port_path() - << " -> " << connection->dst_port_path() << " received." << endl; + cerr << "WARNING: Orphan connection " << orphan.first + << " -> " << orphan.second << " received." << endl; - _connection_orphans.push_back(connection); + _connection_orphans.push_back(orphan); } @@ -120,26 +120,16 @@ Store::resolve_connection_orphans(SharedPtr<PortModel> port) { assert(port->parent()); - for (list<SharedPtr<ConnectionModel> >::iterator c = _connection_orphans.begin(); + for (list< pair<Path, Path> >::iterator c = _connection_orphans.begin(); c != _connection_orphans.end(); ) { - if ((*c)->src_port_path() == port->path()) - (*c)->set_src_port(port); - - if ((*c)->dst_port_path() == port->path()) - (*c)->set_dst_port(port); - - list<SharedPtr<ConnectionModel> >::iterator next = c; + list< pair<Path, Path> >::iterator next = c; ++next; - if ((*c)->src_port() && (*c)->dst_port()) { - SharedPtr<PatchModel> patch = connection_patch((*c)->src_port_path(), (*c)->dst_port_path()); - if (patch) { - cerr << "Resolved orphan connection " << (*c)->src_port_path() << - (*c)->dst_port_path() << endl; - patch->add_connection(*c); + if (c->first == port->path() || c->second == port->path()) { + bool success = attempt_connection(c->first, c->second); + if (success) _connection_orphans.erase(c); - } } c = next; @@ -553,14 +543,12 @@ Store::connection_patch(const Path& src_port_path, const Path& dst_port_path) } -void -Store::connection_event(const Path& src_port_path, const Path& dst_port_path) +bool +Store::attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan) { SharedPtr<PortModel> src_port = PtrCast<PortModel>(object(src_port_path)); SharedPtr<PortModel> dst_port = PtrCast<PortModel>(object(dst_port_path)); - SharedPtr<ConnectionModel> dangling_cm(new ConnectionModel(src_port_path, dst_port_path)); - if (src_port && dst_port) { assert(src_port->parent()); @@ -575,12 +563,23 @@ Store::connection_event(const Path& src_port_path, const Path& dst_port_path) dst_port->connected_to(src_port); patch->add_connection(cm); + + return true; - } else { + } else if (add_orphan) { - add_connection_orphan(dangling_cm); + add_connection_orphan(make_pair(src_port_path, dst_port_path)); } + + return false; +} + + +void +Store::connection_event(const Path& src_port_path, const Path& dst_port_path) +{ + attempt_connection(src_port_path, dst_port_path, true); } diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp index af241097..26aac803 100644 --- a/src/libs/client/Store.hpp +++ b/src/libs/client/Store.hpp @@ -81,7 +81,7 @@ private: void add_orphan(SharedPtr<ObjectModel> orphan); void resolve_orphans(SharedPtr<ObjectModel> parent); - void add_connection_orphan(SharedPtr<ConnectionModel> orphan); + void add_connection_orphan(std::pair<Path, Path> orphan); void resolve_connection_orphans(SharedPtr<PortModel> port); void add_plugin_orphan(SharedPtr<NodeModel> orphan); @@ -108,6 +108,8 @@ private: void connection_event(const Path& src_port_path, const Path& dst_port_path); void disconnection_event(const Path& src_port_path, const Path& dst_port_path); + bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false); + SharedPtr<EngineInterface> _engine; SharedPtr<SigClientInterface> _emitter; @@ -126,7 +128,7 @@ private: Raul::PathTable<list<std::pair<string, Atom> > > _metadata_orphans; /** Ditto */ - list<SharedPtr<ConnectionModel> > _connection_orphans; + list<std::pair<Path, Path> > _connection_orphans; }; diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 3c275e4a..97a78b4e 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -27,7 +27,7 @@ #include "NodeImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "AudioDriver.hpp" #include "ObjectSender.hpp" #include "OSCClientSender.hpp" @@ -162,7 +162,7 @@ ClientBroadcaster::send_patch_cleared(const string& patch_path) } void -ClientBroadcaster::send_connection(const Connection* const c) +ClientBroadcaster::send_connection(const ConnectionImpl* const c) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) (*i).second->connection(c->src_port()->path(), c->dst_port()->path()); diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp index e9e74b3a..79669999 100644 --- a/src/libs/engine/ClientBroadcaster.hpp +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -34,7 +34,7 @@ class NodeImpl; class PortImpl; class PluginImpl; class Patch; -class Connection; +class ConnectionImpl; using Shared::ClientInterface; @@ -68,7 +68,7 @@ public: void send_destroyed(const string& path); void send_polyphonic(const string& path, bool polyphonic); void send_patch_cleared(const string& patch_path); - void send_connection(const Connection* const connection); + void send_connection(const ConnectionImpl* const connection); void send_disconnection(const string& src_port_path, const string& dst_port_path); void send_rename(const string& old_path, const string& new_path); void send_patch_enable(const string& patch_path); diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/ConnectionImpl.cpp index 894a9db7..49e8f7f7 100644 --- a/src/libs/engine/Connection.cpp +++ b/src/libs/engine/ConnectionImpl.cpp @@ -18,7 +18,7 @@ #include <algorithm> #include <raul/Maid.hpp> #include "util.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "NodeImpl.hpp" #include "PortImpl.hpp" #include "BufferFactory.hpp" @@ -33,7 +33,7 @@ namespace Ingen { * This handles both polyphonic and monophonic nodes, transparently to the * user (InputPort). */ -Connection::Connection(PortImpl* src_port, PortImpl* dst_port) +ConnectionImpl::ConnectionImpl(PortImpl* src_port, PortImpl* dst_port) : _src_port(src_port) , _dst_port(dst_port) , _local_buffer(NULL) @@ -62,14 +62,14 @@ Connection::Connection(PortImpl* src_port, PortImpl* dst_port) } -Connection::~Connection() +ConnectionImpl::~ConnectionImpl() { delete _local_buffer; } void -Connection::set_buffer_size(size_t size) +ConnectionImpl::set_buffer_size(size_t size) { if (_must_mix) { assert(_local_buffer); @@ -83,7 +83,7 @@ Connection::set_buffer_size(size_t size) void -Connection::prepare_poly(uint32_t poly) +ConnectionImpl::prepare_poly(uint32_t poly) { if (type() == DataType::CONTROL || type() == DataType::AUDIO) _must_mix = (poly > 1) && ( @@ -101,7 +101,7 @@ Connection::prepare_poly(uint32_t poly) void -Connection::apply_poly(Raul::Maid& maid, uint32_t poly) +ConnectionImpl::apply_poly(Raul::Maid& maid, uint32_t poly) { if (poly == 1 && _local_buffer && !_must_mix) { maid.push(_local_buffer); @@ -111,7 +111,7 @@ Connection::apply_poly(Raul::Maid& maid, uint32_t poly) void -Connection::process(ProcessContext& context) +ConnectionImpl::process(ProcessContext& context) { // FIXME: nframes parameter not used assert(_buffer_size == 1 || _buffer_size == context.nframes()); diff --git a/src/libs/engine/Connection.hpp b/src/libs/engine/ConnectionImpl.hpp index 36dc0ee2..87b9f7e7 100644 --- a/src/libs/engine/Connection.hpp +++ b/src/libs/engine/ConnectionImpl.hpp @@ -15,13 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef CONNECTION_H -#define CONNECTION_H +#ifndef CONNECTIONIMPL_H +#define CONNECTIONIMPL_H #include <cstdlib> #include <boost/utility.hpp> #include <raul/Deletable.hpp> #include "interface/DataType.hpp" +#include "interface/Connection.hpp" #include "PortImpl.hpp" #include "types.hpp" @@ -41,14 +42,17 @@ class Buffer; * * \ingroup engine */ -class Connection : public Raul::Deletable +class ConnectionImpl : public Raul::Deletable, public Shared::Connection { public: - Connection(PortImpl* src_port, PortImpl* dst_port); - virtual ~Connection(); + ConnectionImpl(PortImpl* src_port, PortImpl* dst_port); + virtual ~ConnectionImpl(); PortImpl* src_port() const { return _src_port; } PortImpl* dst_port() const { return _dst_port; } + + const Raul::Path src_port_path() const { return _src_port->path(); } + const Raul::Path dst_port_path() const { return _src_port->path(); } /** Used by some (recursive) events to prevent double disconnections */ bool pending_disconnection() { return _pending_disconnection; } @@ -80,7 +84,7 @@ protected: inline Buffer* -Connection::buffer(size_t voice) const +ConnectionImpl::buffer(size_t voice) const { if (_must_mix) { return _local_buffer; @@ -94,4 +98,4 @@ Connection::buffer(size_t voice) const } // namespace Ingen -#endif // CONNECTION_H +#endif // CONNECTIONIMPL_H diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp index 83ba0e5a..93b61b8c 100644 --- a/src/libs/engine/DuplexPort.cpp +++ b/src/libs/engine/DuplexPort.cpp @@ -20,7 +20,7 @@ #include <cassert> #include "util.hpp" #include "DuplexPort.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "OutputPort.hpp" #include "NodeImpl.hpp" diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index 6a4de550..05f2de9a 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -20,7 +20,7 @@ #include <cstdlib> #include <cassert> #include "AudioBuffer.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "OutputPort.hpp" #include "NodeImpl.hpp" #include "ProcessContext.hpp" @@ -43,7 +43,7 @@ InputPort::set_buffer_size(size_t size) PortImpl::set_buffer_size(size); assert(_buffer_size = size); - for (Raul::List<Connection*>::iterator c = _connections.begin(); c != _connections.end(); ++c) + for (Raul::List<ConnectionImpl*>::iterator c = _connections.begin(); c != _connections.end(); ++c) (*c)->set_buffer_size(size); } @@ -55,7 +55,7 @@ InputPort::set_buffer_size(size_t size) * if there is only one connection, since no mixing needs to take place. */ void -InputPort::add_connection(Raul::ListNode<Connection*>* const c) +InputPort::add_connection(Raul::ListNode<ConnectionImpl*>* const c) { _connections.push_back(c); @@ -85,13 +85,13 @@ InputPort::add_connection(Raul::ListNode<Connection*>* const c) /** Remove a connection. Realtime safe. */ -Raul::ListNode<Connection*>* +Raul::ListNode<ConnectionImpl*>* InputPort::remove_connection(const OutputPort* src_port) { bool modify_buffers = !_fixed_buffers; bool found = false; - Raul::ListNode<Connection*>* connection = NULL; + Raul::ListNode<ConnectionImpl*>* connection = NULL; for (Connections::iterator i = _connections.begin(); i != _connections.end(); ++i) { if ((*i)->src_port()->path() == src_port->path()) { connection = _connections.erase(i); diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp index 228371f8..1552642b 100644 --- a/src/libs/engine/InputPort.hpp +++ b/src/libs/engine/InputPort.hpp @@ -28,7 +28,7 @@ using std::string; namespace Ingen { -class Connection; +class ConnectionImpl; class OutputPort; class NodeImpl; @@ -50,10 +50,10 @@ public: InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size); virtual ~InputPort() {} - void add_connection(Raul::ListNode<Connection*>* c); - Raul::ListNode<Connection*>* remove_connection(const OutputPort* src_port); + void add_connection(Raul::ListNode<ConnectionImpl*>* c); + Raul::ListNode<ConnectionImpl*>* remove_connection(const OutputPort* src_port); - typedef Raul::List<Connection*> Connections; + typedef Raul::List<ConnectionImpl*> Connections; const Connections& connections() { return _connections; } void pre_process(ProcessContext& context); diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 8b037fb9..a98a1e48 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -28,8 +28,8 @@ libingen_engine_la_SOURCES = \ BufferFactory.hpp \ ClientBroadcaster.cpp \ ClientBroadcaster.hpp \ - Connection.cpp \ - Connection.hpp \ + ConnectionImpl.cpp \ + ConnectionImpl.hpp \ CompiledPatch.hpp \ Driver.hpp \ DuplexPort.cpp \ diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index ff0b2037..2f63621c 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -27,7 +27,7 @@ #include "NodeImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "AudioDriver.hpp" #include "interface/ClientInterface.hpp" diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index fb1039c7..61935207 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -22,7 +22,7 @@ #include "NodeImpl.hpp" #include "PortImpl.hpp" #include "PortImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "NodeFactory.hpp" #include "interface/DataType.hpp" #include "AudioBuffer.hpp" @@ -54,7 +54,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur } // Send connections - for (Raul::List<Connection*>::const_iterator j = patch->connections().begin(); + for (Raul::List<ConnectionImpl*>::const_iterator j = patch->connections().begin(); j != patch->connections().end(); ++j) { client->connection((*j)->src_port()->path(), (*j)->dst_port()->path()); diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index 6f3b0a48..83fcf3df 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -23,7 +23,7 @@ #include "Patch.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "DuplexPort.hpp" #include "Engine.hpp" #include "ProcessSlave.hpp" @@ -54,7 +54,7 @@ Patch::~Patch() { assert(!_activated); - for (Raul::List<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { + for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { delete (*i); delete _connections.erase(i); } @@ -116,7 +116,7 @@ Patch::prepare_internal_poly(uint32_t poly) for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->prepare_poly(poly); - for (Raul::List<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) + for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i) (*i)->prepare_poly(poly); /* FIXME: Deal with failure */ @@ -133,7 +133,7 @@ Patch::apply_internal_poly(Raul::Maid& maid, uint32_t poly) for (Raul::List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i) (*i)->apply_poly(maid, poly); - for (Raul::List<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) + for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i) (*i)->apply_poly(maid, poly); _internal_poly = poly; @@ -284,12 +284,12 @@ Patch::remove_node(const string& name) /** Remove a connection. Realtime safe. */ -Raul::ListNode<Connection*>* +Raul::ListNode<ConnectionImpl*>* Patch::remove_connection(const PortImpl* src_port, const PortImpl* dst_port) { bool found = false; - Raul::ListNode<Connection*>* connection = NULL; - for (Raul::List<Connection*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { + Raul::ListNode<ConnectionImpl*>* connection = NULL; + for (Raul::List<ConnectionImpl*>::iterator i = _connections.begin(); i != _connections.end(); ++i) { if ((*i)->src_port() == src_port && (*i)->dst_port() == dst_port) { connection = _connections.erase(i); found = true; diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp index 66372c3c..a39106a4 100644 --- a/src/libs/engine/Patch.hpp +++ b/src/libs/engine/Patch.hpp @@ -32,7 +32,7 @@ template <typename T> class Array; namespace Ingen { -class Connection; +class ConnectionImpl; class Engine; class CompiledPatch; @@ -86,11 +86,11 @@ public: void add_node(Raul::ListNode<NodeImpl*>* tn); Raul::ListNode<NodeImpl*>* remove_node(const string& name); - Raul::List<NodeImpl*>& nodes() { return _nodes; } - Raul::List<Connection*>& connections() { return _connections; } + Raul::List<NodeImpl*>& nodes() { return _nodes; } + Raul::List<ConnectionImpl*>& connections() { return _connections; } - const Raul::List<NodeImpl*>& nodes() const { return _nodes; } - const Raul::List<Connection*>& connections() const { return _connections; } + const Raul::List<NodeImpl*>& nodes() const { return _nodes; } + const Raul::List<ConnectionImpl*>& connections() const { return _connections; } uint32_t num_ports() const; @@ -99,8 +99,8 @@ public: void add_output(Raul::ListNode<PortImpl*>* port) { _output_ports.push_back(port); } ///< Preprocessor thread Raul::ListNode<PortImpl*>* remove_port(const string& name); - void add_connection(Raul::ListNode<Connection*>* c) { _connections.push_back(c); } - Raul::ListNode<Connection*>* remove_connection(const PortImpl* src_port, const PortImpl* dst_port); + void add_connection(Raul::ListNode<ConnectionImpl*>* c) { _connections.push_back(c); } + Raul::ListNode<ConnectionImpl*>* remove_connection(const PortImpl* src_port, const PortImpl* dst_port); CompiledPatch* compiled_patch() { return _compiled_patch; } void compiled_patch(CompiledPatch* cp) { _compiled_patch = cp; } @@ -123,14 +123,14 @@ private: void process_parallel(ProcessContext& context); void process_single(ProcessContext& context); - Engine& _engine; - uint32_t _internal_poly; - CompiledPatch* _compiled_patch; ///< Accessed in audio thread only - Raul::List<Connection*> _connections; ///< Accessed in audio thread only - Raul::List<PortImpl*> _input_ports; ///< Accessed in preprocessing thread only - Raul::List<PortImpl*> _output_ports; ///< Accessed in preprocessing thread only - Raul::List<NodeImpl*> _nodes; ///< Accessed in preprocessing thread only - bool _process; + Engine& _engine; + uint32_t _internal_poly; + CompiledPatch* _compiled_patch; ///< Accessed in audio thread only + Raul::List<ConnectionImpl*> _connections; ///< Accessed in audio thread only + Raul::List<PortImpl*> _input_ports; ///< Accessed in preprocessing thread only + Raul::List<PortImpl*> _output_ports; ///< Accessed in preprocessing thread only + Raul::List<NodeImpl*> _nodes; ///< Accessed in preprocessing thread only + bool _process; }; diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 1e6c0748..ad35d162 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -25,7 +25,7 @@ #include "ObjectStore.hpp" #include "PortImpl.hpp" #include "NodeImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "QueuedEventSource.hpp" namespace Ingen { @@ -92,7 +92,7 @@ ClearPatchEvent::post_process() _patch->nodes().clear(); // Delete all connections - for (Raul::List<Connection*>::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) + for (Raul::List<ConnectionImpl*>::iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) delete *i; _patch->connections().clear(); diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 7f8fa18e..733a46d4 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -22,7 +22,7 @@ #include "Responder.hpp" #include "types.hpp" #include "Engine.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" #include "Patch.hpp" @@ -126,9 +126,9 @@ ConnectionEvent::pre_process() return; } - _connection = new Connection(_src_port, _dst_port); - _port_listnode = new Raul::ListNode<Connection*>(_connection); - _patch_listnode = new Raul::ListNode<Connection*>(_connection); + _connection = new ConnectionImpl(_src_port, _dst_port); + _port_listnode = new Raul::ListNode<ConnectionImpl*>(_connection); + _patch_listnode = new Raul::ListNode<ConnectionImpl*>(_connection); // Need to be careful about patch port connections here and adding a node's // parent as a dependant/provider, or adding a patch as it's own provider... diff --git a/src/libs/engine/events/ConnectionEvent.hpp b/src/libs/engine/events/ConnectionEvent.hpp index 8fa8c489..d7465566 100644 --- a/src/libs/engine/events/ConnectionEvent.hpp +++ b/src/libs/engine/events/ConnectionEvent.hpp @@ -33,10 +33,9 @@ namespace Ingen { class Patch; class NodeImpl; -class Connection; +class ConnectionImpl; class MidiMessage; class PortImpl; -class Connection; class InputPort; class OutputPort; class CompiledPatch; @@ -78,9 +77,9 @@ private: CompiledPatch* _compiled_patch; ///< New process order for Patch - Connection* _connection; - Raul::ListNode<Connection*>* _patch_listnode; - Raul::ListNode<Connection*>* _port_listnode; + ConnectionImpl* _connection; + Raul::ListNode<ConnectionImpl*>* _patch_listnode; + Raul::ListNode<ConnectionImpl*>* _port_listnode; ErrorType _error; }; diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 8612d012..e0507b3a 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -20,7 +20,7 @@ #include <raul/Maid.hpp> #include <raul/Path.hpp> #include "ClientBroadcaster.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "DisconnectNodeEvent.hpp" #include "DisconnectionEvent.hpp" #include "Engine.hpp" @@ -70,7 +70,7 @@ DisconnectNodeEvent::~DisconnectNodeEvent() void DisconnectNodeEvent::pre_process() { - typedef Raul::List<Connection*>::const_iterator ConnectionListIterator; + typedef Raul::List<ConnectionImpl*>::const_iterator ConnectionListIterator; if (_lookup) { _patch = _engine.object_store()->find_patch(_node_path.parent()); @@ -90,7 +90,7 @@ DisconnectNodeEvent::pre_process() } } - Connection* c = NULL; + ConnectionImpl* c = NULL; for (ConnectionListIterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { c = (*i); if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node) && !c->pending_disconnection()) { diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index f7ad9925..76a4cbc4 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -23,7 +23,7 @@ #include "Responder.hpp" #include "Engine.hpp" #include "NodeImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "DisconnectionEvent.hpp" #include "PortImpl.hpp" #include "InputPort.hpp" @@ -103,8 +103,8 @@ DisconnectPortEvent::pre_process() return; } - Connection* c = NULL; - for (Raul::List<Connection*>::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { + ConnectionImpl* c = NULL; + for (Raul::List<ConnectionImpl*>::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { c = (*i); if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) { DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr<Responder>(new Responder()), _time, diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 215e0202..68068821 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -21,7 +21,7 @@ #include <raul/Path.hpp> #include "Responder.hpp" #include "Engine.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" #include "Patch.hpp" @@ -157,15 +157,15 @@ DisconnectionEvent::execute(ProcessContext& context) QueuedEvent::execute(context); if (_error == NO_ERROR) { - Raul::ListNode<Connection*>* const port_connection + Raul::ListNode<ConnectionImpl*>* const port_connection = _dst_input_port->remove_connection(_src_output_port); if (port_connection != NULL) { - Raul::ListNode<Connection*>* const patch_connection + Raul::ListNode<ConnectionImpl*>* const patch_connection = _patch->remove_connection(_src_port, _dst_port); assert(patch_connection); - assert((Connection*)port_connection->elem() == patch_connection->elem()); + assert((ConnectionImpl*)port_connection->elem() == patch_connection->elem()); // Clean up both the list node and the connection itself... _engine.maid()->push(port_connection); diff --git a/src/libs/engine/events/DisconnectionEvent.hpp b/src/libs/engine/events/DisconnectionEvent.hpp index aacb5082..603eaf47 100644 --- a/src/libs/engine/events/DisconnectionEvent.hpp +++ b/src/libs/engine/events/DisconnectionEvent.hpp @@ -33,10 +33,9 @@ namespace Ingen { class Patch; class NodeImpl; -class Connection; +class ConnectionImpl; class MidiMessage; class PortImpl; -class Connection; class InputPort; class OutputPort; class CompiledPatch; diff --git a/src/libs/engine/events/SetPolyphonicEvent.cpp b/src/libs/engine/events/SetPolyphonicEvent.cpp index 8cca2373..51ab2dc8 100644 --- a/src/libs/engine/events/SetPolyphonicEvent.cpp +++ b/src/libs/engine/events/SetPolyphonicEvent.cpp @@ -25,7 +25,7 @@ #include "ObjectStore.hpp" #include "PortImpl.hpp" #include "NodeImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "QueuedEventSource.hpp" namespace Ingen { diff --git a/src/libs/engine/events/SetPolyphonyEvent.cpp b/src/libs/engine/events/SetPolyphonyEvent.cpp index 8e0d12cd..56e95486 100644 --- a/src/libs/engine/events/SetPolyphonyEvent.cpp +++ b/src/libs/engine/events/SetPolyphonyEvent.cpp @@ -25,7 +25,7 @@ #include "ObjectStore.hpp" #include "PortImpl.hpp" #include "NodeImpl.hpp" -#include "Connection.hpp" +#include "ConnectionImpl.hpp" #include "QueuedEventSource.hpp" namespace Ingen { diff --git a/src/libs/gui/Connection.hpp b/src/libs/gui/Connection.hpp index f6072068..55378891 100644 --- a/src/libs/gui/Connection.hpp +++ b/src/libs/gui/Connection.hpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef CONNECTION_H -#define CONNECTION_H +#ifndef GUI_CONNECTION_H +#define GUI_CONNECTION_H #include <cassert> #include <string> @@ -57,4 +57,4 @@ private: } // namespace GUI } // namespace Ingen -#endif // CONNECTION_H +#endif // GUI_CONNECTION_H diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index e2e176cb..bbff476f 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -310,7 +310,7 @@ PatchCanvas::connection(SharedPtr<ConnectionModel> cm) const SharedPtr<FlowCanvas::Port> dst = get_port_view(cm->dst_port()); if (src && dst) - add_connection(boost::shared_ptr<Connection>(new Connection(shared_from_this(), + add_connection(boost::shared_ptr<GUI::Connection>(new GUI::Connection(shared_from_this(), cm, src, dst, src->color() + 0x22222200))); else cerr << "[PatchCanvas] ERROR: Unable to find ports to connect " |