summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/Patch.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-29 21:39:53 +0000
committerDavid Robillard <d@drobilla.net>2007-09-29 21:39:53 +0000
commitc0af61632938f161dd2e15dec3c5260a3d5427ca (patch)
tree950bcfc1bc1fb232f8244c42504b8da3d5b511f5 /src/libs/engine/Patch.cpp
parent85923e8b4f9f1601f008a9120d376d944f2478a2 (diff)
downloadingen-c0af61632938f161dd2e15dec3c5260a3d5427ca.tar.gz
ingen-c0af61632938f161dd2e15dec3c5260a3d5427ca.tar.bz2
ingen-c0af61632938f161dd2e15dec3c5260a3d5427ca.zip
Work towards port monitoring and better (higher utilization) parallel execution.
git-svn-id: http://svn.drobilla.net/lad/ingen@784 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/Patch.cpp')
-rw-r--r--src/libs/engine/Patch.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp
index 2705db36..80d59768 100644
--- a/src/libs/engine/Patch.cpp
+++ b/src/libs/engine/Patch.cpp
@@ -147,33 +147,25 @@ Patch::apply_internal_poly(Raul::Maid& maid, uint32_t poly)
* Calls all Nodes in (roughly, if parallel) the order _compiled_patch specifies.
*/
void
-Patch::process(SampleCount nframes, FrameTime start, FrameTime end)
+Patch::process(ProcessContext& context, SampleCount nframes, FrameTime start, FrameTime end)
{
if (_compiled_patch == NULL || _compiled_patch->size() == 0 || !_process)
return;
- /* Prepare input ports */
- /* FIXME: Pre-processing input ports breaks MIDI somehow? */
- if (_ports)
- for (size_t i=0; i < _ports->size(); ++i)
- if (_ports->at(i)->is_output())
- _ports->at(i)->pre_process(nframes, start, end);
+ NodeBase::pre_process(nframes, start, end);
/* Run */
if (_engine.process_slaves().size() > 0)
- process_parallel(nframes, start, end);
+ process_parallel(context, nframes, start, end);
else
- process_single(nframes, start, end);
+ process_single(context, nframes, start, end);
- /* Write output ports */
- if (_ports)
- for (size_t i=0; i < _ports->size(); ++i)
- _ports->at(i)->post_process(nframes, start, end);
+ NodeBase::post_process(nframes, start, end);
}
void
-Patch::process_parallel(SampleCount nframes, FrameTime start, FrameTime end)
+Patch::process_parallel(ProcessContext& context, SampleCount nframes, FrameTime start, FrameTime end)
{
size_t n_slaves = _engine.process_slaves().size();
@@ -209,7 +201,7 @@ Patch::process_parallel(SampleCount nframes, FrameTime start, FrameTime end)
if (n.node()->process_lock()) {
if (n.node()->n_inputs_ready() == n.n_providers()) {
- n.node()->process(nframes, start, end);
+ n.node()->process(context, nframes, start, end);
/* Signal dependants their input is ready */
for (size_t i=0; i < n.dependants().size(); ++i)
@@ -232,7 +224,8 @@ Patch::process_parallel(SampleCount nframes, FrameTime start, FrameTime end)
/* Tell slaves we're done in case we beat them, and pray they're
* really done by the start of next cycle.
- * FIXME: This probably breaks (race) at extremely small nframes.
+ * FIXME: This probably breaks (race) at extremely small nframes where
+ * ingen is the majority of the DSP load.
*/
for (size_t i=0; i < n_slaves; ++i)
_engine.process_slaves()[i]->finish();
@@ -240,12 +233,12 @@ Patch::process_parallel(SampleCount nframes, FrameTime start, FrameTime end)
void
-Patch::process_single(SampleCount nframes, FrameTime start, FrameTime end)
+Patch::process_single(ProcessContext& context, SampleCount nframes, FrameTime start, FrameTime end)
{
CompiledPatch* const cp = _compiled_patch;
for (size_t i=0; i < cp->size(); ++i)
- (*cp)[i].node()->process(nframes, start, end);
+ (*cp)[i].node()->process(context, nframes, start, end);
}