From ebdbed5d246eb0d47a29bbded234d341ae747696 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Tue, 23 Aug 2011 00:19:17 +0200 Subject: [PATCH] Support for delay, recti label options --- fb.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fb.pl b/fb.pl index 0e14935..7a5a4aa 100755 --- a/fb.pl +++ b/fb.pl @@ -8,6 +8,16 @@ use List::Util qw(min max sum); use Tk; +our ($label_recti, $delay); +if ($ARGV[0] eq '-r') { + shift @ARGV; + $label_recti = 1; +} +if ($ARGV[0] eq '-d') { + shift @ARGV; + $delay = shift @ARGV; +} + my $mode = shift @ARGV; my ($devname, $playfile); if (not $mode or $mode eq 'sound') { @@ -92,7 +102,7 @@ sub render_spectrum { if (!($x % ($w/4))) { $canvas->createLine($xofs + $x, $hb + 0, $xofs + $x, $hb + 5, -fill => 'blue'); - $canvas->createText($xofs + $x, $hb + 15, -fill => 'blue', -font => 'small', -text => $fi[$i]); + $canvas->createText($xofs + $x, $hb + 15, -fill => 'blue', -font => 'small', -text => $label_recti ? $i/$rect_step : $fi[$i]); } } } @@ -227,6 +237,11 @@ sub ticks { render($finfo); + if ($delay) { + use Time::HiRes qw(usleep); + usleep($delay); + } + $mw->idletasks(); $s++; -- 2.11.4.GIT