X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Ffader.cc;h=33e1e4c29faf34d8df107f56b57073c6c0d4da79;hb=548989fc75ba08912efe2bc48d24af5eb95c790d;hp=cc43bf3387e3062cda1690215f1e220d8a7dca47;hpb=4512d013eb7c658519abc8b5e82a1e7bf926cad6;p=ardour.git diff --git a/libs/surfaces/mackie/fader.cc b/libs/surfaces/mackie/fader.cc index cc43bf3387..33e1e4c29f 100644 --- a/libs/surfaces/mackie/fader.cc +++ b/libs/surfaces/mackie/fader.cc @@ -19,6 +19,10 @@ #include +#include "pbd/compose.h" + +#include "ardour/debug.h" + #include "fader.h" #include "surface.h" #include "control_group.h" @@ -26,6 +30,7 @@ using namespace ArdourSurface; using namespace Mackie; +using namespace PBD; Control* Fader::factory (Surface& surface, int id, const char* name, Group& group) @@ -54,6 +59,14 @@ Fader::update_message () return MidiByteArray(); } - int posi = lrintf (0x3fff * position); + 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); }