From 04b9df1fd9de2d631bc76b02766ed93308c408b5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 2 Oct 2015 19:24:04 -0400 Subject: avoid sending replicated fader set position messages --- libs/surfaces/mackie/fader.cc | 7 +++++++ libs/surfaces/mackie/fader.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/libs/surfaces/mackie/fader.cc b/libs/surfaces/mackie/fader.cc index 46e46cf797..5e40538096 100644 --- a/libs/surfaces/mackie/fader.cc +++ b/libs/surfaces/mackie/fader.cc @@ -60,6 +60,13 @@ Fader::update_message () } int posi = lrintf (16384.0 * position); + + if (posi == last_update_position) { + return MidiByteArray(); + } + + last_update_position = posi; + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("generate fader message for position %1 (%2)\n", position, posi)); return MidiByteArray (3, 0xe0 + id(), posi & 0x7f, posi >> 7); } diff --git a/libs/surfaces/mackie/fader.h b/libs/surfaces/mackie/fader.h index 8de8a5896c..e83e657e68 100644 --- a/libs/surfaces/mackie/fader.h +++ b/libs/surfaces/mackie/fader.h @@ -14,6 +14,7 @@ class Fader : public Control Fader (int id, std::string name, Group & group) : Control (id, name, group) , position (0.0) + , last_update_position (-1) { } @@ -26,6 +27,7 @@ class Fader : public Control private: float position; + int last_update_position; }; } -- cgit v1.2.3