From 4b96c04eadcdd37603d78a13eaa40b5b90dee07e Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Sun, 10 Aug 2014 08:25:59 +0100 Subject: [PATCH] simplify squeeze-mixer-compute-bar a bit compute a quotient rather than repeated comparisons with fractional part --- squeeze.el | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/squeeze.el b/squeeze.el index c6f10d9..6e4f4da 100644 --- a/squeeze.el +++ b/squeeze.el @@ -144,16 +144,9 @@ (nblank (floor (- width exact)))) (format "%s%s%s" (make-string nfull ?█) - (cond ((= width (+ nfull nblank)) "") - ((< frac 0.0625) " ") - ((< frac 0.1875) "▏") - ((< frac 0.3125) "▎") - ((< frac 0.4375) "▍") - ((< frac 0.5625) "▌") - ((< frac 0.6875) "▋") - ((< frac 0.8125) "▊") - ((< frac 0.9375) "▉") - (t "█")) + (if (= width (+ nfull nblank)) + "" + (aref " ▏▎▍▌▋▊▉█" (floor (+ frac 0.0625) 0.125))) (make-string nblank ? )))) (defun squeeze-mixer-make-bar (vol width) -- 2.39.5