From 97c3b4ba12052b47ec41dc6aded5f1fc84e67c8f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 28 Sep 2008 07:13:36 +0000 Subject: Update contexts extension. Update bang plugin and fix UI building (UI instantiates in ingen again). Stubs for a message thread implementation in ingen. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1525 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/LV2Node.cpp | 8 ++++++ src/libs/engine/LV2Node.hpp | 2 ++ src/libs/engine/Makefile.am | 7 ++--- src/libs/engine/MessageContext.cpp | 32 ++++++++++++++++++++++ src/libs/engine/MessageContext.hpp | 55 ++++++++++++++++++++++++++++++++++++++ src/libs/engine/NodeBase.hpp | 2 ++ src/libs/engine/NodeImpl.hpp | 5 ++++ src/libs/engine/ProcessContext.cpp | 25 ----------------- 8 files changed, 108 insertions(+), 28 deletions(-) create mode 100644 src/libs/engine/MessageContext.cpp create mode 100644 src/libs/engine/MessageContext.hpp delete mode 100644 src/libs/engine/ProcessContext.cpp (limited to 'src/libs/engine') diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index cfc9be78..d784f1d2 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -240,6 +240,14 @@ LV2Node::deactivate() } +void +LV2Node::message_process(MessageContext& context, uint32_t* output) +{ + *output = 0; + /* MESSAGE PROCESS */ +} + + void LV2Node::process(ProcessContext& context) { diff --git a/src/libs/engine/LV2Node.hpp b/src/libs/engine/LV2Node.hpp index 47a628b9..dbdb6511 100644 --- a/src/libs/engine/LV2Node.hpp +++ b/src/libs/engine/LV2Node.hpp @@ -52,6 +52,8 @@ public: void activate(); void deactivate(); + void message_process(MessageContext& context, uint32_t* output); + void process(ProcessContext& context); void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf); diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index fed0804e..c7c433d3 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -45,6 +45,8 @@ libingen_engine_la_SOURCES = \ DuplexPort.hpp \ Engine.cpp \ Engine.hpp \ + EngineStore.cpp \ + EngineStore.hpp \ Event.cpp \ Event.hpp \ EventBuffer.cpp \ @@ -68,6 +70,8 @@ libingen_engine_la_SOURCES = \ LV2Info.hpp \ LV2Plugin.cpp \ LV2Plugin.hpp \ + MessageContext.cpp \ + MessageContext.hpp \ MidiControlNode.cpp \ MidiControlNode.hpp \ MidiDriver.hpp \ @@ -87,8 +91,6 @@ libingen_engine_la_SOURCES = \ OSCEngineReceiver.hpp \ ObjectSender.cpp \ ObjectSender.hpp \ - EngineStore.cpp \ - EngineStore.hpp \ OutputPort.cpp \ OutputPort.hpp \ PatchImpl.cpp \ @@ -100,7 +102,6 @@ libingen_engine_la_SOURCES = \ PortImpl.hpp \ PostProcessor.cpp \ PostProcessor.hpp \ - ProcessContext.cpp \ ProcessContext.hpp \ ProcessSlave.cpp \ ProcessSlave.hpp \ diff --git a/src/libs/engine/MessageContext.cpp b/src/libs/engine/MessageContext.cpp new file mode 100644 index 00000000..30f04b05 --- /dev/null +++ b/src/libs/engine/MessageContext.cpp @@ -0,0 +1,32 @@ +/* This file is part of Ingen. + * Copyright (C) 2008 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "MessageContext.hpp" +#include "NodeImpl.hpp" + +namespace Ingen { + +void +MessageContext::run(NodeImpl* node) +{ + uint32_t outputs; + node->message_process(*this, &outputs); + + // Don't care what the plugin output, yet... +} + +} // namespace Ingen diff --git a/src/libs/engine/MessageContext.hpp b/src/libs/engine/MessageContext.hpp new file mode 100644 index 00000000..3a53e73a --- /dev/null +++ b/src/libs/engine/MessageContext.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright (C) 2007-2008 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MESSAGECONTEXT_H +#define MESSAGECONTEXT_H + +#include "EventSink.hpp" + +namespace Ingen { + +class NodeImpl; + +/** Context of a message_process() call. + * + * The message context is a non-hard-realtime thread used to execute things + * that can take too long to execute in an audio thread, and do sloppy timed + * event propagation and scheduling. Interface to plugins via the + * LV2 contexts extension. + * + * \ingroup engine + */ +class MessageContext +{ +public: + MessageContext(Engine& engine) + : _engine(engine) + {} + + void run(NodeImpl* node); + + inline Engine& engine() const { return _engine; } + +private: + Engine& _engine; ///< Engine we're running in +}; + + +} // namespace Ingen + +#endif // MESSAGECONTEXT_H + diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp index e4e2bfe5..e3710aa9 100644 --- a/src/libs/engine/NodeBase.hpp +++ b/src/libs/engine/NodeBase.hpp @@ -69,6 +69,8 @@ public: virtual void process_unlock(); virtual void wait_for_input(size_t num_providers); virtual unsigned n_inputs_ready() const { return _n_inputs_ready.get(); } + + virtual void message_process(MessageContext& context, uint32_t* output) {} virtual void pre_process(ProcessContext& context); virtual void process(ProcessContext& context) = 0; diff --git a/src/libs/engine/NodeImpl.hpp b/src/libs/engine/NodeImpl.hpp index 3c6c95f3..ac125c13 100644 --- a/src/libs/engine/NodeImpl.hpp +++ b/src/libs/engine/NodeImpl.hpp @@ -36,6 +36,7 @@ class Buffer; class PluginImpl; class PatchImpl; class PortImpl; +class MessageContext; /** A Node (or "module") in a Patch (which is also a Node). @@ -112,6 +113,10 @@ public: /** Parallelism: Return the number of providers that have signalled. */ virtual unsigned n_inputs_ready() const = 0; + + /** Run the node for one instant in the message thread. + */ + virtual void message_process(MessageContext& context, uint32_t* output) = 0; /** Run the node for @a nframes input/output. * diff --git a/src/libs/engine/ProcessContext.cpp b/src/libs/engine/ProcessContext.cpp deleted file mode 100644 index 306f3dba..00000000 --- a/src/libs/engine/ProcessContext.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "ProcessContext.hpp" - -using namespace std; - -namespace Ingen { - - -} // namespace Ingen -- cgit v1.2.1