diff options
author | David Robillard <d@drobilla.net> | 2006-12-08 22:32:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-12-08 22:32:34 +0000 |
commit | d2d755b0db3b4779d581c7a70841609257250c12 (patch) | |
tree | 826098242c947ac3f5994b1a591a7853275972fc /src/libs | |
parent | 26d0171f9bbc4af8036c704d3a4cb69a5d9fe942 (diff) | |
download | ingen-d2d755b0db3b4779d581c7a70841609257250c12.tar.gz ingen-d2d755b0db3b4779d581c7a70841609257250c12.tar.bz2 ingen-d2d755b0db3b4779d581c7a70841609257250c12.zip |
Fixed plugin type issues
git-svn-id: http://svn.drobilla.net/lad/ingen@211 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/client/OSCClientReceiver.cpp | 6 | ||||
-rw-r--r-- | src/libs/client/PluginModel.h | 26 | ||||
-rw-r--r-- | src/libs/client/Serializer.cpp | 20 | ||||
-rw-r--r-- | src/libs/client/SigClientInterface.h | 6 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 4 | ||||
-rw-r--r-- | src/libs/client/Store.h | 2 | ||||
-rw-r--r-- | src/libs/client/ThreadedSigClientInterface.h | 6 | ||||
-rw-r--r-- | src/libs/engine/ClientBroadcaster.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/OSCClientSender.cpp | 3 | ||||
-rw-r--r-- | src/libs/engine/OSCClientSender.h | 1 | ||||
-rw-r--r-- | src/libs/engine/ObjectSender.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/Plugin.h | 4 | ||||
-rw-r--r-- | src/libs/engine/events/RequestPluginEvent.cpp | 2 |
13 files changed, 56 insertions, 28 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 14bff1f1..0dbf49ec 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -139,7 +139,7 @@ OSCClientReceiver::setup_callbacks() { lo_server_thread_add_method(_st, "/om/response", "iis", response_cb, this); lo_server_thread_add_method(_st, "/om/num_plugins", "i", num_plugins_cb, this); - lo_server_thread_add_method(_st, "/om/plugin", "ss", plugin_cb, this); + lo_server_thread_add_method(_st, "/om/plugin", "sss", plugin_cb, this); lo_server_thread_add_method(_st, "/om/new_patch", "si", new_patch_cb, this); lo_server_thread_add_method(_st, "/om/destroyed", "s", destroyed_cb, this); lo_server_thread_add_method(_st, "/om/patch_enabled", "s", patch_enabled_cb, this); @@ -385,8 +385,8 @@ OSCClientReceiver::m_num_plugins_cb(const char* path, const char* types, lo_arg* int OSCClientReceiver::m_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) { - assert(argc == 2 && !strcmp(types, "ss")); - new_plugin(&argv[0]->s, &argv[1]->s); // type, uri + assert(argc == 3 && !strcmp(types, "sss")); + new_plugin(&argv[0]->s, &argv[1]->s, &argv[2]->s); // type, uri return 0; } diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h index 51a251da..76edc737 100644 --- a/src/libs/client/PluginModel.h +++ b/src/libs/client/PluginModel.h @@ -35,11 +35,11 @@ class PluginModel public: enum Type { LV2, LADSPA, DSSI, Internal, Patch }; - PluginModel(const string& uri, const string& name) + PluginModel(const string& uri, const string& type_uri, const string& name) : m_uri(uri), m_name(name) { - //cerr << "FIXME: plugin type" << endl; + set_type_from_uri(type_uri); } Type type() const { return m_type; } @@ -49,15 +49,25 @@ public: const string& name() const { return m_name; } void name(const string& s) { m_name = s; } - const char* const type_string() const { + /*const char* const type_string() const { if (m_type == LV2) return "LV2"; else if (m_type == LADSPA) return "LADSPA"; else if (m_type == DSSI) return "DSSI"; else if (m_type == Internal) return "Internal"; else if (m_type == Patch) return "Patch"; else return ""; - } + }*/ + const char* const type_uri() const { + if (m_type == LV2) return "ingen:LV2"; + else if (m_type == LADSPA) return "ingen:LADSPA"; + else if (m_type == DSSI) return "ingen:DSSI"; + else if (m_type == Internal) return "ingen:Internal"; + else if (m_type == Patch) return "ingen:Patch"; + else return ""; + } + + /** DEPRECATED */ void set_type(const string& type_string) { if (type_string == "LV2") m_type = LV2; else if (type_string == "LADSPA") m_type = LADSPA; @@ -65,6 +75,14 @@ public: else if (type_string == "Internal") m_type = Internal; else if (type_string == "Patch") m_type = Patch; } + + void set_type_from_uri(const string& type_uri) { + if (type_uri.substr(0, 6) != "ingen:") { + cerr << "INVALID TYPE STRING!" << endl; + } else { + set_type(type_uri.substr(6)); + } + } string default_node_name() { return Path::nameify(m_name); } diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index f40d8d67..3984a49a 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -198,9 +198,12 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch, unsigned depth) { assert(_serializer); - const RdfId patch_id = (depth == 0) - ? RdfId(RdfId::RESOURCE, string("#") + patch->path().substr(1)) - : path_to_node_id(patch->path()); // anonymous + RdfId patch_id = path_to_node_id(patch->path()); // anonymous + + if (patch->path().length() < 2) + patch_id = RdfId(RdfId::RESOURCE, string("")); + else if (depth == 0) + patch_id = RdfId(RdfId::RESOURCE, string("#") + patch->path().substr(1)); _writer.write( patch_id, @@ -313,11 +316,11 @@ Serializer::serialize_connection(SharedPtr<ConnectionModel> connection) throw (s path_to_node_id(connection->src_port_path()).to_string() + "-" + path_to_node_id(connection->dst_port_path()).to_string()); - /* - const string src_port_rel_path = connection->src_port_path().substr(connection->patch_path().length()); - const string dst_port_rel_path = connection->dst_port_path().substr(connection->patch_path().length()); -*/ - _writer.write(connection_id, NS_RDF("type"), NS_INGEN("Connection")); + _writer.write(path_to_node_id(connection->dst_port_path()), + NS_INGEN("connectedTo"), + path_to_node_id(connection->src_port_path())); + + /*_writer.write(connection_id, NS_RDF("type"), NS_INGEN("Connection")); _writer.write(connection_id, NS_INGEN("source"), @@ -326,6 +329,7 @@ Serializer::serialize_connection(SharedPtr<ConnectionModel> connection) throw (s _writer.write(connection_id, NS_INGEN("destination"), path_to_node_id(connection->dst_port_path())); + */ } diff --git a/src/libs/client/SigClientInterface.h b/src/libs/client/SigClientInterface.h index 9f8a4537..d041157a 100644 --- a/src/libs/client/SigClientInterface.h +++ b/src/libs/client/SigClientInterface.h @@ -47,7 +47,7 @@ public: sigc::signal<void> bundle_end_sig; sigc::signal<void, string> error_sig; sigc::signal<void, uint32_t> num_plugins_sig; - sigc::signal<void, string, string> new_plugin_sig; + sigc::signal<void, string, string, string> new_plugin_sig; sigc::signal<void, string, uint32_t> new_patch_sig; sigc::signal<void, string, string, bool, uint32_t> new_node_sig; sigc::signal<void, string, string, bool> new_port_sig; @@ -85,8 +85,8 @@ protected: void error(string msg) { error_sig.emit(msg); } - void new_plugin(string uri, string name) - { new_plugin_sig.emit(uri, name); } + void new_plugin(string uri, string type_uri, string name) + { new_plugin_sig.emit(uri, type_uri, name); } void new_patch(string path, uint32_t poly) { new_patch_sig.emit(path, poly); } diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 30942ae3..75667ee6 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -343,9 +343,9 @@ Store::destruction_event(const Path& path) } void -Store::new_plugin_event(const string& uri, const string& name) +Store::new_plugin_event(const string& uri, const string& type_uri, const string& name) { - SharedPtr<PluginModel> p(new PluginModel(uri, name)); + SharedPtr<PluginModel> p(new PluginModel(uri, type_uri, name)); add_plugin(p); resolve_plugin_orphans(p); } diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h index d1599423..68103482 100644 --- a/src/libs/client/Store.h +++ b/src/libs/client/Store.h @@ -83,7 +83,7 @@ private: // Slots for SigClientInterface signals void destruction_event(const Path& path); - void new_plugin_event(const string& uri, const string& name); + void new_plugin_event(const string& uri, const string& type_uri, const string& name); void new_patch_event(const Path& path, uint32_t poly); void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); void new_port_event(const Path& path, const string& data_type, bool is_output); diff --git a/src/libs/client/ThreadedSigClientInterface.h b/src/libs/client/ThreadedSigClientInterface.h index 57afd0fa..e286fc95 100644 --- a/src/libs/client/ThreadedSigClientInterface.h +++ b/src/libs/client/ThreadedSigClientInterface.h @@ -85,8 +85,8 @@ public: void error(string msg) { push_sig(sigc::bind(error_slot, msg)); } - void new_plugin(string uri, string name) - { push_sig(sigc::bind(new_plugin_slot, uri, name)); } + void new_plugin(string uri, string type_uri, string name) + { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, name)); } void new_patch(string path, uint32_t poly) { push_sig(sigc::bind(new_patch_slot, path, poly)); } @@ -146,7 +146,7 @@ private: sigc::slot<void, uint32_t> num_plugins_slot; sigc::slot<void, int32_t, bool, string> response_slot; sigc::slot<void, string> error_slot; - sigc::slot<void, string, string> new_plugin_slot; + sigc::slot<void, string, string, string> new_plugin_slot; sigc::slot<void, string, uint32_t> new_patch_slot; sigc::slot<void, string, string, bool, int> new_node_slot; sigc::slot<void, string, string, bool> new_port_slot; diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 872cbb14..57f9a65d 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -175,7 +175,7 @@ ClientBroadcaster::send_plugins_to(SharedPtr<ClientInterface> client, const list for (list<Plugin*>::const_iterator i = plugin_list.begin(); i != plugin_list.end(); ++i) { const Plugin* const plugin = *i; - client->new_plugin(plugin->uri(), plugin->name()); + client->new_plugin(plugin->uri(), plugin->type_uri(), plugin->name()); } client->transfer_end(); diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 2032e47b..eaceb14c 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -493,13 +493,14 @@ OSCClientSender::control_change(string port_path, float value) * \arg \b name (string) - Descriptive human-readable name of plugin (ie "ADSR Envelope") */ void -OSCClientSender::new_plugin(string uri, string name) +OSCClientSender::new_plugin(string uri, string type_uri, string name) { if (!_enabled) return; lo_message m = lo_message_new(); lo_message_add_string(m, uri.c_str()); + lo_message_add_string(m, type_uri.c_str()); lo_message_add_string(m, name.c_str()); //if (_transfer) diff --git a/src/libs/engine/OSCClientSender.h b/src/libs/engine/OSCClientSender.h index f45812af..12ae8bdf 100644 --- a/src/libs/engine/OSCClientSender.h +++ b/src/libs/engine/OSCClientSender.h @@ -77,6 +77,7 @@ public: void error(string msg); virtual void new_plugin(string uri, + string type_uri, string name); virtual void new_patch(string path, uint32_t poly); diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 174f30be..6e93f405 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -170,7 +170,7 @@ ObjectSender::send_plugins(ClientInterface* client, const list<Plugin*>& plugs) */ for (list<Plugin*>::const_iterator j = plugs.begin(); j != plugs.end(); ++j) { const Plugin* const p = *j; - client->new_plugin(p->uri(), p->name()); + client->new_plugin(p->uri(), p->type_uri(), p->name()); } /* plugin = (*j); diff --git a/src/libs/engine/Plugin.h b/src/libs/engine/Plugin.h index bdd96ed1..0b573cb1 100644 --- a/src/libs/engine/Plugin.h +++ b/src/libs/engine/Plugin.h @@ -112,6 +112,10 @@ public: else if (_type == Patch) return "Patch"; else return ""; } + + string type_uri() const { + return string("ingen:") + type_string(); + } void set_type(const string& type_string) { if (type_string == "LADSPA") _type = LADSPA; diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index 4b509f78..8663f40a 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -66,7 +66,7 @@ RequestPluginEvent::post_process() _responder->respond_ok(); assert(m_plugin->uri() == m_uri); - m_client->new_plugin(m_uri, m_plugin->name()); + m_client->new_plugin(m_uri, m_plugin->type_uri(), m_plugin->name()); } else { _responder->respond_error("Unable to find client to send plugin."); |