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/ClearPatchEvent.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/libs/engine/events/ClearPatchEvent.cpp') diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 3cd8faab..e73fd376 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -30,8 +30,8 @@ namespace Ingen { -ClearPatchEvent::ClearPatchEvent(CountedPtr responder, SampleCount timestamp, const string& patch_path) -: QueuedEvent(responder, true), +ClearPatchEvent::ClearPatchEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, const string& patch_path) +: QueuedEvent(engine, responder, true), m_patch_path(patch_path), m_patch(NULL), m_process(false) @@ -42,11 +42,11 @@ ClearPatchEvent::ClearPatchEvent(CountedPtr responder, SampleCount ti void ClearPatchEvent::pre_process() { - m_patch = Engine::instance().object_store()->find_patch(m_patch_path); + m_patch = _engine.object_store()->find_patch(m_patch_path); if (m_patch != NULL) { - m_process = m_patch->process(); + m_process = m_patch->enabled(); for (List::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i) (*i)->remove_from_store(); @@ -57,21 +57,21 @@ ClearPatchEvent::pre_process() void -ClearPatchEvent::execute(SampleCount offset) +ClearPatchEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) { if (m_patch != NULL) { - m_patch->process(false); + m_patch->disable(); for (List::const_iterator i = m_patch->nodes().begin(); i != m_patch->nodes().end(); ++i) (*i)->remove_from_patch(); 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(NULL); } } - QueuedEvent::execute(offset); + QueuedEvent::execute(nframes, start, end); } @@ -92,7 +92,10 @@ ClearPatchEvent::post_process() m_patch->connections().clear(); // Restore patch's run state - m_patch->process(m_process); + if (m_process) + m_patch->enable(); + else + m_patch->disable(); // Make sure everything's sane assert(m_patch->nodes().size() == 0); @@ -100,7 +103,7 @@ ClearPatchEvent::post_process() // Reply _responder->respond_ok(); - Engine::instance().client_broadcaster()->send_patch_cleared(m_patch_path); + _engine.client_broadcaster()->send_patch_cleared(m_patch_path); } else { _responder->respond_error(string("Patch ") + m_patch_path + " not found"); } -- cgit v1.2.1