From 145a2781dc589920ea19736f7de80f999b331bb0 Mon Sep 17 00:00:00 2001 From: "alexander.pickering" Date: Wed, 17 Sep 2014 11:20:03 -0400 Subject: Fixed in issue that caused meter to display incorrectly --- vaud.c | 65 +++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/vaud.c b/vaud.c index 002a760..4b7304a 100644 --- a/vaud.c +++ b/vaud.c @@ -56,6 +56,7 @@ static float read_peak() return tmp; } + /* Callback called by JACK when audio is available. Stores value of peak sample */ static int process_peak(jack_nframes_t nframes, void *arg) @@ -199,40 +200,44 @@ void display_centerBars() /*Get width and height of console, make border*/ getmaxyx(stdscr,height,width); my_win = create_newwin(height,width,startx,starty); - + refresh(); /*Figure out how which nodes we can safely get*/ - int space = ((unsigned int) dframes) / width; - //mvprintw(10,10,"Space is %i",space); - //refresh(); - if(space > 0) + if(height % 2 == 1) { - for(i=1;i 0) { - float samp = fabs(data[space * i]); //get the waveform data - float dec; - //mvprintw(height/2,i,BAR); - int j; - for(j=0;j 0) @@ -255,7 +260,7 @@ void display_rmeter() float samp = fabs(data[space * i]); //get the waveform data float dec; int j; - for(j=height-2;j>((1-samp)*height);j--) + for(j=height-2;j>((1-samp)*height) && j>1;j--) { if(COLORFUL) attron(COLOR_PAIR(2)); @@ -287,7 +292,7 @@ void display_meter() /*Get width and height of console, make border*/ getmaxyx(stdscr,height,width); my_win = create_newwin(height,width,startx,starty); - + refresh(); /*Figure out how which nodes we can safely get*/ int space = ((unsigned int) dframes) / width; if(space > 0) @@ -297,7 +302,7 @@ void display_meter() float samp = fabs(data[space * i]); //get the waveform data float dec; int j; - for(j=1;j<((samp)*height);j++) + for(j=1;j<((samp)*(height)) && j