diff options
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/App.cpp | 22 | ||||
-rw-r--r-- | src/libs/gui/App.hpp | 13 | ||||
-rw-r--r-- | src/libs/gui/ConnectWindow.cpp | 59 | ||||
-rw-r--r-- | src/libs/gui/ConnectWindow.hpp | 6 | ||||
-rw-r--r-- | src/libs/gui/ControlPanel.cpp | 4 | ||||
-rw-r--r-- | src/libs/gui/Port.cpp | 2 | ||||
-rw-r--r-- | src/libs/gui/ThreadedLoader.cpp | 3 | ||||
-rw-r--r-- | src/libs/gui/gui.cpp | 7 | ||||
-rw-r--r-- | src/libs/gui/gui.hpp | 5 |
9 files changed, 52 insertions, 69 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index 736ec4bb..dc919b20 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -104,6 +104,7 @@ App::App(Ingen::Shared::World* world) rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#"); rdf_world.add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#"); rdf_world.add_prefix("lv2", "http://lv2plug.in/ns/lv2core#"); + rdf_world.add_prefix("lv2_midi", "http://lv2plug.in/ns/ext/midi"); rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#"); rdf_world.add_prefix("dc", "http://purl.org/dc/elements/1.1/"); @@ -121,10 +122,7 @@ App::~App() } void -App::run(int argc, char** argv, - Ingen::Shared::World* world, - SharedPtr<Engine> engine, - SharedPtr<Shared::EngineInterface> interface) +App::run(int argc, char** argv, Ingen::Shared::World* world) { Gnome::Canvas::init(); Gtk::Main main(argc, argv); @@ -163,7 +161,7 @@ App::run(int argc, char** argv, Gtk::RC::parse_string(rc_style); - App::instance().connect_window()->start(engine, interface); + App::instance().connect_window()->start(world); main.run(); @@ -172,19 +170,17 @@ App::run(int argc, char** argv, void -App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> client) +App::attach(SharedPtr<SigClientInterface> client) { - assert( ! _engine); assert( ! _client); assert( ! _store); assert( ! _loader); - engine->register_client(client.get()); + _world->engine->register_client(client.get()); - _engine = engine; _client = client; - _store = SharedPtr<Store>(new Store(engine, client)); - _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(engine)); + _store = SharedPtr<Store>(new Store(_world->engine, client)); + _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine)); _patch_tree_window->init(*_store); @@ -196,14 +192,14 @@ App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> cli void App::detach() { - if (_engine) { + if (_world->engine) { _window_factory->clear(); _store->clear(); _loader.reset(); _store.reset(); _client.reset(); - _engine.reset(); + _world->engine.reset(); } } diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index 6bb7083b..44878925 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -28,6 +28,7 @@ #include <libglademm.h> #include <raul/SharedPtr.hpp> #include <redlandmm/World.hpp> +#include <module/World.hpp> using namespace std; @@ -83,9 +84,7 @@ public: void error_message(const string& msg); - void attach(SharedPtr<EngineInterface> engine, - SharedPtr<SigClientInterface> client); - + void attach(SharedPtr<SigClientInterface> client); void detach(); bool gtk_main_iteration(); @@ -102,7 +101,7 @@ public: Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const string& path, int size); - const SharedPtr<EngineInterface>& engine() const { return _engine; } + const SharedPtr<EngineInterface> engine() const { return _world->engine; } const SharedPtr<SigClientInterface>& client() const { return _client; } const SharedPtr<Store>& store() const { return _store; } const SharedPtr<ThreadedLoader>& loader() const { return _loader; } @@ -112,10 +111,7 @@ public: static inline App& instance() { assert(_instance); return *_instance; } - static void run(int argc, char** argv, - Ingen::Shared::World* world, - SharedPtr<Ingen::Engine> engine, - SharedPtr<Shared::EngineInterface> interface); + static void run(int argc, char** argv, Ingen::Shared::World* world); Ingen::Shared::World* world() { return _world; } @@ -144,7 +140,6 @@ protected: SharedPtr<Glib::Module> _serialisation_module; - SharedPtr<EngineInterface> _engine; SharedPtr<SigClientInterface> _client; SharedPtr<Store> _store; SharedPtr<ThreadedLoader> _loader; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index 7bf34c01..288b30cc 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -106,15 +106,14 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: void -ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface) +ConnectWindow::start(Ingen::Shared::World* world) { - set_connected_to(interface); - - if (engine) { - _engine = engine; + if (world->local_engine) { _mode = INTERNAL; _internal_radio->set_active(true); } + + set_connected_to(world->engine); show(); connect(); @@ -156,7 +155,7 @@ ConnectWindow::set_connected_to(SharedPtr<Shared::EngineInterface> engine) _progress_label->set_text(string("Disconnected")); } - App::instance().world()->engine = engine.get(); + App::instance().world()->engine = engine; } @@ -169,7 +168,6 @@ void ConnectWindow::connect() { assert(!_attached); - assert(!App::instance().engine()); assert(!App::instance().client()); _connect_button->set_sensitive(false); @@ -184,14 +182,16 @@ ConnectWindow::connect() _port_spinbutton->set_sensitive(false); _connect_stage = 0; + + Ingen::Shared::World* world = App::instance().world(); if (_mode == CONNECT_REMOTE) { - SharedPtr<EngineInterface> engine( - new OSCEngineSender(_url_entry->get_text())); + world->engine = SharedPtr<EngineInterface>( + new OSCEngineSender(_url_entry->get_text())); OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args SharedPtr<ThreadedSigClientInterface> client(ose); - App::instance().attach(engine, client); + App::instance().attach(client); Glib::signal_timeout().connect( sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT); @@ -207,36 +207,38 @@ ConnectWindow::connect() const string cmd = string("ingen -e --engine-port=").append(port_str); if (Raul::Process::launch(cmd)) { - SharedPtr<EngineInterface> engine( - new OSCEngineSender(string("osc.udp://localhost:").append(port_str))); + world->engine = SharedPtr<EngineInterface>( + new OSCEngineSender(string("osc.udp://localhost:").append(port_str))); - OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args - SharedPtr<ThreadedSigClientInterface> client(ose); - App::instance().attach(engine, client); - - Glib::signal_timeout().connect( - sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT); + OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args + SharedPtr<ThreadedSigClientInterface> client(ose); + App::instance().attach(client); - Glib::signal_timeout().connect( - sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); + Glib::signal_timeout().connect( + sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT); + + Glib::signal_timeout().connect( + sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); } else { cerr << "Failed to launch ingen process." << endl; } } else if (_mode == INTERNAL) { + Ingen::Shared::World* world = App::instance().world(); assert(_new_engine); - _engine = SharedPtr<Ingen::Engine>(_new_engine(App::instance().world())); - App::instance().world()->local_engine = _engine.get(); + if ( ! world->local_engine) + world->local_engine = SharedPtr<Engine>(_new_engine(world)); + + if ( ! world->engine) + world->engine = world->local_engine->new_queued_interface(); - SharedPtr<Ingen::EngineInterface> engine_interface = _engine->new_queued_interface(); - SharedPtr<SigClientInterface> client(new SigClientInterface()); - _engine->start_jack_driver(); - _engine->activate(1); // FIXME: parallelism + world->local_engine->start_jack_driver(); + world->local_engine->activate(1); // FIXME: parallelism - App::instance().attach(engine_interface, client); + App::instance().attach(client); Glib::signal_timeout().connect( sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT); @@ -258,8 +260,7 @@ ConnectWindow::disconnect() _disconnect_button->set_sensitive(false); App::instance().detach(); - - set_connected_to(); + set_connected_to(SharedPtr<Ingen::Shared::EngineInterface>()); _connect_button->set_sensitive(true); _disconnect_button->set_sensitive(false); diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp index 315ae0b2..53d0ccd5 100644 --- a/src/libs/gui/ConnectWindow.hpp +++ b/src/libs/gui/ConnectWindow.hpp @@ -51,8 +51,8 @@ class ConnectWindow : public Gtk::Dialog public: ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void set_connected_to(SharedPtr<Shared::EngineInterface> e=SharedPtr<Shared::EngineInterface>()); - void start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface); + void set_connected_to(SharedPtr<Shared::EngineInterface> engine); + void start(Ingen::Shared::World* world); void response_ok_received(int32_t id) { if ((id) == _ping_id) _attached = true; } private: @@ -77,8 +77,6 @@ private: SharedPtr<Glib::Module> _engine_module; Ingen::Engine* (*_new_engine)(Ingen::Shared::World* world); - SharedPtr<Ingen::Engine> _engine; - Gtk::Image* _icon; Gtk::ProgressBar* _progress_bar; Gtk::Label* _progress_label; diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index a59a15f6..7e82c7dc 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -233,12 +233,12 @@ ControlPanel::value_changed(SharedPtr<PortModel> port, float val) if (_callback_enabled) { if (_all_voices_radio->get_active()) { - App::instance().engine()->set_port_value_immediate(port->path(), "ingen:control", + App::instance().engine()->set_port_value_immediate(port->path(), "ingen:Float", sizeof(float), &val); port->value(val); } else { int voice = _voice_spinbutton->get_value_as_int(); - App::instance().engine()->set_port_value_immediate(port->path(), "ingen:control", + App::instance().engine()->set_port_value_immediate(port->path(), "ingen:Float", voice, sizeof(float), &val); port->value(val); } diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp index 36a010bb..7508a47f 100644 --- a/src/libs/gui/Port.cpp +++ b/src/libs/gui/Port.cpp @@ -116,7 +116,7 @@ Port::set_control(float value, bool signal) return; if (signal) - App::instance().engine()->set_port_value_immediate(_port_model->path(), "ingen:control", + App::instance().engine()->set_port_value_immediate(_port_model->path(), "ingen:Float", sizeof(float), &value); FlowCanvas::Port::set_control(value); diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp index a037a711..949cde1a 100644 --- a/src/libs/gui/ThreadedLoader.cpp +++ b/src/libs/gui/ThreadedLoader.cpp @@ -95,8 +95,7 @@ ThreadedLoader::load_patch(bool merge, } else { _events.push_back(sigc::hide_return(sigc::bind( sigc::mem_fun(_loader.get(), &Ingen::Serialisation::Loader::load), - App::instance().engine(), - App::instance().world()->rdf_world, + App::instance().world(), data_base_uri, engine_parent, (engine_name) ? engine_name.get() : "", diff --git a/src/libs/gui/gui.cpp b/src/libs/gui/gui.cpp index ca160e00..10af6d9b 100644 --- a/src/libs/gui/gui.cpp +++ b/src/libs/gui/gui.cpp @@ -24,12 +24,9 @@ namespace Ingen { namespace GUI { -void run(int argc, char** argv, - Ingen::Shared::World* world, - SharedPtr<Ingen::Engine> engine, - SharedPtr<Shared::EngineInterface> interface) +void run(int argc, char** argv, Ingen::Shared::World* world) { - App::run(argc, argv, world, engine, interface); + App::run(argc, argv, world); } diff --git a/src/libs/gui/gui.hpp b/src/libs/gui/gui.hpp index fa31fe8d..a959f17a 100644 --- a/src/libs/gui/gui.hpp +++ b/src/libs/gui/gui.hpp @@ -33,10 +33,7 @@ namespace GUI { extern "C" { - void run(int argc, char** argv, - Ingen::Shared::World* world, - SharedPtr<Ingen::Engine> engine, - SharedPtr<Shared::EngineInterface> interface); + void run(int argc, char** argv, Ingen::Shared::World* world); } |