diff options
| author | alexander.pickering <alexander.pickering@anondomain.site90.net> | 2014-09-16 18:41:35 -0400 |
|---|---|---|
| committer | alexander.pickering <alexander.pickering@anondomain.site90.net> | 2014-09-16 18:41:35 -0400 |
| commit | ca10e74a4b3ecb3c55c84f169ef558da5e9c0f09 (patch) | |
| tree | cd40d70a64cc09e2e210ef5d3aa4650025bb9cde | |
| parent | 8c3e9ec157e3b63f3fda7f8ba1b7a4264b88765b (diff) | |
| download | vaud-ca10e74a4b3ecb3c55c84f169ef558da5e9c0f09.tar.gz vaud-ca10e74a4b3ecb3c55c84f169ef558da5e9c0f09.tar.bz2 vaud-ca10e74a4b3ecb3c55c84f169ef558da5e9c0f09.zip | |
A small fix for the first meter
| -rw-r--r-- | vaud.c | 64 |
1 files changed, 27 insertions, 37 deletions
@@ -281,52 +281,42 @@ void display_rmeter() */ void display_meter() { - /*Some variables to keep track of stuff*/ - int i; - int width,height; - int startx,starty = 0; - int space = 1; + int width,height,startx,starty,i=0; WINDOW *my_win; /*Get width and height of console, make border*/ getmaxyx(stdscr,height,width); my_win = create_newwin(height,width,startx,starty); - - /*Figure out how far inbetween the samples that are "safe" to get are*/ - int samples = ((unsigned int) dframes) / width; - - /*For every sample we can safely get*/ - for(i=0;i<dframes;i+=samples) + + /*Figure out how which nodes we can safely get*/ + int space = ((unsigned int) dframes) / width; + if(space > 0) { - /*Get the value*/ - float samp = fabs(data[i]); - float dec; //The percentage up the graph - if(COLORFUL) - attron(COLOR_PAIR(2)); - /*Draw whitespace from the ground up*/ - for(dec = height+2;dec > samp;dec-=(1.0/height)) - { - if(dec*height<height-1 && dec*height>=1) - mvprintw(dec*height,space,BLANK); - } - if(COLORFUL) - attroff(COLOR_PAIR(2)); - attron(COLOR_PAIR(3)); - /*And draw bars the rest of the way*/ - for(;dec>0;dec-=(1.0/height)) - { - if(dec*height >= 1) - mvprintw(dec*height,space,BAR); - } - if(COLORFUL) - attroff(COLOR_PAIR(3)); - /*Makes sure we don't draw over the frame*/ - if(space < width-2) + for(i=1;i<width-1;i+=1) { - space++; + float samp = fabs(data[space * i]); //get the waveform data + float dec; + int j; + for(j=1;j<((samp)*height);j++) + { + if(COLORFUL) + attron(COLOR_PAIR(2)); + mvprintw(j,i,BAR); + if(COLORFUL) + attroff(COLOR_PAIR(2)); + + } + for(j=((samp)*height)+1;j<height-1;j++) + { + if(COLORFUL) + attron(COLOR_PAIR(3)); + mvprintw(j,i,BLANK); + if(COLORFUL) + attroff(COLOR_PAIR(3)); + } } } - refresh(); //And refresh the screen + refresh(); } |
