summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-07 01:55:20 +0000
committerDavid Robillard <d@drobilla.net>2010-01-07 01:55:20 +0000
commitc916eafd99b2cfde0e56c3c5eb1bcc39b56c30f8 (patch)
treeeb19140bb4db1071405b2a0b1d9aadd574a5e6d4 /src
parent10a5b76a65fb7ca7bf8c1f5869aaf763854e05a3 (diff)
downloadingen-c916eafd99b2cfde0e56c3c5eb1bcc39b56c30f8.tar.gz
ingen-c916eafd99b2cfde0e56c3c5eb1bcc39b56c30f8.tar.bz2
ingen-c916eafd99b2cfde0e56c3c5eb1bcc39b56c30f8.zip
Make ClientBroadcaster itself a ClientInterface.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2353 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/ClientBroadcaster.cpp45
-rw-r--r--src/engine/ClientBroadcaster.hpp65
-rw-r--r--src/engine/events/Connect.cpp2
-rw-r--r--src/engine/events/Delete.cpp4
-rw-r--r--src/engine/events/Disconnect.cpp2
-rw-r--r--src/engine/events/Move.cpp2
-rw-r--r--src/engine/events/SendPortActivity.cpp2
-rw-r--r--src/engine/events/SendPortValue.cpp4
-rw-r--r--src/engine/events/SetMetadata.cpp2
-rw-r--r--src/engine/events/SetPortValue.cpp5
10 files changed, 94 insertions, 39 deletions
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp
index fcae666f..1da56af6 100644
--- a/src/engine/ClientBroadcaster.cpp
+++ b/src/engine/ClientBroadcaster.cpp
@@ -105,12 +105,29 @@ ClientBroadcaster::bundle_end()
void
-ClientBroadcaster::send_error(const string& msg)
+ClientBroadcaster::transfer_begin()
+{
+ for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ (*i).second->transfer_begin();
+}
+
+
+void
+ClientBroadcaster::transfer_end()
+{
+ for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ (*i).second->transfer_end();
+}
+
+
+void
+ClientBroadcaster::error(const string& msg)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->error(msg);
}
+
void
ClientBroadcaster::send_plugins_to(ClientInterface* client, const NodeFactory::Plugins& plugins)
{
@@ -134,7 +151,7 @@ ClientBroadcaster::send_plugins(const NodeFactory::Plugins& plugins)
void
-ClientBroadcaster::send_deleted(const Path& path)
+ClientBroadcaster::del(const Path& path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->del(path);
@@ -142,15 +159,15 @@ ClientBroadcaster::send_deleted(const Path& path)
void
-ClientBroadcaster::send_connection(const SharedPtr<const ConnectionImpl> c)
+ClientBroadcaster::connect(const Path& src_port_path, const Path& dst_port_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->connect(c->src_port()->path().str(), c->dst_port()->path().str());
+ (*i).second->connect(src_port_path, dst_port_path);
}
void
-ClientBroadcaster::send_disconnection(const Path& src_port_path, const Path& dst_port_path)
+ClientBroadcaster::disconnect(const Path& src_port_path, const Path& dst_port_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->disconnect(src_port_path, dst_port_path);
@@ -158,7 +175,7 @@ ClientBroadcaster::send_disconnection(const Path& src_port_path, const Path& dst
void
-ClientBroadcaster::send_put(const Raul::URI& subject, const Shared::Resource::Properties& properties)
+ClientBroadcaster::put(const Raul::URI& subject, const Shared::Resource::Properties& properties)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->put(subject, properties);
@@ -170,7 +187,7 @@ ClientBroadcaster::send_put(const Raul::URI& subject, const Shared::Resource::Pr
* Like control changes, does not send update to client that set the property, if applicable.
*/
void
-ClientBroadcaster::send_property_change(const URI& subject, const URI& key, const Atom& value)
+ClientBroadcaster::set_property(const URI& subject, const URI& key, const Atom& value)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->set_property(subject, key, value);
@@ -184,7 +201,7 @@ ClientBroadcaster::send_property_change(const URI& subject, const URI& key, cons
* forcing clients to ignore things to avoid feedback loops etc).
*/
void
-ClientBroadcaster::send_port_value(const Path& port_path, const Raul::Atom& value)
+ClientBroadcaster::set_port_value(const Path& port_path, const Raul::Atom& value)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->set_port_value(port_path, value);
@@ -192,7 +209,15 @@ ClientBroadcaster::send_port_value(const Path& port_path, const Raul::Atom& valu
void
-ClientBroadcaster::send_activity(const Path& path)
+ClientBroadcaster::set_voice_value(const Path& port_path, uint32_t voice, const Raul::Atom& value)
+{
+ for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
+ (*i).second->set_voice_value(port_path, voice, value);
+}
+
+
+void
+ClientBroadcaster::activity(const Path& path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->activity(path);
@@ -215,7 +240,7 @@ ClientBroadcaster::send_object(const GraphObjectImpl* p, bool recursive)
/** Sends notification of an GraphObject's renaming
*/
void
-ClientBroadcaster::send_move(const Path& old_path, const Path& new_path)
+ClientBroadcaster::move(const Path& old_path, const Path& new_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
(*i).second->move(old_path, new_path);
diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp
index f13530ca..85524416 100644
--- a/src/engine/ClientBroadcaster.hpp
+++ b/src/engine/ClientBroadcaster.hpp
@@ -38,15 +38,12 @@ class ConnectionImpl;
/** Broadcaster for all clients.
*
- * This sends messages to all client simultaneously through the opaque
- * ClientInterface. The clients may be OSC driver, in process, theoretically
- * anything that implements ClientInterface.
- *
- * This also serves as the database of all registered clients.
+ * This is a ClientInterface that forwards all messages to all registered
+ * clients (for updating all clients on state changes in the engine).
*
* \ingroup engine
*/
-class ClientBroadcaster
+class ClientBroadcaster : public Shared::ClientInterface
{
public:
void register_client(const Raul::URI& uri, Shared::ClientInterface* client);
@@ -54,24 +51,54 @@ public:
Shared::ClientInterface* client(const Raul::URI& uri);
+ void send_plugins(const NodeFactory::Plugins& plugin_list);
+ void send_plugins_to(Shared::ClientInterface*, const NodeFactory::Plugins& plugin_list);
+
+ void send_object(const GraphObjectImpl* p, bool recursive);
+
+ // CommonInterface
+
void bundle_begin();
void bundle_end();
- // Error that isn't the direct result of a request
- void send_error(const std::string& msg);
+ void put(const Raul::URI& uri,
+ const Shared::Resource::Properties& properties);
- void send_plugins(const NodeFactory::Plugins& plugin_list);
- void send_object(const GraphObjectImpl* p, bool recursive);
- void send_deleted(const Raul::Path& path);
- void send_connection(const SharedPtr<const ConnectionImpl> connection);
- void send_disconnection(const Raul::Path& src_port_path, const Raul::Path& dst_port_path);
- void send_move(const Raul::Path& old_path, const Raul::Path& new_path);
- void send_put(const Raul::URI& subject, const Shared::Resource::Properties& properties);
- void send_property_change(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value);
- void send_port_value(const Raul::Path& port_path, const Raul::Atom& value);
- void send_activity(const Raul::Path& path);
+ void move(const Raul::Path& old_path,
+ const Raul::Path& new_path);
- void send_plugins_to(Shared::ClientInterface*, const NodeFactory::Plugins& plugin_list);
+ void del(const Raul::Path& path);
+
+ void connect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ void disconnect(const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
+
+ void set_property(const Raul::URI& subject,
+ const Raul::URI& predicate,
+ const Raul::Atom& value);
+
+ void set_port_value(const Raul::Path& port_path,
+ const Raul::Atom& value);
+
+ void set_voice_value(const Raul::Path& port_path,
+ uint32_t voice,
+ const Raul::Atom& value);
+
+ // ClientInterface
+
+ Raul::URI uri() const { return "ingen:broadcaster"; } ///< N/A
+
+ void response_ok(int32_t id) {} ///< N/A
+ void response_error(int32_t id, const std::string& msg) {} ///< N/A
+
+ void transfer_begin();
+ void transfer_end();
+
+ void error(const std::string& msg);
+
+ void activity(const Raul::Path& path);
private:
typedef std::map<Raul::URI, Shared::ClientInterface*> Clients;
diff --git a/src/engine/events/Connect.cpp b/src/engine/events/Connect.cpp
index a120aee4..a79fe243 100644
--- a/src/engine/events/Connect.cpp
+++ b/src/engine/events/Connect.cpp
@@ -186,7 +186,7 @@ Connect::post_process()
std::ostringstream ss;
if (_error == NO_ERROR) {
_responder->respond_ok();
- _engine.broadcaster()->send_connection(_connection);
+ _engine.broadcaster()->connect(_src_port_path, _dst_port_path);
return;
}
diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp
index 91e18dd0..956253d6 100644
--- a/src/engine/events/Delete.cpp
+++ b/src/engine/events/Delete.cpp
@@ -184,7 +184,7 @@ Delete::post_process()
_engine.broadcaster()->bundle_begin();
if (_disconnect_event)
_disconnect_event->post_process();
- _engine.broadcaster()->send_deleted(_path);
+ _engine.broadcaster()->del(_path);
_engine.broadcaster()->bundle_end();
_engine.maid()->push(_patch_node_listnode);
} else if (_patch_port_listnode) {
@@ -193,7 +193,7 @@ Delete::post_process()
_engine.broadcaster()->bundle_begin();
if (_disconnect_event)
_disconnect_event->post_process();
- _engine.broadcaster()->send_deleted(_path);
+ _engine.broadcaster()->del(_path);
_engine.broadcaster()->bundle_end();
_engine.maid()->push(_patch_port_listnode);
} else {
diff --git a/src/engine/events/Disconnect.cpp b/src/engine/events/Disconnect.cpp
index c0fc9656..007886f1 100644
--- a/src/engine/events/Disconnect.cpp
+++ b/src/engine/events/Disconnect.cpp
@@ -207,7 +207,7 @@ Disconnect::post_process()
{
if (_error == NO_ERROR) {
_responder->respond_ok();
- _engine.broadcaster()->send_disconnection(_src_port->path(), _dst_port->path());
+ _engine.broadcaster()->disconnect(_src_port->path(), _dst_port->path());
} else {
string msg = "Unable to disconnect ";
msg.append(_src_port_path.str() + " -> " + _dst_port_path.str());
diff --git a/src/engine/events/Move.cpp b/src/engine/events/Move.cpp
index d8e119f5..42ae88ca 100644
--- a/src/engine/events/Move.cpp
+++ b/src/engine/events/Move.cpp
@@ -117,7 +117,7 @@ Move::post_process()
if (_error == NO_ERROR) {
_responder->respond_ok();
- _engine.broadcaster()->send_move(_old_path, _new_path);
+ _engine.broadcaster()->move(_old_path, _new_path);
} else {
if (_error == OBJECT_EXISTS)
msg.append("Object already exists at ").append(_new_path.str());
diff --git a/src/engine/events/SendPortActivity.cpp b/src/engine/events/SendPortActivity.cpp
index bf927da7..17bae7e5 100644
--- a/src/engine/events/SendPortActivity.cpp
+++ b/src/engine/events/SendPortActivity.cpp
@@ -27,7 +27,7 @@ namespace Events {
void
SendPortActivity::post_process()
{
- _engine.broadcaster()->send_activity(_port->path());
+ _engine.broadcaster()->activity(_port->path());
}
diff --git a/src/engine/events/SendPortValue.cpp b/src/engine/events/SendPortValue.cpp
index dbf0073f..4088568f 100644
--- a/src/engine/events/SendPortValue.cpp
+++ b/src/engine/events/SendPortValue.cpp
@@ -33,9 +33,9 @@ SendPortValue::post_process()
// FIXME...
if (_omni) {
- _engine.broadcaster()->send_port_value(_port->path(), _value);
+ _engine.broadcaster()->set_port_value(_port->path(), _value);
} else {
- _engine.broadcaster()->send_port_value(_port->path(), _value);
+ _engine.broadcaster()->set_port_value(_port->path(), _value);
}
}
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index 6c8c25f3..5669b63d 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -257,7 +257,7 @@ SetMetadata::post_process()
switch (_error) {
case NO_ERROR:
_responder->respond_ok();
- _engine.broadcaster()->send_put(_subject, _properties);
+ _engine.broadcaster()->put(_subject, _properties);
if (_create_event)
_create_event->post_process();
break;
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index de1190fb..6c87ef94 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -230,7 +230,10 @@ SetPortValue::post_process()
case NO_ERROR:
assert(_port != NULL);
_responder->respond_ok();
- _engine.broadcaster()->send_port_value(_port_path, _value);
+ if (_omni)
+ _engine.broadcaster()->set_port_value(_port_path, _value);
+ else
+ _engine.broadcaster()->set_voice_value(_port_path, _voice_num, _value);
break;
case TYPE_MISMATCH:
ss << "Illegal value type " << _value.type()