summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-10-02 19:24:04 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-10-02 22:08:14 -0400
commit04b9df1fd9de2d631bc76b02766ed93308c408b5 (patch)
tree8a56f704e11fb85d7e93aa3b111f63757e15ad57
parent3bc7f863ca3434aeda872a862229b8d14e6eef62 (diff)
avoid sending replicated fader set position messages
-rw-r--r--libs/surfaces/mackie/fader.cc7
-rw-r--r--libs/surfaces/mackie/fader.h2
2 files changed, 9 insertions, 0 deletions
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;
};
}