Mackie Control: Don't show hidden routes.
[ardour.git] / libs / surfaces / mackie / fader.cc
index cc43bf3387e3062cda1690215f1e220d8a7dca47..33e1e4c29faf34d8df107f56b57073c6c0d4da79 100644 (file)
 
 #include <cmath>
 
+#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);
 }