Changeset 2918:a5612107d49c in roaraudio
- Timestamp:
- 10/16/09 17:08:14 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarvumeter.c
r2917 r2918 49 49 } 50 50 51 int vumeter16bit2ch ( int fh, int samples, int16_t * buf, int mode) {51 int vumeter16bit2ch (struct roar_vio_calls * vio, int samples, int16_t * buf, int mode) { 52 52 int i; 53 53 int samples_half = samples/2; … … 58 58 fflush(stdout); 59 59 60 while (r ead(fh, buf, samples * 2)) {60 while (roar_vio_read(vio, buf, samples * 2) > 0) { 61 61 suml = sumr = 0; 62 62 … … 83 83 } 84 84 85 int vumeter ( int fh, int samples, int bits, int channels, int mode) {85 int vumeter (struct roar_vio_calls * vio, int samples, int bits, int channels, int mode) { 86 86 void * buf = malloc(samples*bits*2); 87 87 … … 91 91 if ( bits == 16 ) { 92 92 if ( channels == 2 ) { 93 vumeter16bit2ch( fh, samples, (int16_t *) buf, mode);93 vumeter16bit2ch(vio, samples, (int16_t *) buf, mode); 94 94 free(buf); 95 95 return 0; … … 110 110 char * server = NULL; 111 111 char * k; 112 int fh;112 struct roar_vio_calls stream, re; 113 113 int i; 114 114 int mode = MODE_PC; … … 139 139 } 140 140 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"); 143 143 return 1; 144 144 } 145 145 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); 147 153 148 154 printf("\n"); // if the reach this then roard has quited and we should print a newline 149 155 150 roar_ simple_close(fh);156 roar_vio_close(&re); 151 157 152 158 return 0;
Note: See TracChangeset
for help on using the changeset viewer.