diff options
author | David Robillard <d@drobilla.net> | 2010-03-06 10:23:19 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-03-06 10:23:19 +0000 |
commit | 059f20c9666234f2be01498ee04f1e7ee795ba8f (patch) | |
tree | ef0d53073d53012aeaa7d084fccf477b166c0684 /src/client/DeprecatedLoader.cpp | |
parent | 085a451dfec54126be1b9346899c81d82e6eb58e (diff) | |
download | ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.gz ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.bz2 ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.zip |
Save Ingen patches as working standard LV2 plugin bundles.
This allows you to create an Ingen patch in Ingen running as a Jack client,
save it, then load that patch as an LV2 plugin in any LV2 compliant host.
Eliminate (hopefully) all static data in the engine (for multiple instantiations in a single process).
More API/ABI stable interface for Ingen::Shared::World.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2533 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client/DeprecatedLoader.cpp')
-rw-r--r-- | src/client/DeprecatedLoader.cpp | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index ac71a32d..a9c7f895 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -212,15 +212,13 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, size_t poly = 0; - const LV2URIMap& uris = Shared::LV2URIMap::instance(); - /* Use parameter overridden polyphony, if given */ - GraphObject::Properties::iterator poly_param = initial_data.find(uris.ingen_polyphony); + GraphObject::Properties::iterator poly_param = initial_data.find(_uris->ingen_polyphony); if (poly_param != initial_data.end() && poly_param->second.type() == Atom::INT) poly = poly_param->second.get_int32(); - if (initial_data.find(uris.ingen_document) == initial_data.end()) - initial_data.insert(make_pair(uris.ingen_document, filename)); + if (initial_data.find(_uris->ingen_document) == initial_data.end()) + initial_data.insert(make_pair(_uris->ingen_document, filename)); xmlDocPtr doc = xmlParseFile(filename.c_str()); @@ -284,8 +282,8 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, // Create it, if we're not merging if (!existing && !path.is_root()) { Resource::Properties props; - props.insert(make_pair(uris.rdf_type, uris.ingen_Patch)); - props.insert(make_pair(uris.ingen_polyphony, Atom((int32_t)poly))); + props.insert(make_pair(_uris->rdf_type, _uris->ingen_Patch)); + props.insert(make_pair(_uris->ingen_polyphony, Atom((int32_t)poly))); _engine->put(path, props); for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_property(path, i->first, i->second); @@ -330,7 +328,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, for ( ; i != pm->controls().end(); ++i) { const float value = i->value(); _engine->set_property(translate_load_path(i->port_path().str()), - uris.ingen_value, Atom(value)); + _uris->ingen_value, Atom(value)); } } else { LOG(warn) << "Unknown preset `" << pm->name() << "'" << endl; @@ -347,7 +345,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, // _engine->set_property(subject, i->first, i->second); if (!existing) - _engine->set_property(path, uris.ingen_enabled, (bool)true); + _engine->set_property(path, _uris->ingen_enabled, (bool)true); _load_path_translations.clear(); @@ -439,8 +437,6 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr return false; } - const LV2URIMap& uris = Shared::LV2URIMap::instance(); - // Compatibility hacks for old patches that represent patch ports as nodes if (plugin_uri.empty()) { bool is_port = false; @@ -450,23 +446,23 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr if (plugin_type == "Internal") { is_port = true; if (plugin_label == "audio_input") { - props.insert(make_pair(uris.rdf_type, uris.lv2_AudioPort)); - props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_AudioPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); } else if (plugin_label == "audio_output") { - props.insert(make_pair(uris.rdf_type, uris.lv2_AudioPort)); - props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_AudioPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); } else if (plugin_label == "control_input") { - props.insert(make_pair(uris.rdf_type, uris.lv2_ControlPort)); - props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); } else if (plugin_label == "control_output" ) { - props.insert(make_pair(uris.rdf_type, uris.lv2_ControlPort)); - props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); } else if (plugin_label == "midi_input") { - props.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort)); - props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); } else if (plugin_label == "midi_output" ) { - props.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort)); - props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort)); + props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); } else { is_port = false; } @@ -523,11 +519,11 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr plugin_uri = "om:" + plugin_type + ":" + library_name + ":" + plugin_label; Resource::Properties props; - props.insert(make_pair(uris.rdf_type, uris.ingen_Node)); - props.insert(make_pair(uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri))); + props.insert(make_pair(_uris->rdf_type, _uris->ingen_Node)); + props.insert(make_pair(_uris->rdf_instanceOf, Atom(Atom::URI, plugin_uri))); _engine->put(path, props); - _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic)); + _engine->set_property(path, _uris->ingen_polyphonic, bool(polyphonic)); for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_property(path, i->first, i->second); @@ -538,10 +534,10 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr // Not deprecated } else { Resource::Properties props; - props.insert(make_pair(uris.rdf_type, uris.ingen_Node)); - props.insert(make_pair(uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri))); + props.insert(make_pair(_uris->rdf_type, _uris->ingen_Node)); + props.insert(make_pair(_uris->rdf_instanceOf, Atom(Atom::URI, plugin_uri))); _engine->put(path, props); - _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic)); + _engine->set_property(path, _uris->ingen_polyphonic, bool(polyphonic)); for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_property(path, i->first, i->second); return true; @@ -562,15 +558,13 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent, size_t poly = 0; GraphObject::Properties initial_data; - const LV2URIMap& uris = Shared::LV2URIMap::instance(); - while (cur != NULL) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { name = (const char*)key; } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { - initial_data.insert(make_pair(uris.ingen_polyphony, (int)poly)); + initial_data.insert(make_pair(_uris->ingen_polyphony, (int)poly)); } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) { filename = Glib::build_filename(base_filename, (const char*)key); } else { // Don't know what this tag is, add it as variable |