diff options
author | David Robillard <d@drobilla.net> | 2007-10-11 05:25:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-10-11 05:25:32 +0000 |
commit | 3319e2dfa3ab5b1732777323da92d08b9ee42b8e (patch) | |
tree | aabc443039093849f24e55e4d70958bff5d079d5 /src/libs/gui | |
parent | 8defdcb32f4421c9d124767d1c677c05791ead55 (diff) | |
download | ingen-3319e2dfa3ab5b1732777323da92d08b9ee42b8e.tar.gz ingen-3319e2dfa3ab5b1732777323da92d08b9ee42b8e.tar.bz2 ingen-3319e2dfa3ab5b1732777323da92d08b9ee42b8e.zip |
Fix initial state of radio buttons in connect window when running ingen -eg.
Move all GTK main stuff into a single callback (control order better, avoid scheduler overhead).
Speed up client GTK thread event processing rate.
Eliminate buffering of post-processed events when running internal engine (post-process events directly in GTK thread).
git-svn-id: http://svn.drobilla.net/lad/ingen@873 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/App.cpp | 34 | ||||
-rw-r--r-- | src/libs/gui/App.hpp | 28 | ||||
-rw-r--r-- | src/libs/gui/ConnectWindow.cpp | 59 |
3 files changed, 38 insertions, 83 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index d9bac842..fde2fdaa 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -170,7 +170,7 @@ App::run(int argc, char** argv, void -App::attach(SharedPtr<EngineInterface> engine, SharedPtr<ThreadedSigClientInterface> client) +App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> client) { assert( ! _engine); assert( ! _client); @@ -185,9 +185,6 @@ App::attach(SharedPtr<EngineInterface> engine, SharedPtr<ThreadedSigClientInterf _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(engine)); _patch_tree_window->init(*_store); - - Glib::signal_timeout().connect(sigc::mem_fun(this, &App::animate_callback), - 100, G_PRIORITY_DEFAULT_IDLE); } @@ -235,7 +232,7 @@ App::port_activity(Port* port) bool -App::animate_callback() +App::animate() { for (ActivityPorts::iterator i = _activity_ports.begin(); i != _activity_ports.end() ; ) { ActivityPorts::iterator next = i; @@ -255,21 +252,6 @@ App::animate_callback() } -/* -bool -App::idle_callback() -{ - _client_hooks->process_events(); - -#ifdef HAVE_LASH - //if (lash_controller->enabled()) - // lash_controller->process_events(); -#endif - - return true; -} -*/ - /******** Event Handlers ************/ @@ -351,11 +333,17 @@ App::event_save_session_as() bool App::gtk_main_iteration() { - if (_world->local_engine) + if (!_client) + return false; + + if (_world->local_engine) { _world->local_engine->main_iteration(); + } else { + _client->emit_signals(); + } + + animate(); - _client->emit_signals(); - return true; } diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index cba8efab..0b351003 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -41,7 +41,7 @@ namespace Ingen { class PatchModel; class PluginModel; class Store; - class ThreadedSigClientInterface; + class SigClientInterface; } namespace Serialisation { class Serialiser; @@ -83,8 +83,8 @@ public: void error_message(const string& msg); - void attach(SharedPtr<EngineInterface> engine, - SharedPtr<ThreadedSigClientInterface> client); + void attach(SharedPtr<EngineInterface> engine, + SharedPtr<SigClientInterface> client); void detach(); @@ -100,11 +100,11 @@ public: Configuration* configuration() const { return _configuration; } WindowFactory* window_factory() const { return _window_factory; } - const SharedPtr<EngineInterface>& engine() const { return _engine; } - const SharedPtr<ThreadedSigClientInterface>& client() const { return _client; } - const SharedPtr<Store>& store() const { return _store; } - const SharedPtr<ThreadedLoader>& loader() const { return _loader; } - const SharedPtr<Serialiser>& serialiser() const { return _serialiser; } + const SharedPtr<EngineInterface>& engine() const { return _engine; } + const SharedPtr<SigClientInterface>& client() const { return _client; } + const SharedPtr<Store>& store() const { return _store; } + const SharedPtr<ThreadedLoader>& loader() const { return _loader; } + const SharedPtr<Serialiser>& serialiser() const { return _serialiser; } SharedPtr<Glib::Module> serialisation_module() { return _serialisation_module; } @@ -120,17 +120,17 @@ public: protected: App(Ingen::Shared::World* world); - bool animate_callback(); + bool animate(); static App* _instance; SharedPtr<Glib::Module> _serialisation_module; - SharedPtr<EngineInterface> _engine; - SharedPtr<ThreadedSigClientInterface> _client; - SharedPtr<Store> _store; - SharedPtr<ThreadedLoader> _loader; - SharedPtr<Serialiser> _serialiser; + SharedPtr<EngineInterface> _engine; + SharedPtr<SigClientInterface> _client; + SharedPtr<Store> _store; + SharedPtr<ThreadedLoader> _loader; + SharedPtr<Serialiser> _serialiser; Configuration* _configuration; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index 25195f75..3fed50d8 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -108,32 +108,14 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: void ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface) { + set_connected_to(interface); + if (engine) { _engine = engine; _mode = INTERNAL; + _internal_radio->set_active(true); } - set_connected_to(interface); - -#if 0 - if (engine) { - - Glib::signal_timeout().connect( - sigc::mem_fun(engine.get(), &Ingen::Engine::main_iteration), 1000); - - ThreadedSigClientInterface* tsci = new ThreadedSigClientInterface(Ingen::event_queue_size); - SharedPtr<SigClientInterface> client(tsci); - - Glib::signal_timeout().connect( - sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE); - - if (interface) - App::instance().attach(interface, client); - - _connect_stage = 0; - } -#endif - show(); connect(); } @@ -208,12 +190,12 @@ ConnectWindow::connect() 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); Glib::signal_timeout().connect( sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); - - Glib::signal_timeout().connect( - sigc::mem_fun(ose, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE); } else if (_mode == LAUNCH_REMOTE) { @@ -229,13 +211,13 @@ ConnectWindow::connect() 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); Glib::signal_timeout().connect( sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); - Glib::signal_timeout().connect( - sigc::mem_fun(ose, &ThreadedSigClientInterface::emit_signals), - 10, G_PRIORITY_HIGH_IDLE); } else { cerr << "Failed to launch ingen process." << endl; } @@ -247,8 +229,7 @@ ConnectWindow::connect() SharedPtr<Ingen::EngineInterface> engine_interface = _engine->new_queued_interface(); - SharedPtr<ThreadedSigClientInterface> client( - new ThreadedSigClientInterface(Ingen::event_queue_size)); + SharedPtr<SigClientInterface> client(new SigClientInterface()); _engine->start_jack_driver(); _engine->activate(1); // FIXME: parallelism @@ -256,7 +237,7 @@ ConnectWindow::connect() App::instance().attach(engine_interface, client); Glib::signal_timeout().connect( - sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 100); + 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); @@ -375,29 +356,15 @@ ConnectWindow::gtk_callback() } } } else if (_connect_stage == 2) { - _progress_label->set_text(string("Registering as client...")); - //App::instance().engine()->register_client(App::instance().engine()->client_hooks()); - // FIXME - //auto_ptr<ClientInterface> client(new ThreadedSigClientInterface(); - // FIXME: client URI - //App::instance().engine()->register_client(App::instance().client().get()); + _progress_label->set_text(string("Loading plugins...")); App::instance().engine()->load_plugins(); ++_connect_stage; } else if (_connect_stage == 3) { - // Register idle callback to process events and whatnot - // (Gtk refreshes at priority G_PRIORITY_HIGH_IDLE+20) - /*Glib::signal_timeout().connect( - sigc::mem_fun(this, &App::idle_callback), 100, G_PRIORITY_HIGH_IDLE);*/ - //Glib::signal_idle().connect(sigc::mem_fun(this, &App::idle_callback)); - /* Glib::signal_timeout().connect( - sigc::mem_fun((ThreadedSigClientInterface*)_client, &ThreadedSigClientInterface::emit_signals), - 5, G_PRIORITY_DEFAULT_IDLE);*/ - _progress_label->set_text(string("Requesting plugins...")); App::instance().engine()->request_plugins(); ++_connect_stage; } else if (_connect_stage == 4) { - // Wait for first plugins message + // Wait for first plugin message if (App::instance().store()->plugins().size() > 0) { _progress_label->set_text(string("Receiving plugins...")); ++_connect_stage; |