summaryrefslogtreecommitdiffstats
path: root/src/server/PortImpl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-20 03:27:33 +0100
committerDavid Robillard <d@drobilla.net>2017-03-20 03:27:33 +0100
commit9f1f6485c99e90831bbcebaa35831ff76b2204ed (patch)
tree608d084815b27ee59af77683d13020d24aa9c36f /src/server/PortImpl.cpp
parent59f579df71e52207bcdda15d4abb3562fdc1d6f2 (diff)
downloadingen-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/PortImpl.cpp')
-rw-r--r--src/server/PortImpl.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 45a5a082..a9c1aefe 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -243,7 +243,7 @@ PortImpl::set_voice_value(const RunContext& context,
{
switch (_type.id()) {
case PortType::CONTROL:
- buffer(voice)->samples()[0] = value;
+ ((LV2_Atom_Float*)buffer(voice)->value())->body = value;
_voices->at(voice).set_state.set(context, context.start(), value);
break;
case PortType::AUDIO:
@@ -411,22 +411,24 @@ void
PortImpl::clear_buffers(const RunContext& ctx)
{
switch (_type.id()) {
- case PortType::CONTROL:
- case PortType::CV:
+ case PortType::AUDIO:
+ default:
for (uint32_t v = 0; v < _poly; ++v) {
- Buffer* buf = buffer(v).get();
- buf->set_block(_value.get<float>(), 0, ctx.nframes());
- SetState& state = _voices->at(v).set_state;
- state.state = SetState::State::SET;
- state.value = _value.get<float>();
- state.time = 0;
+ buffer(v)->clear();
}
break;
- case PortType::AUDIO:
- default:
+ case PortType::CONTROL:
for (uint32_t v = 0; v < _poly; ++v) {
buffer(v)->clear();
+ _voices->at(v).set_state.set(ctx, ctx.start(), _value.get<float>());
+ }
+ break;
+ case PortType::CV:
+ for (uint32_t v = 0; v < _poly; ++v) {
+ buffer(v)->set_block(_value.get<float>(), 0, ctx.nframes());
+ _voices->at(v).set_state.set(ctx, ctx.start(), _value.get<float>());
}
+ break;
}
}