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/gui | |
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/gui')
-rw-r--r-- | src/gui/App.cpp | 28 | ||||
-rw-r--r-- | src/gui/App.hpp | 12 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 26 | ||||
-rw-r--r-- | src/gui/LoadRemotePatchWindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 2 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 7 | ||||
-rw-r--r-- | src/gui/Port.cpp | 5 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/ThreadedLoader.cpp | 16 | ||||
-rw-r--r-- | src/gui/ThreadedLoader.hpp | 2 |
10 files changed, 54 insertions, 55 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp index be15d4cb..ca59852a 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -90,10 +90,10 @@ App::App(Ingen::Shared::World* world) _about_dialog->property_program_name() = "Ingen"; _about_dialog->property_logo_icon_name() = "ingen"; - PluginModel::set_rdf_world(*world->rdf_world); + PluginModel::set_rdf_world(*world->rdf_world()); #ifdef HAVE_SLV2 - PluginModel::set_slv2_world(world->slv2_world); + PluginModel::set_slv2_world(world->slv2_world()); #endif } @@ -109,7 +109,7 @@ void App::init(Ingen::Shared::World* world) { Gnome::Canvas::init(); - _main = new Gtk::Main(world->argc, world->argv); + _main = new Gtk::Main(&world->argc(), &world->argv()); if (!_instance) _instance = new App(world); @@ -169,12 +169,12 @@ App::attach(SharedPtr<SigClientInterface> client, assert( ! _store); assert( ! _loader); - _world->engine->register_client(client.get()); + _world->engine()->register_client(client.get()); _client = client; _handle = handle; - _store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client)); - _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine)); + _store = SharedPtr<ClientStore>(new ClientStore(_world->uris(), _world->engine(), client)); + _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->uris(), _world->engine())); _patch_tree_window->init(*_store); @@ -186,7 +186,7 @@ App::attach(SharedPtr<SigClientInterface> client, void App::detach() { - if (_world->engine) { + if (_world->engine()) { _window_factory->clear(); _store->clear(); @@ -194,18 +194,18 @@ App::detach() _store.reset(); _client.reset(); _handle.reset(); - _world->engine.reset(); + _world->set_engine(SharedPtr<EngineInterface>()); } } -const SharedPtr<Serialiser>& +SharedPtr<Serialiser> App::serialiser() { - if (!_world->serialiser) + if (!_world->serialiser()) _world->load("ingen_serialisation"); - return _world->serialiser; + return _world->serialiser(); } @@ -299,8 +299,8 @@ App::gtk_main_iteration() if (!_client) return false; - if (_world->local_engine) { - _world->local_engine->main_iteration(); + if (_world->local_engine()) { + _world->local_engine()->main_iteration(); } else { _enable_signal = false; _client->emit_signals(); @@ -326,7 +326,7 @@ bool App::quit(Gtk::Window& dialog_parent) { bool quit = true; - if (App::instance().world()->local_engine) { + if (App::instance().world()->local_engine()) { Gtk::MessageDialog d(dialog_parent, "The engine is running in this process. Quitting will terminate Ingen." "\n\n" "Are you sure you want to quit?", diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 3ac881f6..a793b968 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -105,12 +105,12 @@ public: Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const std::string& path, int size); - const SharedPtr<Shared::EngineInterface>& engine() const { return _world->engine; } - const SharedPtr<Client::SigClientInterface>& client() const { return _client; } - const SharedPtr<Client::ClientStore>& store() const { return _store; } - const SharedPtr<ThreadedLoader>& loader() const { return _loader; } + SharedPtr<Shared::EngineInterface> engine() const { return _world->engine(); } + SharedPtr<Client::SigClientInterface> client() const { return _client; } + SharedPtr<Client::ClientStore> store() const { return _store; } + SharedPtr<ThreadedLoader> loader() const { return _loader; } - const SharedPtr<Serialisation::Serialiser>& serialiser(); + SharedPtr<Serialisation::Serialiser> serialiser(); static inline App& instance() { assert(_instance); return *_instance; } @@ -118,7 +118,7 @@ public: static void run(); inline Ingen::Shared::World* world() const { return _world; } - inline Ingen::Shared::LV2URIMap& uris() const { return *_world->uris; } + inline Ingen::Shared::LV2URIMap& uris() const { return *_world->uris(); } protected: diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index aae826e4..ec440501 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -74,13 +74,13 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: void ConnectWindow::start(Ingen::Shared::World* world) { - if (world->local_engine) { + if (world->local_engine()) { _mode = INTERNAL; if (_widgets_loaded) _internal_radio->set_active(true); } - set_connected_to(world->engine); + set_connected_to(world->engine()); connect(true); } @@ -89,7 +89,7 @@ ConnectWindow::start(Ingen::Shared::World* world) void ConnectWindow::set_connected_to(SharedPtr<Shared::EngineInterface> engine) { - App::instance().world()->engine = engine; + App::instance().world()->set_engine(engine); if (!_widgets_loaded) return; @@ -111,7 +111,7 @@ ConnectWindow::set_connected_to(SharedPtr<Shared::EngineInterface> engine) _connect_button->set_sensitive(true); _disconnect_button->set_sensitive(false); - if (App::instance().world()->local_engine) + if (App::instance().world()->local_engine()) _internal_radio->set_sensitive(true); else _internal_radio->set_sensitive(false); @@ -178,7 +178,7 @@ ConnectWindow::connect(bool existing) } if (existing) - uri = world->engine->uri().str(); + uri = world->engine()->uri().str(); // Create client-side listener SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); @@ -198,14 +198,14 @@ ConnectWindow::connect(bool existing) if (!existing) { #ifdef HAVE_LIBLO if (scheme == "osc.udp" || scheme == "osc.tcp") - world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(uri)); + world->set_engine(SharedPtr<EngineInterface>(new OSCEngineSender(uri))); #endif #ifdef HAVE_SOUP if (scheme == "http") - world->engine = SharedPtr<EngineInterface>(new HTTPEngineSender(world, uri)); + world->set_engine(SharedPtr<EngineInterface>(new HTTPEngineSender(world, uri))); #endif } else { - uri = world->engine->uri().str(); + uri = world->engine()->uri().str(); scheme = uri.substr(0, uri.find(":")); } @@ -223,8 +223,8 @@ ConnectWindow::connect(bool existing) const string cmd = string("ingen -e --engine-port=").append(port_str); if (Raul::Process::launch(cmd)) { - world->engine = SharedPtr<EngineInterface>( - new OSCEngineSender(string("osc.udp://localhost:").append(port_str))); + world->set_engine(SharedPtr<EngineInterface>( + new OSCEngineSender(string("osc.udp://localhost:").append(port_str)))); // FIXME: static args SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); @@ -246,15 +246,15 @@ ConnectWindow::connect(bool existing) } else #endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP) if (_mode == INTERNAL) { - if (!world->local_engine) + if (!world->local_engine()) world->load("ingen_engine"); SharedPtr<SigClientInterface> client(new SigClientInterface()); - if (!world->local_engine->driver()) + if (!world->local_engine()->driver()) world->load("ingen_jack"); - world->local_engine->activate(); + world->local_engine()->activate(); App::instance().attach(client); App::instance().register_callbacks(); diff --git a/src/gui/LoadRemotePatchWindow.cpp b/src/gui/LoadRemotePatchWindow.cpp index 0359b34c..a7725571 100644 --- a/src/gui/LoadRemotePatchWindow.cpp +++ b/src/gui/LoadRemotePatchWindow.cpp @@ -66,17 +66,17 @@ LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Propert set_patch(patch); _initial_data = data; - Redland::Model model(*App::instance().world()->rdf_world, + Redland::Model model(*App::instance().world()->rdf_world(), "http://rdf.drobilla.net/ingen_patches/index.ttl", "http://rdf.drobilla.net/ingen_patches/"); - Redland::Query query(*App::instance().world()->rdf_world, Glib::ustring( + Redland::Query query(*App::instance().world()->rdf_world(), Glib::ustring( "SELECT DISTINCT ?name ?uri WHERE {" " ?uri a ingen:Patch ;" " doap:name ?name ." "}")); - Redland::Query::Results results = query.run(*App::instance().world()->rdf_world, model); + Redland::Query::Results results = query.run(*App::instance().world()->rdf_world(), model); for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Gtk::TreeModel::iterator iter = _liststore->append(); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 30762f99..a2db6f83 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -120,7 +120,7 @@ NodeModule::show_human_names(bool b) const LV2URIMap& uris = App::instance().uris(); if (b && node()->plugin()) { - Glib::Mutex::Lock lock(App::instance().world()->rdf_world->mutex()); + Glib::Mutex::Lock lock(App::instance().world()->rdf_world()->mutex()); const Raul::Atom& name_property = node()->get_property(uris.lv2_name); if (name_property.type() == Atom::STRING) set_name(name_property.get_string()); diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 4981bf6e..a1617993 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -661,11 +661,12 @@ PatchCanvas::paste() clear_selection(); ++_paste_count; - Builder builder(*App::instance().engine()); - ClientStore clipboard; + const LV2URIMap& uris = App::instance().uris(); + + Builder builder(App::instance().world()->uris(), *App::instance().engine()); + ClientStore clipboard(App::instance().world()->uris()); clipboard.set_plugins(App::instance().store()->plugins()); - const LV2URIMap& uris = App::instance().uris(); // mkdir -p string to_create = _patch->path().chop_scheme().substr(1); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 4e1a5460..0ef9f634 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -192,7 +192,7 @@ Port::set_control(float value, bool signal) App& app = App::instance(); Ingen::Shared::World* const world = app.world(); app.engine()->set_property(model()->path(), - world->uris->ingen_value, Atom(value)); + world->uris()->ingen_value, Atom(value)); PatchWindow* pw = app.window_factory()->patch_window( PtrCast<PatchModel>(model()->parent())); if (!pw) @@ -241,8 +241,7 @@ Port::dash() if (!pm) return NULL; - const Raul::Atom& context = pm->get_property(uris.ctx_context); - if (!context.is_valid() || context.type() != Atom::URI || context == uris.ctx_AudioContext) + if (pm->has_context(uris.ctx_AudioContext)) return NULL; if (!_dash) { diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 44c1c774..5f7e3d15 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -18,7 +18,6 @@ #include <cassert> #include <string> #include "raul/log.hpp" -#include "module/ingen_module.hpp" #include "module/World.hpp" #include "client/NodeModel.hpp" #include "client/PluginModel.hpp" @@ -89,7 +88,7 @@ PropertiesWindow::set_object(SharedPtr<ObjectModel> model) set_title(model->path().chop_scheme() + " Properties - Ingen"); - Shared::World* world = ingen_get_world(); + Shared::World* world = App::instance().world(); ostringstream ss; unsigned n_rows = 0; @@ -100,7 +99,7 @@ PropertiesWindow::set_object(SharedPtr<ObjectModel> model) const Raul::Atom& value = i->second; // Column 0: Property - Gtk::Label* lab = manage(new Gtk::Label(world->rdf_world->qualify(i->first.str()), 0.0, 0.5)); + Gtk::Label* lab = manage(new Gtk::Label(world->rdf_world()->qualify(i->first.str()), 0.0, 0.5)); _table->attach(*lab, 0, 1, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK); // Column 1: Type diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 9b991555..eae032f4 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -31,9 +31,9 @@ namespace Ingen { namespace GUI { -ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine) +ThreadedLoader::ThreadedLoader(SharedPtr<Shared::LV2URIMap> uris, SharedPtr<EngineInterface> engine) : _engine(engine) - , _deprecated_loader(engine) + , _deprecated_loader(uris, engine) { set_name("Loader"); @@ -47,12 +47,12 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine) SharedPtr<Parser> ThreadedLoader::parser() { - Ingen::Shared::World* world = ingen_get_world(); + Ingen::Shared::World* world = App::instance().world(); - if (!world->parser) + if (!world->parser()) world->load("ingen_serialisation"); - return world->parser; + return world->parser(); } @@ -79,7 +79,7 @@ ThreadedLoader::load_patch(bool merge, { _mutex.lock(); - Ingen::Shared::World* world = ingen_get_world(); + Ingen::Shared::World* world = App::instance().world(); Glib::ustring engine_base = ""; if (engine_parent) { @@ -101,9 +101,9 @@ ThreadedLoader::load_patch(bool merge, false))); } else { _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(world->parser.get(), &Ingen::Serialisation::Parser::parse_document), + sigc::mem_fun(world->parser().get(), &Ingen::Serialisation::Parser::parse_document), App::instance().world(), - App::instance().world()->engine.get(), + App::instance().world()->engine().get(), document_uri, data_path, engine_parent, diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index f6b8d706..1c05ea22 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -55,7 +55,7 @@ namespace GUI { class ThreadedLoader : public Raul::Slave { public: - ThreadedLoader(SharedPtr<EngineInterface> engine); + ThreadedLoader(SharedPtr<Shared::LV2URIMap> uris, SharedPtr<EngineInterface> engine); void load_patch(bool merge, const Glib::ustring& document_uri, |