diff options
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/engine/LV2Node.cpp | 8 | ||||
-rw-r--r-- | src/libs/engine/LV2Node.hpp | 2 | ||||
-rw-r--r-- | src/libs/engine/Makefile.am | 7 | ||||
-rw-r--r-- | src/libs/engine/MessageContext.cpp (renamed from src/libs/engine/ProcessContext.cpp) | 15 | ||||
-rw-r--r-- | src/libs/engine/MessageContext.hpp | 55 | ||||
-rw-r--r-- | src/libs/engine/NodeBase.hpp | 2 | ||||
-rw-r--r-- | src/libs/engine/NodeImpl.hpp | 5 |
7 files changed, 87 insertions, 7 deletions
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 @@ -241,6 +241,14 @@ LV2Node::deactivate() void +LV2Node::message_process(MessageContext& context, uint32_t* output) +{ + *output = 0; + /* MESSAGE PROCESS */ +} + + +void LV2Node::process(ProcessContext& context) { NodeBase::pre_process(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/ProcessContext.cpp b/src/libs/engine/MessageContext.cpp index 306f3dba..30f04b05 100644 --- a/src/libs/engine/ProcessContext.cpp +++ b/src/libs/engine/MessageContext.cpp @@ -1,5 +1,5 @@ /* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> + * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * * 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 @@ -15,11 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ProcessContext.hpp" - -using namespace std; +#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 <http://drobilla.net> + * + * 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. * |