summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-11 02:31:34 +0000
committerDavid Robillard <d@drobilla.net>2007-10-11 02:31:34 +0000
commit8defdcb32f4421c9d124767d1c677c05791ead55 (patch)
treed323293739b2c0ec78f0cf776265d882941c2e52 /src/libs/gui
parentc7f3a28390e651e03a68b664086351788a6a2d73 (diff)
downloadingen-8defdcb32f4421c9d124767d1c677c05791ead55.tar.gz
ingen-8defdcb32f4421c9d124767d1c677c05791ead55.tar.bz2
ingen-8defdcb32f4421c9d124767d1c677c05791ead55.zip
Fix Gtk rendering corruption problems when running monolithic (internal engine).
Reduce Gtk main loop overhead when running monolithic. Fix crash on importing certain Om patches. git-svn-id: http://svn.drobilla.net/lad/ingen@870 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/App.cpp15
-rw-r--r--src/libs/gui/App.hpp27
-rw-r--r--src/libs/gui/ConnectWindow.cpp47
3 files changed, 51 insertions, 38 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index e207bb9f..d9bac842 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -32,6 +32,7 @@
#include "client/ObjectModel.hpp"
#include "client/PatchModel.hpp"
#include "client/Store.hpp"
+#include "engine/Engine.hpp"
#include "NodeModule.hpp"
#include "ControlPanel.hpp"
#include "SubpatchModule.hpp"
@@ -169,7 +170,7 @@ App::run(int argc, char** argv,
void
-App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> client)
+App::attach(SharedPtr<EngineInterface> engine, SharedPtr<ThreadedSigClientInterface> client)
{
assert( ! _engine);
assert( ! _client);
@@ -347,6 +348,18 @@ App::event_save_session_as()
#endif
+bool
+App::gtk_main_iteration()
+{
+ if (_world->local_engine)
+ _world->local_engine->main_iteration();
+
+ _client->emit_signals();
+
+ return true;
+}
+
+
void
App::quit()
{
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 956ac9bd..cba8efab 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 SigClientInterface;
+ class ThreadedSigClientInterface;
}
namespace Serialisation {
class Serialiser;
@@ -83,11 +83,12 @@ public:
void error_message(const string& msg);
- void attach(SharedPtr<EngineInterface> engine,
- SharedPtr<SigClientInterface> client);
+ void attach(SharedPtr<EngineInterface> engine,
+ SharedPtr<ThreadedSigClientInterface> client);
void detach();
+ bool gtk_main_iteration();
void quit();
void port_activity(Port* port);
@@ -99,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<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; }
+ 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; }
SharedPtr<Glib::Module> serialisation_module() { return _serialisation_module; }
@@ -125,11 +126,11 @@ protected:
SharedPtr<Glib::Module> _serialisation_module;
- SharedPtr<EngineInterface> _engine;
- SharedPtr<SigClientInterface> _client;
- SharedPtr<Store> _store;
- SharedPtr<ThreadedLoader> _loader;
- SharedPtr<Serialiser> _serialiser;
+ SharedPtr<EngineInterface> _engine;
+ SharedPtr<ThreadedSigClientInterface> _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 e8f93354..25195f75 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -24,6 +24,7 @@
#include <raul/Process.hpp>
#include CONFIG_H_PATH
#include "interface/EngineInterface.hpp"
+#include "module/World.hpp"
#include "engine/tuning.hpp"
#include "engine/Engine.hpp"
#include "engine/QueuedEngineInterface.hpp"
@@ -107,9 +108,14 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::
void
ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface)
{
+ if (engine) {
+ _engine = engine;
+ _mode = INTERNAL;
+ }
+
set_connected_to(interface);
- show();
+#if 0
if (engine) {
Glib::signal_timeout().connect(
@@ -126,13 +132,10 @@ ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineIn
_connect_stage = 0;
}
-
- if (interface) {
- Glib::signal_timeout().connect(
- sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
- } else {
- connect();
- }
+#endif
+
+ show();
+ connect();
}
@@ -203,7 +206,7 @@ ConnectWindow::connect()
new OSCEngineSender(_url_entry->get_text()));
OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args
- SharedPtr<SigClientInterface> client(ose);
+ SharedPtr<ThreadedSigClientInterface> client(ose);
App::instance().attach(engine, client);
Glib::signal_timeout().connect(
@@ -224,7 +227,7 @@ ConnectWindow::connect()
new OSCEngineSender(string("osc.udp://localhost:").append(port_str)));
OSCSigEmitter* ose = new OSCSigEmitter(1024, 16181); // FIXME: args
- SharedPtr<SigClientInterface> client(ose);
+ SharedPtr<ThreadedSigClientInterface> client(ose);
App::instance().attach(engine, client);
Glib::signal_timeout().connect(
@@ -240,26 +243,23 @@ ConnectWindow::connect()
} else if (_mode == INTERNAL) {
assert(_new_engine);
_engine = SharedPtr<Ingen::Engine>(_new_engine(App::instance().world()));
-
- //_engine->start_jack_driver();
+ App::instance().world()->local_engine = _engine.get();
SharedPtr<Ingen::EngineInterface> engine_interface = _engine->new_queued_interface();
- ThreadedSigClientInterface* tsci = new ThreadedSigClientInterface(Ingen::event_queue_size);
- SharedPtr<SigClientInterface> client(tsci);
+ SharedPtr<ThreadedSigClientInterface> client(
+ new ThreadedSigClientInterface(Ingen::event_queue_size));
+
+ _engine->start_jack_driver();
+ _engine->activate(1); // FIXME: parallelism
App::instance().attach(engine_interface, client);
- /*_engine->activate(1); // FIXME
-
Glib::signal_timeout().connect(
- sigc::mem_fun(_engine.get(), &Ingen::Engine::main_iteration), 1000);*/
+ sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 100);
Glib::signal_timeout().connect(
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
-
- /*Glib::signal_timeout().connect(
- sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE);*/
}
}
@@ -341,12 +341,11 @@ ConnectWindow::gtk_callback()
/* Connecting to engine */
if (_connect_stage == 0) {
- assert(!_attached);
+ _attached = false;
+
assert(App::instance().engine());
assert(App::instance().client());
- // FIXME
- //assert(!App::instance().engine()->is_attached());
_progress_label->set_text("Connecting to engine...");
present();
@@ -381,7 +380,7 @@ ConnectWindow::gtk_callback()
// FIXME
//auto_ptr<ClientInterface> client(new ThreadedSigClientInterface();
// FIXME: client URI
- App::instance().engine()->register_client(App::instance().client().get());
+ //App::instance().engine()->register_client(App::instance().client().get());
App::instance().engine()->load_plugins();
++_connect_stage;
} else if (_connect_stage == 3) {