summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-11 05:25:32 +0000
committerDavid Robillard <d@drobilla.net>2007-10-11 05:25:32 +0000
commit3319e2dfa3ab5b1732777323da92d08b9ee42b8e (patch)
treeaabc443039093849f24e55e4d70958bff5d079d5 /src/libs
parent8defdcb32f4421c9d124767d1c677c05791ead55 (diff)
downloadingen-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')
-rw-r--r--src/libs/client/SigClientInterface.hpp59
-rw-r--r--src/libs/client/ThreadedSigClientInterface.hpp8
-rw-r--r--src/libs/engine/Engine.cpp4
-rw-r--r--src/libs/engine/JackAudioDriver.cpp2
-rw-r--r--src/libs/gui/App.cpp34
-rw-r--r--src/libs/gui/App.hpp28
-rw-r--r--src/libs/gui/ConnectWindow.cpp59
7 files changed, 73 insertions, 121 deletions
diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp
index 27469f9e..cefc3176 100644
--- a/src/libs/client/SigClientInterface.hpp
+++ b/src/libs/client/SigClientInterface.hpp
@@ -40,6 +40,7 @@ namespace Client {
class SigClientInterface : virtual public Ingen::Shared::ClientInterface, public sigc::trackable
{
public:
+ SigClientInterface() : _enabled(true) {}
// Signal parameters match up directly with ClientInterface calls
@@ -67,14 +68,18 @@ public:
sigc::signal<void, string> signal_port_activity;
sigc::signal<void, string, uint32_t, uint32_t, string> signal_program_add;
sigc::signal<void, string, uint32_t, uint32_t> signal_program_remove;
+
+ /** Fire pending signals. Only does anything on derived classes (that may queue) */
+ virtual bool emit_signals() { return false; }
protected:
+
+ bool _enabled;
// ClientInterface hooks that fire the above signals
- // FIXME: implement for this (is implemented for ThreadedSigClientInterface)
- void enable() { }
- void disable() { }
+ void enable() { _enabled = true; }
+ void disable() { _enabled = false ; }
void bundle_begin() {}
void bundle_end() {}
@@ -85,67 +90,67 @@ protected:
void num_plugins(uint32_t num) { signal_num_plugins.emit(num); }
void response_ok(int32_t id)
- { signal_response_ok.emit(id); }
+ { if (_enabled) signal_response_ok.emit(id); }
void response_error(int32_t id, const string& msg)
- { signal_response_error.emit(id, msg); }
+ { if (_enabled) signal_response_error.emit(id, msg); }
void error(const string& msg)
- { signal_error.emit(msg); }
+ { if (_enabled) signal_error.emit(msg); }
void new_plugin(const string& uri, const string& type_uri, const string& name)
- { signal_new_plugin.emit(uri, type_uri, name); }
+ { if (_enabled) signal_new_plugin.emit(uri, type_uri, name); }
void new_patch(const string& path, uint32_t poly)
- { signal_new_patch.emit(path, poly); }
+ { if (_enabled) signal_new_patch.emit(path, poly); }
- void new_node(const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports)
- { signal_new_node.emit(plugin_uri, node_path, is_polyphonic, num_ports); }
+ void new_node(const string& plugin_uri, const string& node_path, bool poly, uint32_t num_ports)
+ { if (_enabled) signal_new_node.emit(plugin_uri, node_path, poly, num_ports); }
void new_port(const string& path, const string& data_type, bool is_output)
- { signal_new_port.emit(path, data_type, is_output); }
+ { if (_enabled) signal_new_port.emit(path, data_type, is_output); }
+
+ void polyphonic(const string& path, bool polyphonic)
+ { if (_enabled) signal_polyphonic.emit(path, polyphonic); }
void connection(const string& src_port_path, const string& dst_port_path)
- { signal_connection.emit(src_port_path, dst_port_path); }
+ { if (_enabled) signal_connection.emit(src_port_path, dst_port_path); }
void object_destroyed(const string& path)
- { signal_object_destroyed.emit(path); }
+ { if (_enabled) signal_object_destroyed.emit(path); }
void patch_enabled(const string& path)
- { signal_patch_enabled.emit(path); }
+ { if (_enabled) signal_patch_enabled.emit(path); }
void patch_disabled(const string& path)
- { signal_patch_disabled.emit(path); }
+ { if (_enabled) signal_patch_disabled.emit(path); }
void patch_polyphony(const string& path, uint32_t poly)
- { signal_patch_polyphony.emit(path, poly); }
+ { if (_enabled) signal_patch_polyphony.emit(path, poly); }
void patch_cleared(const string& path)
- { signal_patch_cleared.emit(path); }
+ { if (_enabled) signal_patch_cleared.emit(path); }
void object_renamed(const string& old_path, const string& new_path)
- { signal_object_renamed.emit(old_path, new_path); }
+ { if (_enabled) signal_object_renamed.emit(old_path, new_path); }
void disconnection(const string& src_port_path, const string& dst_port_path)
- { signal_disconnection.emit(src_port_path, dst_port_path); }
+ { if (_enabled) signal_disconnection.emit(src_port_path, dst_port_path); }
void variable_change(const string& path, const string& key, const Raul::Atom& value)
- { signal_variable_change.emit(path, key, value); }
+ { if (_enabled) signal_variable_change.emit(path, key, value); }
void control_change(const string& port_path, float value)
- { signal_control_change.emit(port_path, value); }
+ { if (_enabled) signal_control_change.emit(port_path, value); }
void port_activity(const string& port_path)
- { signal_port_activity.emit(port_path); }
+ { if (_enabled) signal_port_activity.emit(port_path); }
void program_add(const string& path, uint32_t bank, uint32_t program, const string& name)
- { signal_program_add.emit(path, bank, program, name); }
+ { if (_enabled) signal_program_add.emit(path, bank, program, name); }
void program_remove(const string& path, uint32_t bank, uint32_t program)
- { signal_program_remove.emit(path, bank, program); }
-
-protected:
- SigClientInterface() {}
+ { if (_enabled) signal_program_remove.emit(path, bank, program); }
};
diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp
index 8a4db3f7..0f300703 100644
--- a/src/libs/client/ThreadedSigClientInterface.hpp
+++ b/src/libs/client/ThreadedSigClientInterface.hpp
@@ -45,8 +45,7 @@ class ThreadedSigClientInterface : public SigClientInterface
{
public:
ThreadedSigClientInterface(uint32_t queue_size)
- : _enabled(true)
- , _sigs(queue_size)
+ : _sigs(queue_size)
, response_ok_slot(signal_response_ok.make_slot())
, response_error_slot(signal_response_error.make_slot())
, error_slot(signal_error.make_slot())
@@ -70,9 +69,6 @@ public:
, program_remove_slot(signal_program_remove.make_slot())
{}
- void enable() { _enabled = true; }
- void disable() { _enabled = false ; }
-
virtual void subscribe(Shared::EngineInterface* engine) { throw; } // FIXME
// TODO: make this insert bundle-boundary-events, where the GTK thread
@@ -154,8 +150,6 @@ public:
private:
void push_sig(Closure ev);
- bool _enabled;
-
Raul::SRSWQueue<Closure> _sigs;
uint32_t _num_plugins;
diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp
index 004de200..f0b43dc8 100644
--- a/src/libs/engine/Engine.cpp
+++ b/src/libs/engine/Engine.cpp
@@ -267,11 +267,9 @@ Engine::deactivate()
_process_slaves.clear();
// Finalize any lingering events (unlikely)
- //_post_processor->whip();
- //_post_processor->stop();
+ _post_processor->process();
_audio_driver.reset();
-
_event_source.reset();
_activated = false;
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index 0c824935..f90e1075 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -276,7 +276,7 @@ JackAudioDriver::driver_port(const Path& path)
int
JackAudioDriver::_process_cb(jack_nframes_t nframes)
{
- if (nframes == 0)
+ if (nframes == 0 || ! _is_activated)
return 0;
// FIXME: all of this time stuff is screwy
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;