summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-10-14 15:07:57 -0400
committerDavid Robillard <d@drobilla.net>2016-10-14 16:27:16 -0400
commit8d92e5a38e141236b3687e8d775ee5d034127fb8 (patch)
treefe24ca9e3def991085d7001bd2d91090313e7213 /src/server/events
parent2e5df4c0d30fea03f0f3b176a449e17da5fc25f9 (diff)
downloadingen-8d92e5a38e141236b3687e8d775ee5d034127fb8.tar.gz
ingen-8d92e5a38e141236b3687e8d775ee5d034127fb8.tar.bz2
ingen-8d92e5a38e141236b3687e8d775ee5d034127fb8.zip
Fix communication with connected sequence ports
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/SetPortValue.cpp31
-rw-r--r--src/server/events/SetPortValue.hpp2
2 files changed, 26 insertions, 7 deletions
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 9530e2d3..2af9841b 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -55,6 +55,7 @@ SetPortValue::~SetPortValue()
bool
SetPortValue::pre_process(PreProcessContext& ctx)
{
+ Ingen::URIs& uris = _engine.world()->uris();
if (_port->is_output()) {
return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path());
}
@@ -65,6 +66,15 @@ SetPortValue::pre_process(PreProcessContext& ctx)
_binding = _engine.control_bindings()->port_binding(_port);
+ if (_port->buffer_type() == uris.atom_Sequence) {
+ _buffer = _engine.buffer_factory()->get_buffer(
+ _port->buffer_type(),
+ _port->value_type(),
+ _engine.buffer_factory()->default_size(_port->buffer_type()),
+ false,
+ false);
+ }
+
return Event::pre_process_done(Status::SUCCESS);
}
@@ -84,7 +94,16 @@ SetPortValue::apply(RunContext& context)
}
Ingen::URIs& uris = _engine.world()->uris();
- Buffer* const buf = _port->buffer(0).get();
+ Buffer* buf = _port->buffer(0).get();
+
+ if (_buffer) {
+ if (_port->user_buffer(context)) {
+ buf = _port->user_buffer(context).get();
+ } else {
+ _port->set_user_buffer(context, _buffer);
+ buf = _buffer.get();
+ }
+ }
if (buf->type() == uris.atom_Sound || buf->type() == uris.atom_Float) {
if (_value.type() == uris.forge.Float) {
@@ -93,12 +112,10 @@ SetPortValue::apply(RunContext& context)
_status = Status::TYPE_MISMATCH;
}
} else if (buf->type() == uris.atom_Sequence) {
- if (buf->append_event(_time - context.start(),
- _value.size(),
- _value.type(),
- (const uint8_t*)_value.get_body())) {
- _port->raise_set_by_user_flag();
- } else {
+ if (!buf->append_event(_time - context.start(),
+ _value.size(),
+ _value.type(),
+ (const uint8_t*)_value.get_body())) {
_status = Status::NO_SPACE;
}
} else if (buf->type() == uris.atom_URID) {
diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp
index aac5e033..03902acb 100644
--- a/src/server/events/SetPortValue.hpp
+++ b/src/server/events/SetPortValue.hpp
@@ -19,6 +19,7 @@
#include "ingen/Atom.hpp"
+#include "BufferRef.hpp"
#include "ControlBindings.hpp"
#include "Event.hpp"
#include "types.hpp"
@@ -58,6 +59,7 @@ private:
PortImpl* _port;
const Atom _value;
+ BufferRef _buffer;
ControlBindings::Key _binding;
bool _synthetic;
};