diff options
-rw-r--r-- | src/server/PortImpl.cpp | 5 | ||||
-rw-r--r-- | src/server/PortImpl.hpp | 3 | ||||
-rw-r--r-- | src/server/internals/Controller.cpp | 2 | ||||
-rw-r--r-- | src/server/internals/Trigger.cpp | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 01280e73..950c8739 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -380,7 +380,7 @@ PortImpl::clear_buffers() } void -PortImpl::monitor(Context& context) +PortImpl::monitor(Context& context, bool send_now) { if (!context.must_notify(this)) { return; @@ -430,7 +430,8 @@ PortImpl::monitor(Context& context) } const uint32_t period = monitor_period(context.engine()); - if (key && val != _last_monitor_value && _frames_since_monitor >= period) { + if (key && val != _last_monitor_value && + (send_now || _frames_since_monitor >= period)) { // Time to send an update if (context.notify(key, context.start(), this, sizeof(float), forge.Float, &val)) { diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index 2789c4f0..267f9285 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -159,7 +159,8 @@ public: /** Explicitly turn on monitoring for this port. */ void enable_monitoring(bool monitored) { _monitored = monitored; } - void monitor(Context& context); + /** Monitor port value and broadcast to clients periodically. */ + void monitor(Context& context, bool send_now=false); void raise_set_by_user_flag() { _set_by_user = true; } diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index cad0aac4..5c3bf6f6 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -118,7 +118,7 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va // FIXME: not thread safe _param_port->set_value(context.engine().world()->forge().make(control_num)); _param_port->set_control_value(context, time, control_num); - _param_port->monitor(context); + _param_port->monitor(context, true); _learning = false; } diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index c1c00b6b..6563e276 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -133,7 +133,7 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity // FIXME: not thread safe _note_port->set_value(context.engine().world()->forge().make((float)note_num)); _note_port->set_control_value(context, time, (float)note_num); - _note_port->monitor(context); + _note_port->monitor(context, true); _learning = false; } |