diff options
Diffstat (limited to 'src/libs/client')
-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 |
7 files changed, 46 insertions, 24 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; |