summaryrefslogtreecommitdiffstats
path: root/src/server/PortImpl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-02 02:16:23 +0000
committerDavid Robillard <d@drobilla.net>2013-02-02 02:16:23 +0000
commitd049b582e1db60ee0f6fd02a40202145488c7288 (patch)
tree4b30ba2522a14863ce76f672f537dcca0c14c34e /src/server/PortImpl.cpp
parent73a01c1bd8d6cf92522a433cd2b0bd491f2af99a (diff)
downloadingen-d049b582e1db60ee0f6fd02a40202145488c7288.tar.gz
ingen-d049b582e1db60ee0f6fd02a40202145488c7288.tar.bz2
ingen-d049b582e1db60ee0f6fd02a40202145488c7288.zip
Add option to enable/disable canvas animation (fix/avoid #879).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5016 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/PortImpl.cpp')
-rw-r--r--src/server/PortImpl.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index ed7a7084..352c8b23 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -51,12 +51,12 @@ PortImpl::PortImpl(BufferFactory& bufs,
, _value(value)
, _min(bufs.forge().make(0.0f))
, _max(bufs.forge().make(1.0f))
- , _last_broadcasted_value(value)
+ , _last_monitor_value(value)
, _set_states(new Raul::Array<SetState>(static_cast<size_t>(poly)))
, _prepared_set_states(NULL)
, _buffers(new Raul::Array<BufferRef>(static_cast<size_t>(poly)))
, _prepared_buffers(NULL)
- , _broadcast(false)
+ , _monitored(false)
, _set_by_user(false)
, _is_morph(false)
, _is_auto_morph(false)
@@ -338,8 +338,12 @@ PortImpl::clear_buffers()
}
void
-PortImpl::broadcast_value(Context& context, bool force)
+PortImpl::monitor(Context& context)
{
+ if (!context.must_notify(this)) {
+ return;
+ }
+
Forge& forge = context.engine().world()->forge();
URIs& uris = context.engine().world()->uris();
LV2_URID key = 0;
@@ -359,23 +363,34 @@ PortImpl::broadcast_value(Context& context, bool force)
case PortType::ATOM:
if (_buffer_type == _bufs.uris().atom_Sequence) {
LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)buffer(0)->atom();
- // TODO: Filter events, or only send one activity for blinkenlights
- LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
+ if (_monitored) {
+ // Monitoring explictly enabled, send everything
+ LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
+ context.notify(uris.ingen_activity,
+ context.start() + ev->time.frames,
+ this,
+ ev->body.size,
+ ev->body.type,
+ LV2_ATOM_BODY(&ev->body));
+ }
+ } else if (seq->atom.size > sizeof(LV2_Atom_Sequence_Body)) {
+ // Just sending for blinkenlights, send one
+ const int32_t one = 1;
context.notify(uris.ingen_activity,
- context.start() + ev->time.frames,
+ context.start(),
this,
- ev->body.size,
- ev->body.type,
- LV2_ATOM_BODY(&ev->body));
+ sizeof(int32_t),
+ (LV2_URID)uris.atom_Bool,
+ &one);
}
}
break;
}
- if (val.is_valid() && (force || val != _last_broadcasted_value)) {
+ if (val.is_valid() && val != _last_monitor_value) {
if (context.notify(key, context.start(), this,
val.size(), val.type(), val.get_body())) {
- _last_broadcasted_value = val;
+ _last_monitor_value = val;
}
/* On failure, last_broadcasted_value remains unaffected, so we'll try