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/events/DisconnectionEvent.cpp | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/libs/engine/events/DisconnectionEvent.cpp') diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 431061a2..c246e9dc 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -35,8 +35,8 @@ namespace Ingen { //// DisconnectionEvent //// -DisconnectionEvent::DisconnectionEvent(CountedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) -: QueuedEvent(responder, timestamp), +DisconnectionEvent::DisconnectionEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) +: QueuedEvent(engine, responder, timestamp), m_src_port_path(src_port_path), m_dst_port_path(dst_port_path), m_patch(NULL), @@ -49,8 +49,8 @@ DisconnectionEvent::DisconnectionEvent(CountedPtr responder, SampleCo } -DisconnectionEvent::DisconnectionEvent(CountedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port) -: QueuedEvent(responder, timestamp), +DisconnectionEvent::DisconnectionEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port) +: QueuedEvent(engine, responder, timestamp), m_src_port_path(src_port->path()), m_dst_port_path(dst_port->path()), m_patch(src_port->parent_node()->parent_patch()), @@ -85,7 +85,7 @@ DisconnectionEvent::pre_process() return; } - /*m_patch = Engine::instance().object_store()->find_patch(m_src_port_path.parent().parent()); + /*m_patch = _engine.object_store()->find_patch(m_src_port_path.parent().parent()); if (m_patch == NULL) { m_error = PORT_NOT_FOUND; @@ -93,8 +93,8 @@ DisconnectionEvent::pre_process() return; }*/ - m_src_port = Engine::instance().object_store()->find_port(m_src_port_path); - m_dst_port = Engine::instance().object_store()->find_port(m_dst_port_path); + m_src_port = _engine.object_store()->find_port(m_src_port_path); + m_dst_port = _engine.object_store()->find_port(m_dst_port_path); } if (m_src_port == NULL || m_dst_port == NULL) { @@ -112,10 +112,10 @@ DisconnectionEvent::pre_process() // Create the typed event to actually do the work const DataType type = m_src_port->type(); if (type == DataType::FLOAT) { - m_typed_event = new TypedDisconnectionEvent(_responder, _time_stamp, + m_typed_event = new TypedDisconnectionEvent(_engine, _responder, _time, dynamic_cast*>(m_src_port), dynamic_cast*>(m_dst_port)); } else if (type == DataType::MIDI) { - m_typed_event = new TypedDisconnectionEvent(_responder, _time_stamp, + m_typed_event = new TypedDisconnectionEvent(_engine, _responder, _time, dynamic_cast*>(m_src_port), dynamic_cast*>(m_dst_port)); } else { m_error = TYPE_MISMATCH; @@ -131,12 +131,12 @@ DisconnectionEvent::pre_process() void -DisconnectionEvent::execute(SampleCount offset) +DisconnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) { - QueuedEvent::execute(offset); + QueuedEvent::execute(nframes, start, end); if (m_error == NO_ERROR) - m_typed_event->execute(offset); + m_typed_event->execute(nframes, start, end); } @@ -159,8 +159,8 @@ DisconnectionEvent::post_process() template -TypedDisconnectionEvent::TypedDisconnectionEvent(CountedPtr responder, SampleCount timestamp, OutputPort* src_port, InputPort* dst_port) -: QueuedEvent(responder, timestamp), +TypedDisconnectionEvent::TypedDisconnectionEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, OutputPort* src_port, InputPort* dst_port) +: QueuedEvent(engine, responder, timestamp), m_src_port(src_port), m_dst_port(dst_port), m_patch(NULL), @@ -223,7 +223,7 @@ TypedDisconnectionEvent::pre_process() break; } - if (m_patch->process()) + if (m_patch->enabled()) m_process_order = m_patch->build_process_order(); m_succeeded = true; @@ -233,7 +233,7 @@ TypedDisconnectionEvent::pre_process() template void -TypedDisconnectionEvent::execute(SampleCount offset) +TypedDisconnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) { if (m_succeeded) { @@ -248,18 +248,18 @@ TypedDisconnectionEvent::execute(SampleCount offset) assert((Connection*)port_connection->elem() == patch_connection->elem()); // Clean up both the list node and the connection itself... - Engine::instance().maid()->push(port_connection); - Engine::instance().maid()->push(patch_connection); - Engine::instance().maid()->push(port_connection->elem()); + _engine.maid()->push(port_connection); + _engine.maid()->push(patch_connection); + _engine.maid()->push(port_connection->elem()); if (m_patch->process_order() != NULL) - Engine::instance().maid()->push(m_patch->process_order()); + _engine.maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } else { m_succeeded = false; // Ports weren't connected } } - QueuedEvent::execute(offset); + QueuedEvent::execute(nframes, start, end); } @@ -271,7 +271,7 @@ TypedDisconnectionEvent::post_process() _responder->respond_ok(); - Engine::instance().client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path()); + _engine.client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path()); } else { _responder->respond_error("Unable to disconnect ports."); } -- cgit v1.2.1