From 9429401f11ffa0ee1729dbdc5e14e87cf06e2dc1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 16 Jun 2012 03:10:26 +0000 Subject: [PATCH] MCP: patch from seablade to fix pot displays (both absolute value and negative values) git-svn-id: svn://localhost/ardour2/branches/3.0@12739 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/mackie/pot.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc index 838753bf31..8f0298ea72 100644 --- a/libs/surfaces/mackie/pot.cc +++ b/libs/surfaces/mackie/pot.cc @@ -47,11 +47,20 @@ Pot::set (float val, bool onoff, Mode mode) // Pot/LED mode msg |= (mode << 4); + + /* + * Even though a width value may be negative, there is + * technically still width there, it is just reversed, + * so make sure to show it on the LED ring appropriately. + */ + if (val < 0){ + val = val * -1; + } // val, but only if off hasn't explicitly been set if (onoff) { if (mode == spread) { - msg |= (lrintf (val * 6) + 1) & 0x0f; // 0b00001111 + msg |= (lrintf (val * 6)) & 0x0f; // 0b00001111 } else { msg |= (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111 }