commit fc388c766a69ddf9d1ebadf773e1bbaaf5fe1bba
parent d18d04c2a45eb75c34f633f47d72254360bda216
Author: lostd <lostd@2f30.org>
Date: Wed, 8 Jun 2016 09:00:43 +0100
Take care of rounding to the step posistions
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ncmixer.c b/ncmixer.c
@@ -36,6 +36,8 @@
#define NSAMPLES 2048
#define KEY_DELAY_MS 660
#define KEY_REPEAT_MS 40
+#define STEP 0.0625f
+#define ROUND(xfpos) ((int)((xfpos) / STEP) * STEP)
#ifdef DEBUG
#define DEBUG_FD 8
@@ -212,11 +214,11 @@ key_cb(int fd)
break;
case 'J':
xfading = 0;
- xfpos = MAX(xfpos - 0.0625f, -1.0f);
+ xfpos = MAX(ROUND(xfpos) - STEP, -1.0f);
break;
case 'K':
xfading = 0;
- xfpos = MIN(xfpos + 0.0625f, 1.0f);
+ xfpos = MIN(ROUND(xfpos) + STEP, 1.0f);
break;
case 'H':
xfading = 1;