From 172a0119ee0a0bb6d50836c70936907c3eb71c9e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 18 Jun 2006 08:06:14 +0000 Subject: More work on new ports implementation; lots of mass renaming and code removal. git-svn-id: http://svn.drobilla.net/lad/grauph@52 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/ObjectSender.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/libs/engine/ObjectSender.cpp') diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 24191a5d..aec86e53 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -22,7 +22,6 @@ #include "Patch.h" #include "Node.h" #include "Port.h" -#include "PortInfo.h" #include "PortBase.h" #include "Connection.h" #include "NodeFactory.h" @@ -60,7 +59,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch) client->connection((*j)->src_port()->path(), (*j)->dst_port()->path()); // Send port information - for (size_t i=0; i < patch->ports().size(); ++i) { + for (size_t i=0; i < patch->num_ports(); ++i) { Port* const port = patch->ports().at(i); // Send metadata @@ -68,7 +67,8 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch) for (map::const_iterator i = data.begin(); i != data.end(); ++i) client->metadata_update(port->path(), (*i).first, (*i).second); - if (port->port_info()->is_control()) + // Control port, send value + if (port->type() == DataType::FLOAT && port->buffer_size() == 1) client->control_change(port->path(), ((PortBase*)port)->buffer(0)->value_at(0)); } @@ -89,6 +89,8 @@ ObjectSender::send_node(ClientInterface* client, const Node* node) // FIXME: hack, these nodes probably shouldn't even exist in the // engine anymore if (const_cast(node)->as_port()) { // bridge node if as_port() returns non-NULL + // FIXME: remove this whole thing. shouldn't be any bridge nodes anymore + assert(false); send_port(client, const_cast(node)->as_port()); return; } @@ -124,13 +126,11 @@ ObjectSender::send_node(ClientInterface* client, const Node* node) // Send ports for (size_t j=0; j < ports.size(); ++j) { - Port* const port = ports.at(j); - PortInfo* const info = port->port_info(); - + Port* const port = ports.at(j); assert(port); - assert(info); - client->new_port(port->path(), info->type_string(), info->is_output()); + send_port(client, port); + //client->new_port(port->path(), port->type().uri(), port->is_output()); } client->bundle_end(); @@ -145,9 +145,18 @@ ObjectSender::send_node(ClientInterface* client, const Node* node) void ObjectSender::send_port(ClientInterface* client, const Port* port) { - PortInfo* info = port->port_info(); - - client->new_port(port->path(), info->type_string(), info->is_output()); + assert(port); + + // FIXME: temporary compatibility hack + string type = port->type().uri(); + if (port->type() == DataType::FLOAT) { + if (port->buffer_size() == 1) + type = "CONTROL"; + else + type = "AUDIO"; + } + + client->new_port(port->path(), type, port->is_output()); // Send metadata const map& data = port->metadata(); -- cgit v1.2.1