From 48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 8 Sep 2006 03:58:00 +0000 Subject: De-singleton-ified Engine Slight rework of Responder/ClientKey/ClientInterface for Requests git-svn-id: http://svn.drobilla.net/lad/ingen@119 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/QueuedEngineInterface.cpp | 61 ++++++++++++++++--------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'src/libs/engine/QueuedEngineInterface.cpp') diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index f9ad8a00..4d38f91c 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -23,9 +23,10 @@ namespace Ingen { -QueuedEngineInterface::QueuedEngineInterface(size_t queued_size, size_t stamped_size) +QueuedEngineInterface::QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size) : QueuedEventSource(queued_size, stamped_size) , _responder(CountedPtr(new Responder())) // NULL responder +, _engine(engine) { } @@ -33,7 +34,7 @@ QueuedEngineInterface::QueuedEngineInterface(size_t queued_size, size_t stamped_ SampleCount QueuedEngineInterface::now() const { - return Engine::instance().audio_driver()->time_stamp(); + return _engine.audio_driver()->frame_time(); } /** Set the Responder to send responses to commands with, once the commands @@ -63,14 +64,14 @@ QueuedEngineInterface::disable_responses() void QueuedEngineInterface::register_client(ClientKey key, CountedPtr client) { - push_queued(new RegisterClientEvent(_responder, now(), key, client)); + push_queued(new RegisterClientEvent(_engine, _responder, now(), key, client)); } void QueuedEngineInterface::unregister_client(ClientKey key) { - push_queued(new UnregisterClientEvent(_responder, now(), key)); + push_queued(new UnregisterClientEvent(_engine, _responder, now(), key)); } @@ -79,7 +80,7 @@ QueuedEngineInterface::unregister_client(ClientKey key) void QueuedEngineInterface::load_plugins() { - push_queued(new LoadPluginsEvent(_responder, now())); + push_queued(new LoadPluginsEvent(_engine, _responder, now())); } @@ -87,14 +88,14 @@ QueuedEngineInterface::load_plugins() void QueuedEngineInterface::activate() { - push_queued(new ActivateEvent(_responder, now())); + push_queued(new ActivateEvent(_engine, _responder, now())); } void QueuedEngineInterface::deactivate() { - push_queued(new DeactivateEvent(_responder, now())); + push_queued(new DeactivateEvent(_engine, _responder, now())); } @@ -102,7 +103,7 @@ void QueuedEngineInterface::quit() { _responder->respond_ok(); - Engine::instance().quit(); + _engine.quit(); } @@ -113,7 +114,7 @@ void QueuedEngineInterface::create_patch(const string& path, uint32_t poly) { - push_queued(new CreatePatchEvent(_responder, now(), path, poly)); + push_queued(new CreatePatchEvent(_engine, _responder, now(), path, poly)); } @@ -122,7 +123,7 @@ void QueuedEngineInterface::create_port(const string& path, const string& data_type, bool direction) { - push_queued(new AddPortEvent(_responder, now(), path, data_type, direction)); + push_queued(new AddPortEvent(_engine, _responder, now(), path, data_type, direction)); } @@ -138,7 +139,7 @@ QueuedEngineInterface::create_node(const string& path, plugin->set_type(plugin_type); plugin->uri(plugin_uri); - push_queued(new AddNodeEvent(_responder, now(), path, plugin, polyphonic)); + push_queued(new AddNodeEvent(_engine, _responder, now(), path, plugin, polyphonic)); } @@ -156,42 +157,42 @@ QueuedEngineInterface::create_node(const string& path, plugin->lib_name(plugin_lib); plugin->plug_label(plugin_label); - push_queued(new AddNodeEvent(_responder, now(), path, plugin, polyphonic)); + push_queued(new AddNodeEvent(_engine, _responder, now(), path, plugin, polyphonic)); } void QueuedEngineInterface::rename(const string& old_path, const string& new_name) { - push_queued(new RenameEvent(_responder, now(), old_path, new_name)); + push_queued(new RenameEvent(_engine, _responder, now(), old_path, new_name)); } void QueuedEngineInterface::destroy(const string& path) { - push_queued(new DestroyEvent(_responder, now(), this, path)); + push_queued(new DestroyEvent(_engine, _responder, now(), this, path)); } void QueuedEngineInterface::clear_patch(const string& patch_path) { - push_queued(new ClearPatchEvent(_responder, now(), patch_path)); + push_queued(new ClearPatchEvent(_engine, _responder, now(), patch_path)); } void QueuedEngineInterface::enable_patch(const string& patch_path) { - push_queued(new EnablePatchEvent(_responder, now(), patch_path)); + push_queued(new EnablePatchEvent(_engine, _responder, now(), patch_path)); } void QueuedEngineInterface::disable_patch(const string& patch_path) { - push_queued(new DisablePatchEvent(_responder, now(), patch_path)); + push_queued(new DisablePatchEvent(_engine, _responder, now(), patch_path)); } @@ -199,7 +200,7 @@ void QueuedEngineInterface::connect(const string& src_port_path, const string& dst_port_path) { - push_queued(new ConnectionEvent(_responder, now(), src_port_path, dst_port_path)); + push_queued(new ConnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path)); } @@ -208,14 +209,14 @@ void QueuedEngineInterface::disconnect(const string& src_port_path, const string& dst_port_path) { - push_queued(new DisconnectionEvent(_responder, now(), src_port_path, dst_port_path)); + push_queued(new DisconnectionEvent(_engine, _responder, now(), src_port_path, dst_port_path)); } void QueuedEngineInterface::disconnect_all(const string& node_path) { - push_queued(new DisconnectNodeEvent(_responder, now(), node_path)); + push_queued(new DisconnectNodeEvent(_engine, _responder, now(), node_path)); } @@ -223,7 +224,7 @@ void QueuedEngineInterface::set_port_value(const string& port_path, float value) { - push_stamped(new SetPortValueEvent(_responder, now(), port_path, value)); + push_stamped(new SetPortValueEvent(_engine, _responder, now(), port_path, value)); } @@ -232,7 +233,7 @@ QueuedEngineInterface::set_port_value(const string& port_path, uint32_t voice, float value) { - push_stamped(new SetPortValueEvent(_responder, now(), voice, port_path, value)); + push_stamped(new SetPortValueEvent(_engine, _responder, now(), voice, port_path, value)); } @@ -240,7 +241,7 @@ void QueuedEngineInterface::set_port_value_queued(const string& port_path, float value) { - push_queued(new SetPortValueQueuedEvent(_responder, now(), port_path, value)); + push_queued(new SetPortValueQueuedEvent(_engine, _responder, now(), port_path, value)); } @@ -249,14 +250,14 @@ QueuedEngineInterface::set_program(const string& node_path, uint32_t bank, uint32_t program) { - push_queued(new DSSIProgramEvent(_responder, now(), node_path, bank, program)); + push_queued(new DSSIProgramEvent(_engine, _responder, now(), node_path, bank, program)); } void QueuedEngineInterface::midi_learn(const string& node_path) { - push_queued(new MidiLearnEvent(_responder, now(), node_path)); + push_queued(new MidiLearnEvent(_engine, _responder, now(), node_path)); } @@ -265,7 +266,7 @@ QueuedEngineInterface::set_metadata(const string& path, const string& predicate, const string& value) { - push_queued(new SetMetadataEvent(_responder, now(), path, predicate, value)); + push_queued(new SetMetadataEvent(_engine, _responder, now(), path, predicate, value)); } @@ -274,28 +275,28 @@ QueuedEngineInterface::set_metadata(const string& path, void QueuedEngineInterface::ping() { - push_queued(new PingQueuedEvent(_responder, now())); + push_queued(new PingQueuedEvent(_engine, _responder, now())); } void QueuedEngineInterface::request_port_value(const string& port_path) { - push_queued(new RequestPortValueEvent(_responder, now(), port_path)); + push_queued(new RequestPortValueEvent(_engine, _responder, now(), port_path)); } void QueuedEngineInterface::request_plugins() { - push_queued(new RequestPluginsEvent(_responder, now())); + push_queued(new RequestPluginsEvent(_engine, _responder, now())); } void QueuedEngineInterface::request_all_objects() { - push_queued(new RequestAllObjectsEvent(_responder, now())); + push_queued(new RequestAllObjectsEvent(_engine, _responder, now())); } -- cgit v1.2.1