Changeset 5533:42f48072307c in roaraudio for roarclients/roarvumeter.c
- Timestamp:
- 06/12/12 14:39:40 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarvumeter.c
r5381 r5533 45 45 printf("\nOptions:\n\n"); 46 46 47 printf(" --server SERVER - Set server hostname\n" 48 " --rate RATE - Set sample rate\n" 49 " --bits BITS - Set bits per sample\n" 50 " --chans CHANNELS - Set number of channels\n" 51 " --samples SAMPLES - Set number of input samples per block\n" 52 " --pc - Use percent scale\n" 53 " --db - Use dB scale\n" 54 " --beat - Enable beat detection\n" 55 " --lowpass FREQ - Use lowpass to filter input (-%idB/dec)\n" 56 " --help - Show this help\n", 47 printf(" --server SERVER - Set server hostname\n" 48 " --rate -R RATE - Set sample rate\n" 49 " --bits -B BITS - Set bits per sample\n" 50 " --chans -C CHANS - Set number of channels\n" 51 " --aiprofile PROFILE - Set audio profile\n" 52 " --samples SAMPLES - Set number of input samples per block\n" 53 " --pc - Use percent scale\n" 54 " --db - Use dB scale\n" 55 " --beat - Enable beat detection\n" 56 " --lowpass FREQ - Use lowpass to filter input (-%idB/dec)\n" 57 " --help - Show this help\n", 57 58 LOWPASS_ORDER * 20 58 59 ); … … 163 164 struct roardsp_filter * filter; 164 165 float lowpass_freq = 0; 165 int rate = ROAR_RATE_DEFAULT; 166 int bits = 16; 167 int channels = 2; 168 int codec = ROAR_CODEC_DEFAULT; 166 struct roar_audio_info info; 169 167 int samples = -1; 170 168 char * server = NULL; … … 174 172 int mode = 0; 175 173 174 if ( roar_profile2info(&info, "default") == -1 ) 175 return 1; 176 176 177 for (i = 1; i < argc; i++) { 177 178 k = argv[i]; … … 179 180 if ( strcmp(k, "--server") == 0 ) { 180 181 server = argv[++i]; 181 } else if ( strcmp(k, "--rate") == 0 ) { 182 rate = roar_str2rate(argv[++i]); 183 } else if ( strcmp(k, "--bits") == 0 ) { 184 bits = roar_str2bits(argv[++i]); 185 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0) { 186 channels = roar_str2channels(argv[++i]); 182 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 183 info.rate = roar_str2rate(argv[++i]); 184 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 185 info.bits = roar_str2bits(argv[++i]); 186 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 187 info.channels = roar_str2channels(argv[++i]); 188 } else if ( !strcmp(k, "--aiprofile") ) { 189 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 190 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 191 return 1; 192 } 187 193 } else if ( strcmp(k, "--samples") == 0 ) { 188 194 samples = atoi(argv[++i]); … … 213 219 214 220 if ( samples == -1 ) 215 samples = rate/10;221 samples = info.rate/10; 216 222 217 223 if ( roar_simple_connect(&con, server, "roarvumeter") == -1 ) { … … 220 226 } 221 227 222 if ( roar_vio_simple_new_stream_obj(&stream, &con, &s, rate, channels, bits, codec, ROAR_DIR_MONITOR, -1) == -1) { 228 if ( roar_vio_simple_new_stream_obj(&stream, &con, &s, 229 info.rate, info.channels, info.bits, ROAR_CODEC_DEFAULT, 230 ROAR_DIR_MONITOR, -1) == -1) { 223 231 fprintf(stderr, "Error: can not start monetoring\n"); 224 232 return 1; … … 262 270 } 263 271 264 vumeter(&re, samples* channels, bits,channels, mode, &fchain);272 vumeter(&re, samples*info.channels, info.bits, info.channels, mode, &fchain); 265 273 266 274 printf("\n"); // if the reach this then roard has quited and we should print a newline
Note: See TracChangeset
for help on using the changeset viewer.