diff options
author | David Robillard <d@drobilla.net> | 2017-03-20 03:27:33 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-03-20 03:27:33 +0100 |
commit | 9f1f6485c99e90831bbcebaa35831ff76b2204ed (patch) | |
tree | 608d084815b27ee59af77683d13020d24aa9c36f /src/server/BlockImpl.cpp | |
parent | 59f579df71e52207bcdda15d4abb3562fdc1d6f2 (diff) | |
download | ingen-9f1f6485c99e90831bbcebaa35831ff76b2204ed.tar.gz ingen-9f1f6485c99e90831bbcebaa35831ff76b2204ed.tar.bz2 ingen-9f1f6485c99e90831bbcebaa35831ff76b2204ed.zip |
Always use sample accurate controls
This changes control port buffers to always be sequences of float, splitting
cycles internally so nodes with control ports act as if they support sample
accurate control input and output. This allows things like having networks of
control ports manipulated by the user which are run into CV ports and having
sample accurate changes end up in the CV ports even though the values were
calculated by plugins with single float ports.
Further work is probably necessary to thin and smooth changes that come from a
user drag (perhaps there should be a mode for this?) to keep the amount of
cycle splitting reasonable, and support for plugins with fixed block length.
Diffstat (limited to 'src/server/BlockImpl.cpp')
-rw-r--r-- | src/server/BlockImpl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 3b051fd4..d0f0d646 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -258,6 +258,17 @@ BlockImpl::process(RunContext& context) // Run the chunk run(subcontext); + // Emit control port outputs as events + for (uint32_t i = 0; _ports && i < _ports->size(); ++i) { + PortImpl* const port = _ports->at(i); + if (port->type() == PortType::CONTROL && port->is_output()) { + // TODO: Only emit events when value has actually changed? + for (uint32_t v = 0; v < _polyphony; ++v) { + port->buffer(v)->append_event(offset, port->buffer(v)->value()); + } + } + } + offset = chunk_end; subcontext.slice(offset, chunk_end - offset); } |