diff options
Diffstat (limited to 'src')
67 files changed, 372 insertions, 276 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index ed1fde66..90c23d15 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -42,7 +42,7 @@ using namespace Shared; namespace Client { -ClientStore::ClientStore(SharedPtr<Shared::LV2URIMap> uris, +ClientStore::ClientStore(SharedPtr<Shared::URIs> uris, SharedPtr<ServerInterface> engine, SharedPtr<SigClientInterface> emitter) : _uris(uris) diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 62a562e8..007cd424 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -29,7 +29,7 @@ using namespace Raul; namespace Ingen { namespace Client { -NodeModel::NodeModel(Shared::LV2URIMap& uris, +NodeModel::NodeModel(Shared::URIs& uris, SharedPtr<PluginModel> plugin, const Path& path) : Node() @@ -42,7 +42,7 @@ NodeModel::NodeModel(Shared::LV2URIMap& uris, { } -NodeModel::NodeModel(Shared::LV2URIMap& uris, +NodeModel::NodeModel(Shared::URIs& uris, const URI& plugin_uri, const Path& path) : Node() diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index f09af326..240e2ca5 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -26,7 +26,7 @@ using namespace Raul; namespace Ingen { namespace Client { -ObjectModel::ObjectModel(Shared::LV2URIMap& uris, const Raul::Path& path) +ObjectModel::ObjectModel(Shared::URIs& uris, const Raul::Path& path) : ResourceImpl(uris, path) , _meta(uris, Raul::URI("http://example.org/FIXME")) , _path(path) diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 1d13ee5b..a280a038 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -41,8 +41,10 @@ const LilvPlugins* PluginModel::_lilv_plugins = NULL; Sord::World* PluginModel::_rdf_world = NULL; -PluginModel::PluginModel(Shared::LV2URIMap& uris, - const URI& uri, const URI& type_uri, const Resource::Properties& properties) +PluginModel::PluginModel(Shared::URIs& uris, + const URI& uri, + const URI& type_uri, + const Resource::Properties& properties) : ResourceImpl(uris, uri) , _type(type_from_uri(type_uri.str())) { diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index cf93b8bb..0e0c3c51 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -54,7 +54,8 @@ lv2_ui_write(SuilController controller, SharedPtr<const PortModel> port = ports[port_index]; - const Shared::LV2URIMap& uris = *ui->world()->uris().get(); + const Shared::URIs& uris = *ui->world()->uris().get(); + const Shared::LV2URIMap& uri_map = *ui->world()->lv2_uri_map().get(); // float (special case, always 0) if (format == 0) { @@ -74,7 +75,7 @@ lv2_ui_write(SuilController controller, while (lv2_event_is_valid(&iter)) { LV2_Event* const ev = lv2_event_get(&iter, &data); std::pair<bool, uint16_t> midi_id = - uris.global_to_event(uris.midi_MidiEvent.id); + uri_map.global_to_event(uris.midi_MidiEvent.id); if (midi_id.first && ev->type == midi_id.second) { // FIXME: bundle multiple events by writing an entire buffer here ui->world()->engine()->set_property( diff --git a/src/gui/App.cpp b/src/gui/App.cpp index bddcec2c..6608df17 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -168,7 +168,7 @@ App::attach(SharedPtr<SigClientInterface> client) _client = client; _store = SharedPtr<ClientStore>(new ClientStore(_world->uris(), _world->engine(), client)); - _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->uris(), _world->engine())); + _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine())); _patch_tree_window->init(*_store); diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 174aad1c..9cda522b 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -114,8 +114,8 @@ public: static void init(Ingen::Shared::World* world); static void run(); - inline Ingen::Shared::World* world() const { return _world; } - inline Ingen::Shared::LV2URIMap& uris() const { return *_world->uris(); } + inline Ingen::Shared::World* world() const { return _world; } + inline Ingen::Shared::URIs& uris() const { return *_world->uris(); } protected: diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp index 5e300bc1..855c991f 100644 --- a/src/gui/Configuration.cpp +++ b/src/gui/Configuration.cpp @@ -83,7 +83,7 @@ uint32_t Configuration::get_port_color(const PortModel* p) { assert(p != NULL); - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); if (p->is_a(uris.lv2_AudioPort)) { return _audio_port_color; } else if (p->supports(uris.atom_String)) { diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index e31c8d52..786e5b49 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -214,7 +214,7 @@ SliderControl::port_property_changed(const URI& key, const Atom& value) { _enable_signal = false; - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); if (key == uris.lv2_minimum && value.type() == Atom::FLOAT) set_range(value.get_float(), _slider->get_adjustment()->get_upper()); else if (key == uris.lv2_maximum && value.type() == Atom::FLOAT) diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index 33363f0d..e4716451 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -149,7 +149,7 @@ LoadPatchWindow::ok_clicked() return; } - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); if (_poly_voices_radio->get_active()) _initial_data.insert(make_pair( diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 9d5772f1..2e0c4290 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -224,7 +224,7 @@ void LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, SharedPtr<const PluginModel> plugin) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); const Atom& name = plugin->get_property(uris.doap_name); if (name.is_valid() && name.type() == Atom::STRING) row[_plugins_columns._col_name] = name.get_string(); @@ -325,7 +325,7 @@ LoadPluginWindow::generate_module_name(SharedPtr<const PluginModel> plugin, void LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); Gtk::TreeModel::Row row = *iter; SharedPtr<const PluginModel> plugin = row.get_value(_plugins_columns._col_plugin); bool polyphonic = _polyphonic_checkbutton->get_active(); @@ -386,7 +386,7 @@ LoadPluginWindow::filter_changed() Gtk::TreeModel::Row model_row; Gtk::TreeModel::iterator model_iter; size_t num_visible = 0; - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); for (ClientStore::Plugins::const_iterator i = App::instance().store()->plugins()->begin(); i != App::instance().store()->plugins()->end(); ++i) { @@ -439,7 +439,7 @@ LoadPluginWindow::plugin_property_changed(const URI& plugin, const URI& predicate, const Atom& value) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); if (predicate == uris.doap_name) { Rows::const_iterator i = _rows.find(plugin); if (i != _rows.end() && value.type() == Atom::STRING) diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 9b0a3743..d0e5c2cb 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -121,7 +121,7 @@ NodeModule::create(PatchCanvas& canvas, void NodeModule::show_human_names(bool b) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); if (b && node()->plugin()) { const Raul::Atom& name_property = node()->get_property(uris.lv2_name); @@ -183,7 +183,7 @@ NodeModule::plugin_changed() void NodeModule::embed_gui(bool embed) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); if (embed) { if (_gui_window) { @@ -357,7 +357,7 @@ NodeModule::store_location() const Atom x(static_cast<float>(property_x())); const Atom y(static_cast<float>(property_y())); - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); const Atom& existing_x = _node->get_property(uris.ingenui_canvas_x); const Atom& existing_y = _node->get_property(uris.ingenui_canvas_y); @@ -376,7 +376,7 @@ NodeModule::store_location() void NodeModule::property_changed(const URI& key, const Atom& value) { - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); switch (value.type()) { case Atom::FLOAT: if (key == uris.ingenui_canvas_x) { @@ -410,7 +410,7 @@ void NodeModule::set_selected(bool b) { const App& app = App::instance(); - const LV2URIMap& uris = app.uris(); + const URIs& uris = app.uris(); if (b != selected()) { Module::set_selected(b); if (b) { diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index c2dd370a..c46abf01 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -121,7 +121,7 @@ ObjectMenu::on_menu_polyphonic() void ObjectMenu::property_changed(const URI& predicate, const Atom& value) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); _enable_signal = false; if (predicate == uris.ingen_polyphonic && value.type() == Atom::BOOL) _polyphonic_menuitem->set_active(value.get_bool()); diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index a0440ade..c1194395 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -670,7 +670,7 @@ PatchCanvas::paste() clear_selection(); ++_paste_count; - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); Builder builder(App::instance().world()->uris(), *App::instance().engine()); ClientStore clipboard(App::instance().world()->uris()); @@ -762,7 +762,7 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base, generate_port_name(sym_base, sym, name_base, name); const Path& path = _patch->path().base() + sym; - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); Resource::Properties props = get_initial_data(); props.insert(make_pair(uris.rdf_type, @@ -791,7 +791,7 @@ PatchCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin) symbol = ss.str(); } - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); const Path path = _patch->path().child(symbol); // FIXME: polyphony? @@ -817,7 +817,7 @@ GraphObject::Properties PatchCanvas::get_initial_data(Resource::Graph ctx) { GraphObject::Properties result; - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); result.insert(make_pair(uris.ingenui_canvas_x, Resource::Property((float)_last_click_x, ctx))); result.insert(make_pair(uris.ingenui_canvas_y, diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 15c26392..19ac52e3 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -83,7 +83,7 @@ PatchPortModule::store_location() const Atom x(static_cast<float>(property_x())); const Atom y(static_cast<float>(property_y())); - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); const Atom& existing_x = _model->get_property(uris.ingenui_canvas_x); const Atom& existing_y = _model->get_property(uris.ingenui_canvas_y); @@ -104,7 +104,7 @@ PatchPortModule::store_location() void PatchPortModule::show_human_names(bool b) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); const Atom& name = _model->get_property(uris.lv2_name); if (b && name.type() == Atom::STRING) set_name(name.get_string()); @@ -122,7 +122,7 @@ PatchPortModule::set_name(const std::string& n) void PatchPortModule::property_changed(const URI& key, const Atom& value) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); switch (value.type()) { case Atom::FLOAT: if (key == uris.ingenui_canvas_x) { diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index 18d6610a..fef646c1 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -192,7 +192,7 @@ void PatchTreeWindow::patch_property_changed(const URI& key, const Atom& value, SharedPtr<PatchModel> patch) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); _enable_signal = false; if (key == uris.ingen_enabled && value.type() == Atom::BOOL) { Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), patch); diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index bab06da8..14f7c060 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -458,7 +458,7 @@ PatchWindow::event_save() void PatchWindow::event_save_as() { - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); while (true) { Gtk::FileChooserDialog dialog(*this, "Save Patch", Gtk::FILE_CHOOSER_ACTION_SAVE); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index a3a7afb2..adaf2510 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -244,7 +244,7 @@ Port::set_control(float value, bool signal) void Port::property_changed(const URI& key, const Atom& value) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); if (value.type() == Atom::FLOAT) { float val = value.get_float(); if (key == uris.ingen_value && !_pressed) { @@ -278,7 +278,7 @@ Port::property_changed(const URI& key, const Atom& value) ArtVpathDash* Port::dash() { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); SharedPtr<const PortModel> pm = _port_model.lock(); if (!pm) return NULL; diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 6e51ee45..2da24ace 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -43,7 +43,7 @@ PortMenu::PortMenu(BaseObjectType* cobject, void PortMenu::init(SharedPtr<const PortModel> port, bool patch_port) { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); ObjectMenu::init(port); _patch_port = patch_port; @@ -96,7 +96,7 @@ PortMenu::on_menu_disconnect() void PortMenu::on_menu_set_min() { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) @@ -106,7 +106,7 @@ PortMenu::on_menu_set_min() void PortMenu::on_menu_set_max() { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) @@ -116,7 +116,7 @@ PortMenu::on_menu_set_max() void PortMenu::on_menu_reset_range() { - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); SharedPtr<const NodeModel> parent = PtrCast<const NodeModel>(_object->parent()); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 0b51074b..7ce9e064 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -96,7 +96,7 @@ PortPropertiesWindow::present(SharedPtr<const PortModel> pm) void PortPropertiesWindow::property_changed(const URI& key, const Atom& value) { - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); if (value.type() == Atom::FLOAT) { if (key == uris.lv2_minimum) @@ -151,7 +151,7 @@ PortPropertiesWindow::cancel() void PortPropertiesWindow::ok() { - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); Resource::Properties props; props.insert(make_pair(uris.lv2_minimum, float(_min_spinner->get_value()))); props.insert(make_pair(uris.lv2_maximum, float(_max_spinner->get_value()))); diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 18fca3de..daadf48e 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -115,7 +115,7 @@ RenameWindow::cancel_clicked() void RenameWindow::ok_clicked() { - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); const string& symbol_str = _symbol_entry->get_text(); const string& label = _label_entry->get_text(); diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index 2c5c968a..e3085e95 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -66,7 +66,7 @@ SubpatchModule::store_location() const Atom x(static_cast<float>(property_x())); const Atom y(static_cast<float>(property_y())); - const LV2URIMap& uris = App::instance().uris(); + const URIs& uris = App::instance().uris(); const Atom& existing_x = _node->get_property(uris.ingenui_canvas_x); const Atom& existing_y = _node->get_property(uris.ingenui_canvas_y); diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 22a311e9..e3cea135 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -29,7 +29,7 @@ using namespace Raul; namespace Ingen { namespace GUI { -ThreadedLoader::ThreadedLoader(SharedPtr<Shared::LV2URIMap> uris, SharedPtr<ServerInterface> engine) +ThreadedLoader::ThreadedLoader(SharedPtr<ServerInterface> engine) : _engine(engine) { set_name("Loader"); diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index ab5995f9..deb8781b 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -54,8 +54,7 @@ namespace GUI { class ThreadedLoader : public Raul::Slave { public: - ThreadedLoader(SharedPtr<Shared::LV2URIMap> uris, - SharedPtr<ServerInterface> engine); + ThreadedLoader(SharedPtr<ServerInterface> engine); void load_patch(bool merge, const Glib::ustring& document_uri, diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp index 79b54a10..7540badf 100644 --- a/src/gui/UploadPatchWindow.cpp +++ b/src/gui/UploadPatchWindow.cpp @@ -69,7 +69,7 @@ UploadPatchWindow::present(SharedPtr<PatchModel> patch) void UploadPatchWindow::on_show() { - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); Gtk::Dialog::on_show(); Raul::Atom atom = _patch->get_property(uris.lv2_symbol); @@ -222,7 +222,7 @@ UploadPatchWindow::upload_clicked() { assert(!_thread); - const Shared::LV2URIMap& uris = App::instance().uris(); + const Shared::URIs& uris = App::instance().uris(); Glib::ustring symbol = _symbol_entry->get_text(); Glib::ustring short_name = _short_name_entry->get_text(); diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index ef7c9d8f..98235bcd 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -127,7 +127,7 @@ get_port(Ingen::Shared::World* world, const Raul::Path& parent, PortRecord& record) { - const LV2URIMap& uris = *world->uris().get(); + const URIs& uris = *world->uris().get(); // Get all properties Resource::Properties props = get_properties(model, subject); @@ -212,7 +212,7 @@ parse_node(Ingen::Shared::World* world, const Raul::Path& path, boost::optional<GraphObject::Properties> data) { - const LV2URIMap& uris = *world->uris().get(); + const URIs& uris = *world->uris().get(); Sord::URI rdf_instanceOf(*world->rdf_world(), NS_RDF "instanceOf"); @@ -276,7 +276,7 @@ parse_patch(Ingen::Shared::World* world, const Sord::URI ingen_polyphony(*world->rdf_world(), NS_INGEN "polyphony"); const Sord::URI lv2_port(*world->rdf_world(), NS_LV2 "port"); - const LV2URIMap& uris = *world->uris().get(); + const URIs& uris = *world->uris().get(); const Sord::Node& patch = subject_node; uint32_t patch_poly = 0; diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 698e8f4b..c003d4f8 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -382,7 +382,7 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, Sord::Curie(world, "rdf:type"), Sord::Curie(world, "lv2:Plugin")); - const LV2URIMap& uris = *_world.uris().get(); + const URIs& uris = *_world.uris().get(); // Always write a symbol (required by Ingen) string symbol; diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index 54886e35..e2945d6f 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -33,8 +33,8 @@ namespace Server { static const size_t EVENT_BYTES_PER_FRAME = 4; // FIXME -BufferFactory::BufferFactory(Engine& engine, - SharedPtr<Ingen::Shared::LV2URIMap> uris) +BufferFactory::BufferFactory(Engine& engine, + SharedPtr<Ingen::Shared::URIs> uris) : _engine(engine) , _uris(uris) , _silent_buffer(NULL) diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp index 3fe46c35..b19f67b4 100644 --- a/src/server/BufferFactory.hpp +++ b/src/server/BufferFactory.hpp @@ -32,7 +32,7 @@ namespace Ingen { -namespace Shared { class LV2URIMap; } +namespace Shared { class URIs; } namespace Server { @@ -41,8 +41,8 @@ class Buffer; class BufferFactory { public: - BufferFactory(Engine& engine, - SharedPtr<Ingen::Shared::LV2URIMap> uris); + BufferFactory(Engine& engine, + SharedPtr<Ingen::Shared::URIs> uris); ~BufferFactory(); @@ -57,7 +57,7 @@ public: void set_block_length(SampleCount block_length); - Ingen::Shared::LV2URIMap& uris() { assert(_uris); return *_uris.get(); } + Ingen::Shared::URIs& uris() { assert(_uris); return *_uris.get(); } private: friend class Buffer; @@ -83,9 +83,9 @@ private: Raul::AtomicPtr<Buffer> _free_event; Raul::AtomicPtr<Buffer> _free_object; - Glib::Mutex _mutex; - Engine& _engine; - SharedPtr<Ingen::Shared::LV2URIMap> _uris; + Glib::Mutex _mutex; + Engine& _engine; + SharedPtr<Ingen::Shared::URIs> _uris; Ref _silent_buffer; }; diff --git a/src/server/ConnectionImpl.cpp b/src/server/ConnectionImpl.cpp index 640b61b0..13ebff8f 100644 --- a/src/server/ConnectionImpl.cpp +++ b/src/server/ConnectionImpl.cpp @@ -157,7 +157,7 @@ ConnectionImpl::must_queue() const bool ConnectionImpl::can_connect(const OutputPort* src, const InputPort* dst) { - const Ingen::Shared::LV2URIMap& uris = src->bufs().uris(); + const Ingen::Shared::URIs& uris = src->bufs().uris(); return ( // (Audio | Control) => (Audio | Control) ( (src->is_a(PortType::CONTROL) || src->is_a(PortType::AUDIO)) diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 77c1fdf7..1b5459fa 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -18,6 +18,7 @@ #include <math.h> #include "raul/log.hpp" #include "raul/midi_events.h" +#include "shared/URIs.hpp" #include "shared/LV2URIMap.hpp" #include "ingen/shared/World.hpp" @@ -55,7 +56,7 @@ ControlBindings::Key ControlBindings::port_binding(PortImpl* port) const { ThreadManager::assert_thread(THREAD_PRE_PROCESS); - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); const Raul::Atom& binding = port->get_property(uris.ingen_controlBinding); return binding_key(binding); } @@ -63,7 +64,7 @@ ControlBindings::port_binding(PortImpl* port) const ControlBindings::Key ControlBindings::binding_key(const Raul::Atom& binding) const { - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); Key key; if (binding.type() == Atom::DICT) { const Atom::DictValue& dict = binding.get_dict(); @@ -124,7 +125,9 @@ ControlBindings::port_value_changed(ProcessContext& context, Key key, const Raul::Atom& value_atom) { - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + Ingen::Shared::World* world = context.engine().world(); + const Ingen::Shared::URIs& uris = *world->uris().get(); + const Ingen::Shared::LV2URIMap& uri_map = *world->lv2_uri_map().get(); if (key) { int16_t value = port_value_to_control( port, key.type, value_atom, port->minimum(), port->maximum()); @@ -162,7 +165,7 @@ ControlBindings::port_value_changed(ProcessContext& context, } if (size > 0) { _feedback->append(0, 0, - uris.global_to_event(uris.midi_MidiEvent.id).second, + uri_map.global_to_event(uris.midi_MidiEvent.id).second, size, buf); } } @@ -274,7 +277,7 @@ ControlBindings::set_port_value(ProcessContext& context, bool ControlBindings::bind(ProcessContext& context, Key key) { - const Ingen::Shared::LV2URIMap& uris = *context.engine().world()->uris().get(); + const Ingen::Shared::URIs& uris = *context.engine().world()->uris().get(); assert(_learn_port); if (key.type == MIDI_NOTE) { bool toggled = _learn_port->has_property(uris.lv2_portProperty, uris.lv2_toggled); @@ -349,10 +352,13 @@ ControlBindings::pre_process(ProcessContext& context, EventBuffer* buffer) SharedPtr<Bindings> bindings = _bindings; _feedback->clear(); - const Ingen::Shared::LV2URIMap& uris = *context.engine().world()->uris().get(); + Ingen::Shared::World* world = context.engine().world(); + const Ingen::Shared::URIs& uris = *world->uris().get(); + const Ingen::Shared::LV2URIMap& uri_map = *world->lv2_uri_map().get(); // TODO: cache - const uint32_t midi_event_type = uris.global_to_event(uris.midi_MidiEvent.id).second; + const uint32_t midi_event_type = uri_map.global_to_event( + uris.midi_MidiEvent.id).second; // Learn from input if necessary if (_learn_port) { diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index bf5946ce..3caa4b6f 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -152,7 +152,7 @@ Engine::activate() _message_context->Thread::start(); - const Ingen::Shared::LV2URIMap& uris = *world()->uris().get(); + const Ingen::Shared::URIs& uris = *world()->uris().get(); // Create root patch PatchImpl* root_patch = _driver->root_patch(); diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp index 88edfb0e..e5a1739b 100644 --- a/src/server/GraphObjectImpl.cpp +++ b/src/server/GraphObjectImpl.cpp @@ -28,7 +28,7 @@ using namespace Raul; namespace Ingen { namespace Server { -GraphObjectImpl::GraphObjectImpl(Ingen::Shared::LV2URIMap& uris, +GraphObjectImpl::GraphObjectImpl(Ingen::Shared::URIs& uris, GraphObjectImpl* parent, const Symbol& symbol) : ResourceImpl(uris, parent ? parent->path().child(symbol) : Raul::Path::root()) diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp index 09988214..a9abf26a 100644 --- a/src/server/GraphObjectImpl.hpp +++ b/src/server/GraphObjectImpl.hpp @@ -32,7 +32,7 @@ namespace Raul { class Maid; } namespace Ingen { -namespace Shared { class LV2URIMap; } +namespace Shared { class URIs; } namespace Server { @@ -95,7 +95,7 @@ public: virtual bool apply_poly(Raul::Maid& maid, uint32_t poly) = 0; protected: - GraphObjectImpl(Ingen::Shared::LV2URIMap& uris, + GraphObjectImpl(Ingen::Shared::URIs& uris, GraphObjectImpl* parent, const Raul::Symbol& symbol); diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 0a58c017..42a6e167 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -50,7 +50,7 @@ InputPort::InputPort(BufferFactory& bufs, : PortImpl(bufs, parent, symbol, index, poly, type, value, buffer_size) , _num_connections(0) { - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); if (!dynamic_cast<Patch*>(parent)) add_property(uris.rdf_type, uris.lv2_InputPort); diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index bcf30a47..73dcf2f5 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -34,7 +34,7 @@ namespace Server { using namespace Internals; -InternalPlugin::InternalPlugin(Shared::LV2URIMap& uris, +InternalPlugin::InternalPlugin(Shared::URIs& uris, const std::string& uri, const std::string& symbol) : PluginImpl(uris, Plugin::Internal, uri) , _symbol(symbol) diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp index 1b0de55b..528fbc59 100644 --- a/src/server/InternalPlugin.hpp +++ b/src/server/InternalPlugin.hpp @@ -39,7 +39,7 @@ class BufferFactory; class InternalPlugin : public PluginImpl { public: - InternalPlugin(Shared::LV2URIMap& uris, + InternalPlugin(Shared::URIs& uris, const std::string& uri, const std::string& symbol); NodeImpl* instantiate(BufferFactory& bufs, diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 7a36bf1e..b6b21d15 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -195,7 +195,7 @@ JackDriver::JackDriver(Engine& engine) , _process_context(engine) , _root_patch(NULL) { - _midi_event_type = _engine.world()->uris()->uri_to_id( + _midi_event_type = _engine.world()->lv2_uri_map()->uri_to_id( LV2_EVENT_URI, "http://lv2plug.in/ns/ext/midi#MidiEvent"); } diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 76837c88..fbb7e2ee 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -138,7 +138,7 @@ LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly) bool LV2Node::instantiate(BufferFactory& bufs) { - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); SharedPtr<LV2Info> info = _lv2_plugin->lv2_info(); const LilvPlugin* plug = _lv2_plugin->lilv_plugin(); diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index cb1e1ec3..aa6d9158 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -100,7 +100,7 @@ NodeFactory::load_plugins() void NodeFactory::load_internal_plugins() { - Ingen::Shared::LV2URIMap& uris = *_world->uris().get(); + Ingen::Shared::URIs& uris = *_world->uris().get(); InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris); _plugins.insert(make_pair(controller_plug->uri(), controller_plug)); diff --git a/src/server/Notification.cpp b/src/server/Notification.cpp index 0808c00e..7cc28cc7 100644 --- a/src/server/Notification.cpp +++ b/src/server/Notification.cpp @@ -38,7 +38,7 @@ Notification::post_process(Notification& note, engine.broadcaster()->activity(note.port->path(), note.value); break; case PORT_BINDING: { - const Ingen::Shared::LV2URIMap& uris = *engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *engine.world()->uris().get(); Raul::Atom::DictValue dict; switch (note.binding_type) { case ControlBindings::MIDI_CC: diff --git a/src/server/PatchPlugin.hpp b/src/server/PatchPlugin.hpp index 3504730f..e969a4b0 100644 --- a/src/server/PatchPlugin.hpp +++ b/src/server/PatchPlugin.hpp @@ -34,7 +34,7 @@ class PatchPlugin : public PluginImpl { public: PatchPlugin( - Shared::LV2URIMap& uris, + Shared::URIs& uris, const std::string& uri, const std::string& symbol, const std::string& name) diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp index cea1145d..ac551cef 100644 --- a/src/server/PluginImpl.hpp +++ b/src/server/PluginImpl.hpp @@ -29,7 +29,7 @@ namespace Ingen { -namespace Shared { class LV2URIMap; } +namespace Shared { class URIs; } namespace Server { @@ -47,7 +47,7 @@ class PluginImpl : public Plugin , public boost::noncopyable { public: - PluginImpl(Ingen::Shared::LV2URIMap& uris, + PluginImpl(Ingen::Shared::URIs& uris, Type type, const std::string& uri, const std::string library_path = "") diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 90bf8e0b..456634a0 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -70,7 +70,7 @@ PortImpl::PortImpl(BufferFactory& bufs, if (_buffer_size == 0) _buffer_size = bufs.default_buffer_size(type); - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); add_property(uris.rdf_type, type.uri()); set_property(uris.lv2_index, Atom((int32_t)index)); set_context(_context); @@ -239,7 +239,7 @@ PortImpl::broadcast_value(Context& context, bool force) void PortImpl::set_context(Context::ID c) { - const Ingen::Shared::LV2URIMap& uris = _bufs.uris(); + const Ingen::Shared::URIs& uris = _bufs.uris(); _context = c; switch (c) { case Context::AUDIO: diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index a5c75adf..290ee626 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -80,7 +80,7 @@ CreatePatch::pre_process() if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) poly = _poly; - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); _patch = new PatchImpl(_engine, path.symbol(), poly, _parent, _engine.driver()->sample_rate(), _poly); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 84a8e2d3..28e337e3 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -57,7 +57,7 @@ CreatePort::CreatePort( , _properties(properties) , _is_output(is_output) { - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); typedef Resource::Properties::const_iterator Iterator; typedef std::pair<Iterator, Iterator> Range; @@ -97,7 +97,7 @@ CreatePort::pre_process() _patch = _engine.engine_store()->find_patch(_path.parent()); - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); if (_patch != NULL) { assert(_patch->path() == _path.parent()); diff --git a/src/server/events/RegisterClient.cpp b/src/server/events/RegisterClient.cpp index 32c1a0c9..7b22bd17 100644 --- a/src/server/events/RegisterClient.cpp +++ b/src/server/events/RegisterClient.cpp @@ -57,7 +57,7 @@ RegisterClient::post_process() kludge. TODO: keep a proper RDF model to describe the engine and send that to clients. */ - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); _client->set_property(uris.ingen_engine, uris.ingen_sampleRate, int32_t(_engine.driver()->sample_rate())); diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index 4e40baeb..806d47ef 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -118,7 +118,7 @@ SetMetadata::pre_process() return; } - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); if (is_graph_object && !_object) { Path path(_subject.str()); @@ -274,7 +274,7 @@ SetMetadata::execute(ProcessContext& context) return; } - const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + const Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); if (_create_event) { _create_event->execute(context); diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 7c3adb7e..a783e4e9 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -147,7 +147,8 @@ SetPortValue::apply(Context& context) return; } - Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get(); + Ingen::Shared::URIs& uris = *_engine.world()->uris().get(); + Ingen::Shared::LV2URIMap& uri_map = *_engine.world()->lv2_uri_map().get(); EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf); if (ebuf && _value.type() == Atom::BLOB) { @@ -155,7 +156,7 @@ SetPortValue::apply(Context& context) // Size 0 event, pass it along to the plugin as a typed but empty event if (_value.data_size() == 0) { - const uint32_t type_id = uris.uri_to_id(NULL, _value.get_blob_type()); + const uint32_t type_id = uri_map.uri_to_id(NULL, _value.get_blob_type()); ebuf->append(frames, 0, type_id, 0, NULL); _port->raise_set_by_user_flag(); return; @@ -164,7 +165,7 @@ SetPortValue::apply(Context& context) "http://lv2plug.in/ns/ext/midi#MidiEvent")) { ebuf->prepare_write(context); ebuf->append(frames, 0, - uris.global_to_event(uris.midi_MidiEvent.id).second, + uri_map.global_to_event(uris.midi_MidiEvent.id).second, _value.data_size(), (const uint8_t*)_value.get_blob()); _port->raise_set_by_user_flag(); diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index bdf8e607..86a45f03 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -36,7 +36,7 @@ namespace Ingen { namespace Server { namespace Internals { -InternalPlugin* ControllerNode::internal_plugin(Shared::LV2URIMap& uris) { +InternalPlugin* ControllerNode::internal_plugin(Shared::URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Controller", "controller"); } @@ -49,7 +49,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, : NodeImpl(plugin, path, false, parent, srate) , _learning(false) { - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(6); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); diff --git a/src/server/internals/Controller.hpp b/src/server/internals/Controller.hpp index 30ef663f..d664bf55 100644 --- a/src/server/internals/Controller.hpp +++ b/src/server/internals/Controller.hpp @@ -54,7 +54,7 @@ public: void learn() { _learning = true; } - static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); + static InternalPlugin* internal_plugin(Shared::URIs& uris); private: bool _learning; diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index 4175862c..5d597c53 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -47,7 +47,7 @@ namespace Internals { static const float MAX_DELAY_SECONDS = 8.0f; -InternalPlugin* DelayNode::internal_plugin(Shared::LV2URIMap& uris) { +InternalPlugin* DelayNode::internal_plugin(Shared::URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Delay", "delay"); } @@ -64,7 +64,7 @@ DelayNode::DelayNode( , _buffer_mask(0) , _write_phase(0) { - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(3); const float default_delay = 1.0f; diff --git a/src/server/internals/Delay.hpp b/src/server/internals/Delay.hpp index 7456d7cc..d1ead156 100644 --- a/src/server/internals/Delay.hpp +++ b/src/server/internals/Delay.hpp @@ -50,7 +50,7 @@ public: void process(ProcessContext& context); - static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); + static InternalPlugin* internal_plugin(Shared::URIs& uris); float delay_samples() const { return _delay_samples; } diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index f28dacc1..0b0acbdc 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -42,7 +42,7 @@ namespace Ingen { namespace Server { namespace Internals { -InternalPlugin* NoteNode::internal_plugin(Shared::LV2URIMap& uris) { +InternalPlugin* NoteNode::internal_plugin(Shared::URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Note", "note"); } @@ -58,7 +58,7 @@ NoteNode::NoteNode( , _prepared_voices(NULL) , _sustain(false) { - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index d20baf13..6ac0af78 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -62,7 +62,7 @@ public: void sustain_on(ProcessContext& context, FrameTime time); void sustain_off(ProcessContext& context, FrameTime time); - static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); + static InternalPlugin* internal_plugin(Shared::URIs& uris); private: /** Key, one for each key on the keyboard */ diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index d062fa13..349bb1d9 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -38,7 +38,7 @@ namespace Ingen { namespace Server { namespace Internals { -InternalPlugin* TriggerNode::internal_plugin(Shared::LV2URIMap& uris) { +InternalPlugin* TriggerNode::internal_plugin(Shared::URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Trigger", "trigger"); } @@ -52,7 +52,7 @@ TriggerNode::TriggerNode( : NodeImpl(plugin, path, false, parent, srate) , _learning(false) { - const Ingen::Shared::LV2URIMap& uris = bufs.uris(); + const Ingen::Shared::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom()); diff --git a/src/server/internals/Trigger.hpp b/src/server/internals/Trigger.hpp index 92b85345..2a75ee4f 100644 --- a/src/server/internals/Trigger.hpp +++ b/src/server/internals/Trigger.hpp @@ -58,7 +58,7 @@ public: void learn() { _learning = true; } - static InternalPlugin* internal_plugin(Shared::LV2URIMap& uris); + static InternalPlugin* internal_plugin(Shared::URIs& uris); private: bool _learning; diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp index 5539e958..83c2eafc 100644 --- a/src/shared/Builder.cpp +++ b/src/shared/Builder.cpp @@ -33,7 +33,7 @@ using namespace Raul; namespace Ingen { namespace Shared { -Builder::Builder(SharedPtr<Shared::LV2URIMap> uris, CommonInterface& interface) +Builder::Builder(SharedPtr<Shared::URIs> uris, CommonInterface& interface) : _uris(uris) , _interface(interface) { @@ -42,7 +42,7 @@ Builder::Builder(SharedPtr<Shared::LV2URIMap> uris, CommonInterface& interface) void Builder::build(SharedPtr<const GraphObject> object) { - const LV2URIMap& uris = *_uris.get(); + const URIs& uris = *_uris.get(); SharedPtr<const Patch> patch = PtrCast<const Patch>(object); if (patch) { if (!object->path().is_root()) { diff --git a/src/shared/LV2Atom.cpp b/src/shared/LV2Atom.cpp index 4b4cbec5..3381b90b 100644 --- a/src/shared/LV2Atom.cpp +++ b/src/shared/LV2Atom.cpp @@ -32,7 +32,7 @@ namespace Shared { namespace LV2Atom { bool -to_atom(const Shared::LV2URIMap& uris, const LV2_Atom* object, Raul::Atom& atom) +to_atom(const Shared::URIs& uris, const LV2_Atom* object, Raul::Atom& atom) { if (object->type == uris.atom_String.id) { atom = Raul::Atom((char*)(object + 1)); @@ -54,7 +54,7 @@ to_atom(const Shared::LV2URIMap& uris, const LV2_Atom* object, Raul::Atom& atom) * object->size should be the capacity of the object (not including header) */ bool -from_atom(const Shared::LV2URIMap& uris, const Raul::Atom& atom, LV2_Atom* object) +from_atom(const Shared::URIs& uris, const Raul::Atom& atom, LV2_Atom* object) { char* str; switch (atom.type()) { diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp index 7019f193..78d22b70 100644 --- a/src/shared/LV2URIMap.cpp +++ b/src/shared/LV2URIMap.cpp @@ -37,88 +37,8 @@ using namespace Raul; namespace Ingen { namespace Shared { -LV2URIMap::Quark::Quark(const char* c_str) - : Raul::URI(c_str) - , id(g_quark_from_string(c_str)) -{ -} - -const char* -LV2URIMap::Quark::c_str() const -{ - return g_quark_to_string(id); -} - -#define NS_CTX "http://lv2plug.in/ns/ext/contexts#" -#define NS_INGEN "http://drobilla.net/ns/ingen#" -#define NS_INGENUI "http://drobilla.net/ns/ingenuity#" -#define NS_LV2 "http://lv2plug.in/ns/lv2core#" -#define NS_MIDI "http://drobilla.net/ns/ext/midi#" -#define NS_MIDI "http://drobilla.net/ns/ext/midi#" -#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" -#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" - -LV2URIMap::LV2URIMap() - : atom_AtomTransfer (LV2_ATOM_URI "#AtomTransfer") - , atom_Bool (LV2_ATOM_URI "#Bool") - , atom_Float32 (LV2_ATOM_URI "#Float32") - , atom_Int32 (LV2_ATOM_URI "#Int32") - , atom_MessagePort (LV2_ATOM_URI "#MessagePort") - , atom_String (LV2_ATOM_URI "#String") - , atom_ValuePort (LV2_ATOM_URI "#ValuePort") - , atom_Vector (LV2_ATOM_URI "#Vector") - , atom_supports (LV2_ATOM_URI "#supports") - , ctx_AudioContext (NS_CTX "AudioContext") - , ctx_MessageContext (NS_CTX "MessageContext") - , ctx_context (NS_CTX "context") - , doap_name ("http://usefulinc.com/ns/doap#name") - , ev_EventPort ("http://lv2plug.in/ns/ext/event#EventPort") - , ingen_Internal (NS_INGEN "Internal") - , ingen_Node (NS_INGEN "Node") - , ingen_Patch (NS_INGEN "Patch") - , ingen_Port (NS_INGEN "Port") - , ingen_broadcast (NS_INGEN "broadcast") - , ingen_controlBinding (NS_INGEN "controlBinding") - , ingen_document (NS_INGEN "document") - , ingen_enabled (NS_INGEN "enabled") - , ingen_engine (NS_INGEN "engine") - , ingen_nil (NS_INGEN "nil") - , ingen_node (NS_INGEN "node") - , ingen_polyphonic (NS_INGEN "polyphonic") - , ingen_polyphony (NS_INGEN "polyphony") - , ingen_sampleRate (NS_INGEN "sampleRate") - , ingen_selected (NS_INGEN "selected") - , ingen_value (NS_INGEN "value") - , ingenui_canvas_x (NS_INGENUI "canvas-x") - , ingenui_canvas_y (NS_INGENUI "canvas-y") - , lv2_AudioPort (NS_LV2 "AudioPort") - , lv2_ControlPort (NS_LV2 "ControlPort") - , lv2_InputPort (NS_LV2 "InputPort") - , lv2_OutputPort (NS_LV2 "OutputPort") - , lv2_Plugin (NS_LV2 "Plugin") - , lv2_connectionOptional(NS_LV2 "connectionOptional") - , lv2_default (NS_LV2 "default") - , lv2_index (NS_LV2 "index") - , lv2_integer (NS_LV2 "integer") - , lv2_maximum (NS_LV2 "maximum") - , lv2_minimum (NS_LV2 "minimum") - , lv2_name (NS_LV2 "name") - , lv2_portProperty (NS_LV2 "portProperty") - , lv2_sampleRate (NS_LV2 "sampleRate") - , lv2_symbol (NS_LV2 "symbol") - , lv2_toggled (NS_LV2 "toggled") - , midi_Bender (NS_MIDI "Bender") - , midi_ChannelPressure (NS_MIDI "ChannelPressure") - , midi_Controller (NS_MIDI "Controller") - , midi_MidiEvent ("http://lv2plug.in/ns/ext/midi#MidiEvent") - , midi_Note (NS_MIDI "Note") - , midi_controllerNumber (NS_MIDI "controllerNumber") - , midi_noteNumber (NS_MIDI "noteNumber") - , rdf_instanceOf (NS_RDF "instanceOf") - , rdf_type (NS_RDF "type") - , rdfs_seeAlso (NS_RDFS "seeAlso") - , ui_Events ("http://lv2plug.in/ns/extensions/ui#Events") - , wildcard (NS_INGEN "wildcard") +LV2URIMap::LV2URIMap(URIs& uris) + : _uris(uris) { uri_map_feature_data.uri_to_id = &LV2URIMap::uri_map_uri_to_id; uri_map_feature_data.callback_data = this; @@ -126,8 +46,6 @@ LV2URIMap::LV2URIMap() uri_map_feature.data = &uri_map_feature_data; } -struct null_deleter { void operator()(void const *) const {} }; - uint32_t LV2URIMap::uri_to_id(const char* map, const char* uri) diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp index 8c126a0e..35baa9f8 100644 --- a/src/shared/LV2URIMap.hpp +++ b/src/shared/LV2URIMap.hpp @@ -28,6 +28,7 @@ #include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h" #include "LV2Features.hpp" +#include "URIs.hpp" namespace Ingen { namespace Shared { @@ -36,7 +37,7 @@ namespace Shared { */ class LV2URIMap : public boost::noncopyable, public LV2Features::Feature { public: - LV2URIMap(); + LV2URIMap(URIs& uris); SharedPtr<LV2_Feature> feature(Shared::World*, Node*) { return SharedPtr<LV2_Feature>(&uri_map_feature, NullDeleter<LV2_Feature>); @@ -56,79 +57,13 @@ private: LV2_Feature uri_map_feature; LV2_URI_Map_Feature uri_map_feature_data; -typedef std::map<uint16_t, uint32_t> EventToGlobal; + typedef std::map<uint16_t, uint32_t> EventToGlobal; typedef std::map<uint32_t, uint16_t> GlobalToEvent; EventToGlobal _event_to_global; GlobalToEvent _global_to_event; -public: - struct Quark : public Raul::URI { - Quark(const char* str); - const char* c_str() const; - uint32_t id; - }; - - const Quark atom_AtomTransfer; - const Quark atom_Bool; - const Quark atom_Float32; - const Quark atom_Int32; - const Quark atom_MessagePort; - const Quark atom_String; - const Quark atom_ValuePort; - const Quark atom_Vector; - const Quark atom_supports; - const Quark ctx_AudioContext; - const Quark ctx_MessageContext; - const Quark ctx_context; - const Quark doap_name; - const Quark ev_EventPort; - const Quark ingen_Internal; - const Quark ingen_Node; - const Quark ingen_Patch; - const Quark ingen_Port; - const Quark ingen_broadcast; - const Quark ingen_controlBinding; - const Quark ingen_document; - const Quark ingen_enabled; - const Quark ingen_engine; - const Quark ingen_nil; - const Quark ingen_node; - const Quark ingen_polyphonic; - const Quark ingen_polyphony; - const Quark ingen_sampleRate; - const Quark ingen_selected; - const Quark ingen_value; - const Quark ingenui_canvas_x; - const Quark ingenui_canvas_y; - const Quark lv2_AudioPort; - const Quark lv2_ControlPort; - const Quark lv2_InputPort; - const Quark lv2_OutputPort; - const Quark lv2_Plugin; - const Quark lv2_connectionOptional; - const Quark lv2_default; - const Quark lv2_index; - const Quark lv2_integer; - const Quark lv2_maximum; - const Quark lv2_minimum; - const Quark lv2_name; - const Quark lv2_portProperty; - const Quark lv2_sampleRate; - const Quark lv2_symbol; - const Quark lv2_toggled; - const Quark midi_Bender; - const Quark midi_ChannelPressure; - const Quark midi_Controller; - const Quark midi_MidiEvent; - const Quark midi_Note; - const Quark midi_controllerNumber; - const Quark midi_noteNumber; - const Quark rdf_instanceOf; - const Quark rdf_type; - const Quark rdfs_seeAlso; - const Quark ui_Events; - const Quark wildcard; + URIs& _uris; }; } // namespace Shared diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 29b464ee..1f9662f3 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -103,7 +103,7 @@ ResourceImpl::get_property(const Raul::URI& uri) const } bool -ResourceImpl::type(const LV2URIMap& uris, +ResourceImpl::type(const URIs& uris, const Properties& properties, bool& patch, bool& node, diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index da358c0a..13f1bd8f 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -26,15 +26,17 @@ namespace Ingen { namespace Shared { -class LV2URIMap; +class URIs; class ResourceImpl : virtual public Resource { public: - ResourceImpl(LV2URIMap& uris, const Raul::URI& uri) - : _uris(uris), _uri(uri) {} + ResourceImpl(URIs& uris, const Raul::URI& uri) + : _uris(uris) + , _uri(uri) + {} - LV2URIMap& uris() const { return _uris; } + URIs& uris() const { return _uris; } virtual void set_uri(const Raul::URI& uri) { _uri = uri; } virtual const Raul::URI& uri() const { return _uri; } @@ -61,7 +63,7 @@ public: * If some coherent ingen type is found, true is returned and the appropriate * output parameter set to true. Otherwise false is returned. */ - static bool type(const LV2URIMap& uris, + static bool type(const URIs& uris, const Properties& properties, bool& patch, bool& node, @@ -71,7 +73,7 @@ public: protected: const Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value) const; - LV2URIMap& _uris; + URIs& _uris; private: Raul::URI _uri; diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp new file mode 100644 index 00000000..a3a67cd2 --- /dev/null +++ b/src/shared/URIs.cpp @@ -0,0 +1,125 @@ +/* This file is part of Ingen. + * Copyright 2008-2011 David Robillard <http://drobilla.net> + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define __STDC_LIMIT_MACROS 1 + +#include <assert.h> +#include <stdint.h> + +#include <glib.h> + +#include <boost/shared_ptr.hpp> + +#include "raul/log.hpp" + +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" + +#include "URIs.hpp" + +using namespace std; +using namespace Raul; + +namespace Ingen { +namespace Shared { + +URIs::Quark::Quark(const char* c_str) + : Raul::URI(c_str) + , id(g_quark_from_string(c_str)) +{ +} + +const char* +URIs::Quark::c_str() const +{ + return g_quark_to_string(id); +} + +#define NS_CTX "http://lv2plug.in/ns/ext/contexts#" +#define NS_INGEN "http://drobilla.net/ns/ingen#" +#define NS_INGENUI "http://drobilla.net/ns/ingenuity#" +#define NS_LV2 "http://lv2plug.in/ns/lv2core#" +#define NS_MIDI "http://drobilla.net/ns/ext/midi#" +#define NS_MIDI "http://drobilla.net/ns/ext/midi#" +#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +#define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" + +URIs::URIs() + : atom_AtomTransfer (LV2_ATOM_URI "#AtomTransfer") + , atom_Bool (LV2_ATOM_URI "#Bool") + , atom_Float32 (LV2_ATOM_URI "#Float32") + , atom_Int32 (LV2_ATOM_URI "#Int32") + , atom_MessagePort (LV2_ATOM_URI "#MessagePort") + , atom_String (LV2_ATOM_URI "#String") + , atom_ValuePort (LV2_ATOM_URI "#ValuePort") + , atom_Vector (LV2_ATOM_URI "#Vector") + , atom_supports (LV2_ATOM_URI "#supports") + , ctx_AudioContext (NS_CTX "AudioContext") + , ctx_MessageContext (NS_CTX "MessageContext") + , ctx_context (NS_CTX "context") + , doap_name ("http://usefulinc.com/ns/doap#name") + , ev_EventPort ("http://lv2plug.in/ns/ext/event#EventPort") + , ingen_Internal (NS_INGEN "Internal") + , ingen_Node (NS_INGEN "Node") + , ingen_Patch (NS_INGEN "Patch") + , ingen_Port (NS_INGEN "Port") + , ingen_broadcast (NS_INGEN "broadcast") + , ingen_controlBinding (NS_INGEN "controlBinding") + , ingen_document (NS_INGEN "document") + , ingen_enabled (NS_INGEN "enabled") + , ingen_engine (NS_INGEN "engine") + , ingen_nil (NS_INGEN "nil") + , ingen_node (NS_INGEN "node") + , ingen_polyphonic (NS_INGEN "polyphonic") + , ingen_polyphony (NS_INGEN "polyphony") + , ingen_sampleRate (NS_INGEN "sampleRate") + , ingen_selected (NS_INGEN "selected") + , ingen_value (NS_INGEN "value") + , ingenui_canvas_x (NS_INGENUI "canvas-x") + , ingenui_canvas_y (NS_INGENUI "canvas-y") + , lv2_AudioPort (NS_LV2 "AudioPort") + , lv2_ControlPort (NS_LV2 "ControlPort") + , lv2_InputPort (NS_LV2 "InputPort") + , lv2_OutputPort (NS_LV2 "OutputPort") + , lv2_Plugin (NS_LV2 "Plugin") + , lv2_connectionOptional(NS_LV2 "connectionOptional") + , lv2_default (NS_LV2 "default") + , lv2_index (NS_LV2 "index") + , lv2_integer (NS_LV2 "integer") + , lv2_maximum (NS_LV2 "maximum") + , lv2_minimum (NS_LV2 "minimum") + , lv2_name (NS_LV2 "name") + , lv2_portProperty (NS_LV2 "portProperty") + , lv2_sampleRate (NS_LV2 "sampleRate") + , lv2_symbol (NS_LV2 "symbol") + , lv2_toggled (NS_LV2 "toggled") + , midi_Bender (NS_MIDI "Bender") + , midi_ChannelPressure (NS_MIDI "ChannelPressure") + , midi_Controller (NS_MIDI "Controller") + , midi_MidiEvent ("http://lv2plug.in/ns/ext/midi#MidiEvent") + , midi_Note (NS_MIDI "Note") + , midi_controllerNumber (NS_MIDI "controllerNumber") + , midi_noteNumber (NS_MIDI "noteNumber") + , rdf_instanceOf (NS_RDF "instanceOf") + , rdf_type (NS_RDF "type") + , rdfs_seeAlso (NS_RDFS "seeAlso") + , ui_Events ("http://lv2plug.in/ns/extensions/ui#Events") + , wildcard (NS_INGEN "wildcard") +{ +} + +} // namespace Shared +} // namespace Ingen diff --git a/src/shared/URIs.hpp b/src/shared/URIs.hpp new file mode 100644 index 00000000..7083507e --- /dev/null +++ b/src/shared/URIs.hpp @@ -0,0 +1,103 @@ +/* This file is part of Ingen. + * Copyright 2008-2011 David Robillard <http://drobilla.net> + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INGEN_SHARED_URIS_HPP +#define INGEN_SHARED_URIS_HPP + +#include <boost/utility.hpp> + +#include "raul/URI.hpp" + +namespace Ingen { +namespace Shared { + +class URIs : public boost::noncopyable { +public: + URIs(); + + struct Quark : public Raul::URI { + Quark(const char* str); + const char* c_str() const; + uint32_t id; + }; + + const Quark atom_AtomTransfer; + const Quark atom_Bool; + const Quark atom_Float32; + const Quark atom_Int32; + const Quark atom_MessagePort; + const Quark atom_String; + const Quark atom_ValuePort; + const Quark atom_Vector; + const Quark atom_supports; + const Quark ctx_AudioContext; + const Quark ctx_MessageContext; + const Quark ctx_context; + const Quark doap_name; + const Quark ev_EventPort; + const Quark ingen_Internal; + const Quark ingen_Node; + const Quark ingen_Patch; + const Quark ingen_Port; + const Quark ingen_broadcast; + const Quark ingen_controlBinding; + const Quark ingen_document; + const Quark ingen_enabled; + const Quark ingen_engine; + const Quark ingen_nil; + const Quark ingen_node; + const Quark ingen_polyphonic; + const Quark ingen_polyphony; + const Quark ingen_sampleRate; + const Quark ingen_selected; + const Quark ingen_value; + const Quark ingenui_canvas_x; + const Quark ingenui_canvas_y; + const Quark lv2_AudioPort; + const Quark lv2_ControlPort; + const Quark lv2_InputPort; + const Quark lv2_OutputPort; + const Quark lv2_Plugin; + const Quark lv2_connectionOptional; + const Quark lv2_default; + const Quark lv2_index; + const Quark lv2_integer; + const Quark lv2_maximum; + const Quark lv2_minimum; + const Quark lv2_name; + const Quark lv2_portProperty; + const Quark lv2_sampleRate; + const Quark lv2_symbol; + const Quark lv2_toggled; + const Quark midi_Bender; + const Quark midi_ChannelPressure; + const Quark midi_Controller; + const Quark midi_MidiEvent; + const Quark midi_Note; + const Quark midi_controllerNumber; + const Quark midi_noteNumber; + const Quark rdf_instanceOf; + const Quark rdf_type; + const Quark rdfs_seeAlso; + const Quark ui_Events; + const Quark wildcard; +}; + +} // namespace Shared +} // namespace Ingen + +#endif // INGEN_SHARED_LV2URIMAP_HPP diff --git a/src/shared/World.cpp b/src/shared/World.cpp index ba1e6802..4f6b279b 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -103,11 +103,12 @@ public: , conf(conf) , lv2_features(NULL) , rdf_world(new Sord::World()) - , uris(new Shared::LV2URIMap()) + , uris(new Shared::URIs()) + , lv2_uri_map(new Ingen::Shared::LV2URIMap(*uris.get())) , lilv_world(lilv_world_new()) { lv2_features = new Ingen::Shared::LV2Features(); - lv2_features->add_feature(uris); + lv2_features->add_feature(lv2_uri_map); lilv_world_load_all(lilv_world); // Set up RDF namespaces @@ -165,7 +166,8 @@ public: Raul::Configuration* conf; LV2Features* lv2_features; Sord::World* rdf_world; - SharedPtr<LV2URIMap> uris; + SharedPtr<URIs> uris; + SharedPtr<LV2URIMap> lv2_uri_map; SharedPtr<ServerInterface> engine; SharedPtr<EngineBase> local_engine; SharedPtr<Serialisation::Serialiser> serialiser; @@ -206,9 +208,10 @@ SharedPtr<ClientInterface> World::client() { return _impl->clien Raul::Configuration* World::conf() { return _impl->conf; } LV2Features* World::lv2_features() { return _impl->lv2_features; } -LilvWorld* World::lilv_world() { return _impl->lilv_world; } -Sord::World* World::rdf_world() { return _impl->rdf_world; } -SharedPtr<LV2URIMap> World::uris() { return _impl->uris; } +LilvWorld* World::lilv_world() { return _impl->lilv_world; } +Sord::World* World::rdf_world() { return _impl->rdf_world; } +SharedPtr<URIs> World::uris() { return _impl->uris; } +SharedPtr<LV2URIMap> World::lv2_uri_map() { return _impl->lv2_uri_map; } /** Load an Ingen module. * @return true on success, false on failure diff --git a/src/shared/wscript b/src/shared/wscript index d402a813..9ee7ba31 100644 --- a/src/shared/wscript +++ b/src/shared/wscript @@ -22,6 +22,7 @@ def build(bld): Module.cpp ResourceImpl.cpp Store.cpp + URIs.cpp World.cpp runtime_paths.cpp ''' |