Changeset 2918:a5612107d49c in roaraudio


Ignore:
Timestamp:
10/16/09 17:08:14 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

ported to VIO, seems to fix the bug of wrong calced values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarvumeter.c

    r2917 r2918  
    4949} 
    5050 
    51 int vumeter16bit2ch (int fh, int samples, int16_t * buf, int mode) { 
     51int vumeter16bit2ch (struct roar_vio_calls * vio, int samples, int16_t * buf, int mode) { 
    5252 int i; 
    5353 int samples_half = samples/2; 
     
    5858 fflush(stdout); 
    5959 
    60  while (read(fh, buf, samples * 2)) { 
     60 while (roar_vio_read(vio, buf, samples * 2) > 0) { 
    6161  suml = sumr = 0; 
    6262 
     
    8383} 
    8484 
    85 int vumeter (int fh, int samples, int bits, int channels, int mode) { 
     85int vumeter (struct roar_vio_calls * vio, int samples, int bits, int channels, int mode) { 
    8686 void * buf = malloc(samples*bits*2); 
    8787 
     
    9191 if ( bits == 16 ) { 
    9292  if ( channels == 2 ) { 
    93    vumeter16bit2ch(fh, samples, (int16_t *) buf, mode); 
     93   vumeter16bit2ch(vio, samples, (int16_t *) buf, mode); 
    9494   free(buf); 
    9595   return 0; 
     
    110110 char * server   = NULL; 
    111111 char * k; 
    112  int    fh; 
     112 struct roar_vio_calls stream, re; 
    113113 int    i; 
    114114 int    mode = MODE_PC; 
     
    139139 } 
    140140 
    141  if ( (fh = roar_simple_monitor(rate, channels, bits, codec, server, "roarvumeter")) == -1 ) { 
    142   fprintf(stderr, "Error: can not start playback\n"); 
     141 if ( roar_vio_simple_stream(&stream, rate, channels, bits, codec, server, ROAR_DIR_MONITOR, "roarvumeter") == -1) { 
     142  fprintf(stderr, "Error: can not start monetoring\n"); 
    143143  return 1; 
    144144 } 
    145145 
    146  vumeter(fh, samples*channels, bits, channels, mode); 
     146 if ( roar_vio_open_re(&re, &stream) == -1 ) { 
     147  roar_vio_close(&stream); 
     148  fprintf(stderr, "Error: can not open RE VIO layer\n"); 
     149  return 1; 
     150 } 
     151 
     152 vumeter(&re, samples*channels, bits, channels, mode); 
    147153 
    148154 printf("\n"); // if the reach this then roard has quited and we should print a newline 
    149155 
    150  roar_simple_close(fh); 
     156 roar_vio_close(&re); 
    151157 
    152158 return 0; 
Note: See TracChangeset for help on using the changeset viewer.