diff options
author | David Robillard <d@drobilla.net> | 2007-04-11 21:49:28 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-04-11 21:49:28 +0000 |
commit | 099e01628ef57f07efa69954893b0873bbb7f367 (patch) | |
tree | 1743e40286840ef842a50ce3d11f006d2ee963f0 /src/libs/client | |
parent | 98d36c7a799d8514cfa570f3cf7083c695e21e7b (diff) | |
download | ingen-099e01628ef57f07efa69954893b0873bbb7f367.tar.gz ingen-099e01628ef57f07efa69954893b0873bbb7f367.tar.bz2 ingen-099e01628ef57f07efa69954893b0873bbb7f367.zip |
Updated/cleaned up OSC namespace (/om/synth -> /ingen etc).
OSC documentation fixes.
git-svn-id: http://svn.drobilla.net/lad/ingen@443 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 13 | ||||
-rw-r--r-- | src/libs/client/OSCClientReceiver.cpp | 44 | ||||
-rw-r--r-- | src/libs/client/OSCEngineSender.cpp | 58 | ||||
-rw-r--r-- | src/libs/client/PortModel.h | 2 | ||||
-rw-r--r-- | src/libs/client/Serializer.cpp | 168 | ||||
-rw-r--r-- | src/libs/client/Serializer.h | 14 |
6 files changed, 58 insertions, 241 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index f174fb1e..97e6583d 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -149,22 +149,21 @@ DeprecatedLoader::add_metadata(MetadataMap& data, string old_key, string value) * is 0, it will be loaded from file. Otherwise the given values will * be used. * - * @param wait If true the patch will be checked for existence before - * loading everything in to it (to prevent messing up existing patches - * that exist at the path this one should load as). - * - * @param existing If true, the patch will be loaded into a currently - * existing patch (ie a merging will take place). Errors will result - * if Nodes of conflicting names exist. + * @param filename Local name of file to load patch from * * @param parent_path Patch to load this patch as a child of (empty string to load * to the root patch) * * @param name Name of this patch (loaded/generated if the empty string) + * @param poly Polyphony of this patch (loaded/generated if 0) * * @param initial_data will be set last, so values passed there will override * any values loaded from the patch file. * + * @param existing If true, the patch will be loaded into a currently + * existing patch (ie a merging will take place). Errors will result + * if Nodes of conflicting names exist. + * * Returns the path of the newly created patch. */ string diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 6fb39a55..7545b141 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -76,8 +76,8 @@ OSCClientReceiver::start() // Print all incoming messages lo_server_thread_add_method(_st, NULL, NULL, generic_cb, NULL); - //lo_server_thread_add_method(_st, "/om/response/ok", "i", om_response_ok_cb, this); - //lo_server_thread_add_method(_st, "/om/response/error", "is", om_responseerror_cb, this); + //lo_server_thread_add_method(_st, "/ingen/response/ok", "i", om_response_ok_cb, this); + //lo_server_thread_add_method(_st, "/ingen/response/error", "is", om_responseerror_cb, this); setup_callbacks(); @@ -144,23 +144,23 @@ OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv void 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", "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); - lo_server_thread_add_method(_st, "/om/patch_disabled", "s", patch_disabled_cb, this); - lo_server_thread_add_method(_st, "/om/patch_cleared", "s", patch_cleared_cb, this); - lo_server_thread_add_method(_st, "/om/object_renamed", "ss", object_renamed_cb, this); - lo_server_thread_add_method(_st, "/om/new_connection", "ss", connection_cb, this); - lo_server_thread_add_method(_st, "/om/disconnection", "ss", disconnection_cb, this); - lo_server_thread_add_method(_st, "/om/new_node", "ssii", new_node_cb, this); - lo_server_thread_add_method(_st, "/om/new_port", "ssi", new_port_cb, this); - lo_server_thread_add_method(_st, "/om/metadata/update", NULL, metadata_update_cb, this); - lo_server_thread_add_method(_st, "/om/control_change", "sf", control_change_cb, this); - lo_server_thread_add_method(_st, "/om/program_add", "siis", program_add_cb, this); - lo_server_thread_add_method(_st, "/om/program_remove", "sii", program_remove_cb, this); + lo_server_thread_add_method(_st, "/ingen/response", "iis", response_cb, this); + lo_server_thread_add_method(_st, "/ingen/num_plugins", "i", num_plugins_cb, this); + lo_server_thread_add_method(_st, "/ingen/plugin", "sss", plugin_cb, this); + lo_server_thread_add_method(_st, "/ingen/new_patch", "si", new_patch_cb, this); + lo_server_thread_add_method(_st, "/ingen/destroyed", "s", destroyed_cb, this); + lo_server_thread_add_method(_st, "/ingen/patch_enabled", "s", patch_enabled_cb, this); + lo_server_thread_add_method(_st, "/ingen/patch_disabled", "s", patch_disabled_cb, this); + lo_server_thread_add_method(_st, "/ingen/patch_cleared", "s", patch_cleared_cb, this); + lo_server_thread_add_method(_st, "/ingen/object_renamed", "ss", object_renamed_cb, this); + lo_server_thread_add_method(_st, "/ingen/new_connection", "ss", connection_cb, this); + lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this); + lo_server_thread_add_method(_st, "/ingen/new_node", "ssii", new_node_cb, this); + lo_server_thread_add_method(_st, "/ingen/new_port", "ssi", new_port_cb, this); + lo_server_thread_add_method(_st, "/ingen/metadata_update", NULL, metadata_update_cb, this); + lo_server_thread_add_method(_st, "/ingen/control_change", "sf", control_change_cb, this); + lo_server_thread_add_method(_st, "/ingen/program_add", "siis", program_add_cb, this); + lo_server_thread_add_method(_st, "/ingen/program_remove", "sii", program_remove_cb, this); } @@ -375,8 +375,8 @@ OSCClientReceiver::_response_cb(const char* path, const char* types, lo_arg** ar } -/** Number of plugins in engine, should precede /om/plugin messages in response - * to a /om/send_plugins +/** Number of plugins in engine, should precede /ingen/plugin messages in response + * to a /ingen/send_plugins */ int OSCClientReceiver::_num_plugins_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) @@ -387,7 +387,7 @@ OSCClientReceiver::_num_plugins_cb(const char* path, const char* types, lo_arg** } -/** A plugin info response from the server, in response to a /send_plugins +/** A plugin info response from the server, in response to an /ingen/send_plugins */ int OSCClientReceiver::_plugin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg) diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 70ab9ca2..11bbc3d7 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -112,7 +112,7 @@ OSCEngineSender::register_client(ClientKey key, SharedPtr<ClientInterface> clien { // FIXME: use parameters.. er, somehow. assert(_engine_addr); - lo_send(_engine_addr, "/om/engine/register_client", "i", next_id()); + lo_send(_engine_addr, "/ingen/register_client", "i", next_id()); } @@ -120,7 +120,7 @@ void OSCEngineSender::unregister_client(ClientKey key) { assert(_engine_addr); - lo_send(_engine_addr, "/om/engine/unregister_client", "i", next_id()); + lo_send(_engine_addr, "/ingen/unregister_client", "i", next_id()); } @@ -130,7 +130,7 @@ void OSCEngineSender::load_plugins() { assert(_engine_addr); - lo_send(_engine_addr, "/om/engine/load_plugins", "i", next_id()); + lo_send(_engine_addr, "/ingen/load_plugins", "i", next_id()); } @@ -138,7 +138,7 @@ void OSCEngineSender::activate() { assert(_engine_addr); - lo_send(_engine_addr, "/om/engine/activate", "i", next_id()); + lo_send(_engine_addr, "/ingen/activate", "i", next_id()); } @@ -146,7 +146,7 @@ void OSCEngineSender::deactivate() { assert(_engine_addr); - lo_send(_engine_addr, "/om/engine/deactivate", "i", next_id()); + lo_send(_engine_addr, "/ingen/deactivate", "i", next_id()); } @@ -154,7 +154,7 @@ void OSCEngineSender::quit() { assert(_engine_addr); - lo_send(_engine_addr, "/om/engine/quit", "i", next_id()); + lo_send(_engine_addr, "/ingen/quit", "i", next_id()); } @@ -166,7 +166,7 @@ OSCEngineSender::create_patch(const string& path, uint32_t poly) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/create_patch", "isi", + lo_send(_engine_addr, "/ingen/create_patch", "isi", next_id(), path.c_str(), poly); @@ -179,7 +179,7 @@ OSCEngineSender::create_port(const string& path, bool is_output) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/create_port", "issi", + lo_send(_engine_addr, "/ingen/create_port", "issi", next_id(), path.c_str(), data_type.c_str(), @@ -193,7 +193,7 @@ OSCEngineSender::create_node(const string& path, bool polyphonic) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/create_node", "issi", + lo_send(_engine_addr, "/ingen/create_node", "issi", next_id(), path.c_str(), plugin_uri.c_str(), @@ -213,7 +213,7 @@ OSCEngineSender::create_node(const string& path, bool polyphonic) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/create_node", "issssi", + lo_send(_engine_addr, "/ingen/create_node", "issssi", next_id(), path.c_str(), plugin_type.c_str(), @@ -228,7 +228,7 @@ OSCEngineSender::rename(const string& old_path, const string& new_name) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/rename", "iss", + lo_send(_engine_addr, "/ingen/rename", "iss", next_id(), old_path.c_str(), new_name.c_str()); @@ -239,7 +239,7 @@ void OSCEngineSender::destroy(const string& path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/destroy", "is", + lo_send(_engine_addr, "/ingen/destroy", "is", next_id(), path.c_str()); } @@ -249,7 +249,7 @@ void OSCEngineSender::clear_patch(const string& patch_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/clear_patch", "is", + lo_send(_engine_addr, "/ingen/clear_patch", "is", next_id(), patch_path.c_str()); } @@ -259,7 +259,7 @@ void OSCEngineSender::enable_patch(const string& patch_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/enable_patch", "is", + lo_send(_engine_addr, "/ingen/enable_patch", "is", next_id(), patch_path.c_str()); } @@ -269,7 +269,7 @@ void OSCEngineSender::disable_patch(const string& patch_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/disable_patch", "is", + lo_send(_engine_addr, "/ingen/disable_patch", "is", next_id(), patch_path.c_str()); } @@ -280,7 +280,7 @@ OSCEngineSender::connect(const string& src_port_path, const string& dst_port_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/connect", "iss", + lo_send(_engine_addr, "/ingen/connect", "iss", next_id(), src_port_path.c_str(), dst_port_path.c_str()); @@ -292,7 +292,7 @@ OSCEngineSender::disconnect(const string& src_port_path, const string& dst_port_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/disconnect", "iss", + lo_send(_engine_addr, "/ingen/disconnect", "iss", next_id(), src_port_path.c_str(), dst_port_path.c_str()); @@ -303,7 +303,7 @@ void OSCEngineSender::disconnect_all(const string& node_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/disconnect_all", "is", + lo_send(_engine_addr, "/ingen/disconnect_all", "is", next_id(), node_path.c_str()); } @@ -314,7 +314,7 @@ OSCEngineSender::set_port_value(const string& port_path, float val) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/set_port_value", "isf", + lo_send(_engine_addr, "/ingen/set_port_value", "isf", next_id(), port_path.c_str(), val); @@ -327,7 +327,7 @@ OSCEngineSender::set_port_value(const string& port_path, float val) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/set_port_value", "isif", + lo_send(_engine_addr, "/ingen/set_port_value", "isif", next_id(), port_path.c_str(), voice, @@ -340,7 +340,7 @@ OSCEngineSender::set_port_value_queued(const string& port_path, float val) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/set_port_value_queued", "isf", + lo_send(_engine_addr, "/ingen/set_port_value_queued", "isf", next_id(), port_path.c_str(), val); @@ -365,7 +365,7 @@ void OSCEngineSender::midi_learn(const string& node_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/synth/midi_learn", "is", + lo_send(_engine_addr, "/ingen/midi_learn", "is", next_id(), node_path.c_str()); } @@ -383,7 +383,7 @@ OSCEngineSender::set_metadata(const string& obj_path, lo_message_add_string(m, obj_path.c_str()); lo_message_add_string(m, predicate.c_str()); Raul::AtomLiblo::lo_message_add_atom(m, value); - lo_send_message(_engine_addr, "/om/metadata/set", m); + lo_send_message(_engine_addr, "/ingen/set_metadata", m); } @@ -393,7 +393,7 @@ void OSCEngineSender::ping() { assert(_engine_addr); - lo_send(_engine_addr, "/om/ping", "i", next_id()); + lo_send(_engine_addr, "/ingen/ping", "i", next_id()); } @@ -401,7 +401,7 @@ void OSCEngineSender::request_plugin(const string& uri) { assert(_engine_addr); - lo_send(_engine_addr, "/om/request/plugin", "is", + lo_send(_engine_addr, "/ingen/request_plugin", "is", next_id(), uri.c_str()); } @@ -411,7 +411,7 @@ void OSCEngineSender::request_object(const string& path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/request/object", "is", + lo_send(_engine_addr, "/ingen/request_object", "is", next_id(), path.c_str()); } @@ -421,7 +421,7 @@ void OSCEngineSender::request_port_value(const string& port_path) { assert(_engine_addr); - lo_send(_engine_addr, "/om/request/port_value", "is", + lo_send(_engine_addr, "/ingen/request_port_value", "is", next_id(), port_path.c_str()); } @@ -431,7 +431,7 @@ void OSCEngineSender::request_plugins() { assert(_engine_addr); - lo_send(_engine_addr, "/om/request/plugins", "i", next_id()); + lo_send(_engine_addr, "/ingen/request_plugins", "i", next_id()); } @@ -439,7 +439,7 @@ void OSCEngineSender::request_all_objects() { assert(_engine_addr); - lo_send(_engine_addr, "/om/request/all_objects", "i", next_id()); + lo_send(_engine_addr, "/ingen/request_all_objects", "i", next_id()); } diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h index 35a19b56..15a381d4 100644 --- a/src/libs/client/PortModel.h +++ b/src/libs/client/PortModel.h @@ -34,7 +34,7 @@ namespace Client { /** Model of a port. * - * \ingroup IngenClient. + * \ingroup IngenClient */ class PortModel : public ObjectModel { diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index 1374ab12..1b274635 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -367,174 +367,6 @@ Serializer::serialize_connection(SharedPtr<ConnectionModel> connection) throw (s */ } -#if 0 -/** Load a patch into the engine (e.g. from a patch file). - * - * @param base_uri Base URI (e.g. URI of the file to load from). - * - * @param data_path Path of the patch relative to base_uri - * (e.g. relative to file root patch). - * - * @param engine_path Path in the engine for the newly created patch - * (i.e. 'destination' of the load). - * - * @param initial_data will be set last, so values passed there will override - * any values loaded from the patch file (or values in the existing patch). - * - * @param merge If true, the loaded patch's contents will be loaded into a - * currently existing patch. Errors may result if Nodes of conflicting names - * (etc) exist - the loaded patch will take precendence (ie overwriting - * existing values). If false and the patch at @a load_path already exists, - * load is aborted and false is returned. - * - * @param poly Polyphony of new loaded patch if given, otherwise polyphony - * will be loaded (unless saved polyphony isn't found, in which case it's 1). - * - * Returns whether or not patch was loaded. - */ -bool -Serializer::load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional<const Path&> engine_parent, - optional<const string&> engine_name, - optional<size_t> engine_poly) - -{ - cerr << "LOAD: " << data_base_uri << ", " << data_path << ", " << engine_parent << endl; -#if 0 - cerr << "[Serializer] Loading patch " << filename << "" << endl; - - Path path = "/"; // path of the new patch - - const bool load_name = (name == ""); - const bool load_poly = (poly == 0); - - if (initial_data.find("filename") == initial_data.end()) - initial_data["filename"] = Atom(filename.c_str()); // FIXME: URL? - - xmlDocPtr doc = xmlParseFile(filename.c_str()); - - if (!doc) { - cerr << "Unable to parse patch file." << endl; - return ""; - } - - xmlNodePtr cur = xmlDocGetRootElement(doc); - - if (!cur) { - cerr << "Empty document." << endl; - xmlFreeDoc(doc); - return ""; - } - - if (xmlStrcmp(cur->name, (const xmlChar*) "patch")) { - cerr << "File is not an Ingen patch file (root node != <patch>)" << endl; - xmlFreeDoc(doc); - return ""; - } - - xmlChar* key = NULL; - cur = cur->xmlChildrenNode; - - // Load Patch attributes - while (cur != NULL) { - key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - - if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { - if (load_name) { - assert(key != NULL); - if (parent_path != "") - path = Path(parent_path).base() + Path::nameify((char*)key); - } - } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { - if (load_poly) { - poly = atoi((char*)key); - } - } else if (xmlStrcmp(cur->name, (const xmlChar*)"connection") - && xmlStrcmp(cur->name, (const xmlChar*)"node") - && xmlStrcmp(cur->name, (const xmlChar*)"subpatch") - && xmlStrcmp(cur->name, (const xmlChar*)"filename") - && xmlStrcmp(cur->name, (const xmlChar*)"preset")) { - // Don't know what this tag is, add it as metadata without overwriting - // (so caller can set arbitrary parameters which will be preserved) - if (key) - if (initial_data.find((const char*)cur->name) == initial_data.end()) - initial_data[(const char*)cur->name] = (const char*)key; - } - - xmlFree(key); - key = NULL; // Avoid a (possible?) double free - - cur = cur->next; - } - - if (poly == 0) - poly = 1; - - // Create it, if we're not merging - if (!existing) - _engine->create_patch_with_data(path, poly, initial_data); - - // Load nodes - cur = xmlDocGetRootElement(doc)->xmlChildrenNode; - while (cur != NULL) { - if ((!xmlStrcmp(cur->name, (const xmlChar*)"node"))) - load_node(path, doc, cur); - - cur = cur->next; - } - - // Load subpatches - cur = xmlDocGetRootElement(doc)->xmlChildrenNode; - while (cur != NULL) { - if ((!xmlStrcmp(cur->name, (const xmlChar*)"subpatch"))) { - load_subpatch(path, doc, cur); - } - cur = cur->next; - } - - // Load connections - cur = xmlDocGetRootElement(doc)->xmlChildrenNode; - while (cur != NULL) { - if ((!xmlStrcmp(cur->name, (const xmlChar*)"connection"))) { - load_connection(path, doc, cur); - } - cur = cur->next; - } - - - // Load presets (control values) - cerr << "FIXME: load preset\n"; - /*cur = xmlDocGetRootElement(doc)->xmlChildrenNode; - while (cur != NULL) { - if ((!xmlStrcmp(cur->name, (const xmlChar*)"preset"))) { - load_preset(pm, doc, cur); - assert(preset_model != NULL); - if (preset_model->name() == "default") - _engine->set_preset(pm->path(), preset_model); - } - cur = cur->next; - } - */ - - xmlFreeDoc(doc); - xmlCleanupParser(); - - // Done above.. late enough? - //_engine->set_metadata_map(path, initial_data); - - if (!existing) - _engine->enable_patch(path); - - _load_path_translations.clear(); - - return path; -#endif - return "/FIXME"; -} -#endif } // namespace Client } // namespace Ingen diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h index 45407e52..83e85bf8 100644 --- a/src/libs/client/Serializer.h +++ b/src/libs/client/Serializer.h @@ -61,20 +61,6 @@ class Serializer public: Serializer(); - //void path(const string& path) { _patch_search_path = path; } - //const string& path() { return _patch_search_path; } - - //string find_file(const string& filename, const string& additional_path = ""); - - /*bool load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional<const Path&> engine_parent = optional<const Path&>(), - optional<const string&> engine_name = optional<const string&>(), - optional<size_t> engine_poly = optional<size_t>()); - */ - void start_to_filename(const string& filename) throw (std::logic_error); void start_to_string() throw (std::logic_error); void serialize(SharedPtr<ObjectModel> object) throw (std::logic_error); |