Changeset 5533:42f48072307c in roaraudio
- Timestamp:
- 06/12/12 14:39:40 (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r5529 r5533 2 2 * Try use-execed workaround also on UNIX Domain Sockets (Closes: #207) 3 3 * Implemented SHA1 support (Closes: #232) 4 * Fixed usage of -R/-B/-C/-E as well as --aiprofile in roarclients 5 (Closes: #176) 4 6 5 7 v. 1.0beta2 - Wed Jun 06 2012 19:56 CEST -
roarclients/roarbidir.c
r5381 r5533 33 33 printf("\nOptions:\n\n"); 34 34 35 printf(" --server SERVER - Set server hostname\n" 36 " --rate RATE - Set sample rate\n" 37 " --bits BITS - Set bits per sample\n" 38 " --chans CHANNELS - Set number of channels\n" 39 " --codec CODEC - Set the codec\n" 40 " --help - Show this help\n" 35 printf(" --server SERVER - Set server hostname\n" 36 " --rate -R RATE - Set sample rate\n" 37 " --bits -B BITS - Set bits per sample\n" 38 " --chans -C CHANNELS - Set number of channels\n" 39 " --codec -E CODEC - Set the codec\n" 40 " --aiprofile PROFILE - Set audio profile\n" 41 " --help - Show this help\n" 41 42 ); 42 43 … … 44 45 45 46 int main (int argc, char * argv[]) { 46 int rate = ROAR_RATE_DEFAULT; 47 int bits = ROAR_BITS_DEFAULT; 48 int channels = ROAR_CHANNELS_DEFAULT; 49 int codec = ROAR_CODEC_DEFAULT; 47 struct roar_audio_info info; 50 48 char * server = NULL; 51 49 char * k; … … 61 59 ssize_t ret; 62 60 61 if ( roar_profile2info(&info, "default") == -1 ) 62 return 1; 63 63 64 if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 ) 64 65 return 1; … … 69 70 if ( strcmp(k, "--server") == 0 ) { 70 71 server = argv[++i]; 71 } else if ( strcmp(k, "--rate") == 0 ) { 72 rate = roar_str2rate(argv[++i]); 73 } else if ( strcmp(k, "--bits") == 0 ) { 74 bits = roar_str2bits(argv[++i]); 75 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 76 channels = roar_str2channels(argv[++i]); 77 } else if ( strcmp(k, "--codec") == 0 ) { 78 codec = roar_str2codec(argv[++i]); 72 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 73 info.rate = roar_str2rate(argv[++i]); 74 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 75 info.bits = roar_str2bits(argv[++i]); 76 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 77 info.channels = roar_str2channels(argv[++i]); 78 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 79 info.codec = roar_str2codec(argv[++i]); 80 } else if ( !strcmp(k, "--aiprofile") ) { 81 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 82 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 83 return 1; 84 } 79 85 } else if ( strcmp(k, "--help") == 0 ) { 80 86 usage(); … … 93 99 } 94 100 95 if ( (vss = roar_vs_new_simple(server, "roarbidir", rate, channels, codec, bits, ROAR_DIR_BIDIR, &err)) == NULL ) { 101 if ( (vss = roar_vs_new_simple(server, "roarbidir", 102 info.rate, info.channels, info.codec, info.bits, 103 ROAR_DIR_BIDIR, &err)) == NULL ) { 96 104 fprintf(stderr, "Error: can not start playback: %s\n", roar_error2str(err)); 97 105 if ( in != NULL ) -
roarclients/roarcat.c
r5457 r5533 37 37 " --bits -B BITS - Set bits per sample\n" 38 38 " --chans -C CHANNELS - Set number of channels\n" 39 " --codec CODEC - Set the codec\n" 39 " --codec -E CODEC - Set the codec\n" 40 " --aiprofile PROFILE - Set audio profile\n" 40 41 " --wave - Use Wave Audio (PCM) as input\n" 41 42 " --midi - Use MIDI Audio as input\n" … … 70 71 int file_opened = 0; 71 72 73 // TODO: make use of roar_stdin. 72 74 if ( roar_vio_open_fh(&file, ROAR_STDIN) == -1 ) 73 75 return 1; … … 98 100 return 1; 99 101 } 102 } else if ( !strcmp(k, "--aiprofile") ) { 103 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 104 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 105 return 1; 106 } 100 107 101 108 } else if ( !strcmp(k, "--wave") ) { -
roarclients/roarcatvio.c
r5381 r5533 33 33 printf("\nOptions:\n\n"); 34 34 35 printf(" --server SERVER - Set server hostname\n" 36 " --rate RATE - Set sample rate\n" 37 " --bits BITS - Set bits per sample\n" 38 " --chans CHANNELS - Set number of channels\n" 39 " --codec CODEC - Set the codec\n" 40 " --help - Show this help\n" 35 printf(" --server -s SERVER - Set server hostname\n" 36 " --rate -R RATE - Set sample rate\n" 37 " --bits -B BITS - Set bits per sample\n" 38 " --chans -C CHANNELS - Set number of channels\n" 39 " --codec -E CODEC - Set the codec\n" 40 " --aiprofile PROFILE - Set audio profile\n" 41 " --help - Show this help\n" 41 42 ); 42 43 … … 44 45 45 46 int main (int argc, char * argv[]) { 46 struct roar_audio_info info = {.rate = ROAR_RATE_DEFAULT, .bits = ROAR_BITS_DEFAULT, .channels = ROAR_CHANNELS_DEFAULT}; 47 int codec = -1; 47 struct roar_audio_info info = {.rate = ROAR_RATE_DEFAULT, 48 .bits = ROAR_BITS_DEFAULT, 49 .channels = ROAR_CHANNELS_DEFAULT, 50 .codec = ROAR_AUDIO_INFO_INVALID}; 48 51 int auinfo_changed = 0; 49 52 char * server = NULL; … … 62 65 } else if ( !strcmp(k, "-n") ) { 63 66 name = argv[++i]; 64 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") ) {67 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) { 65 68 info.rate = roar_str2rate(argv[++i]); 66 69 auinfo_changed = 1; 67 } else if ( !strcmp(k, "--bits") ) {70 } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) { 68 71 info.bits = roar_str2bits(argv[++i]); 69 72 auinfo_changed = 1; … … 71 74 info.bits = 8; 72 75 auinfo_changed = 1; 73 } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") ) {76 } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) { 74 77 info.channels = roar_str2channels(argv[++i]); 75 78 auinfo_changed = 1; … … 77 80 info.channels = 1; 78 81 auinfo_changed = 1; 79 } else if ( !strcmp(k, "--codec") ) { 80 codec = roar_str2codec(argv[++i]); 82 } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) { 83 info.codec = roar_str2codec(argv[++i]); 84 auinfo_changed = 1; 85 } else if ( !strcmp(k, "--aiprofile") ) { 86 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 87 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 88 return 1; 89 } 81 90 auinfo_changed = 1; 82 91 } else if ( !strcmp(k, "--help") ) { … … 92 101 } 93 102 94 if ( codec == -1 ) 95 codec = ROAR_CODEC_DEFAULT; 96 97 info.codec = codec; 103 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) 104 info.codec = ROAR_CODEC_DEFAULT; 98 105 99 106 if ( (vss = roar_vs_new(server, name, &err)) == NULL ) { -
roarclients/roardtmf.c
r5381 r5533 68 68 69 69 printf(" --server SERVER - Set server hostname\n" 70 " --rate RATE - Set sample rate\n" 71 // " --bits BITS - Set bits per sample\n" 72 // " --codec CODEC - Set the codec\n" 70 " --rate -R RATE - Set sample rate\n" 73 71 " --help - Show this help\n" 74 72 ); … … 141 139 if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) { 142 140 server = argv[++i]; 143 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") ) {141 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) { 144 142 rate = roar_str2rate(argv[++i]); 145 143 } else if ( !strcmp(k, "--help") ) { -
roarclients/roarfilt.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 " --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 CHANNELS - Set number of channels\n" 51 " --aiprofile PROFILE - Set audio profile\n" 52 " --help - Show this help\n" 52 53 "\n" 53 " --half - half the volume\n"54 " --double - double the volume\n"55 " --amp VAL - Set amplification\n"56 " --mul VAL - Set mul\n"57 " --div VAL - Set div\n"58 #ifdef ROAR_HAVE_LIBM 59 " --lowpass freq - lowpass filter (obsolete)\n"60 #endif 61 " --filter name - add filter name\n"62 " --ffreq freq - set filter freq\n"63 " --fmul mult - set filter multiplier\n"64 " --fdiv div - set filter divider\n"65 " --fn N - set filter N parameter\n"66 " --flimit limit - set filter limit parameter\n"67 " --fmode mode - set filter mode parameter\n"68 " --fq Q - set filter quality\n"54 " --half - half the volume\n" 55 " --double - double the volume\n" 56 " --amp VAL - Set amplification\n" 57 " --mul VAL - Set mul\n" 58 " --div VAL - Set div\n" 59 #ifdef ROAR_HAVE_LIBM 60 " --lowpass freq - lowpass filter (obsolete)\n" 61 #endif 62 " --filter name - add filter name\n" 63 " --ffreq freq - set filter freq\n" 64 " --fmul mult - set filter multiplier\n" 65 " --fdiv div - set filter divider\n" 66 " --fn N - set filter N parameter\n" 67 " --flimit limit - set filter limit parameter\n" 68 " --fmode mode - set filter mode parameter\n" 69 " --fq Q - set filter quality\n" 69 70 ); 70 71 … … 176 177 } else if ( strcmp(k, "-m") == 0 ) { 177 178 info.channels = 1; 179 } else if ( !strcmp(k, "--aiprofile") ) { 180 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 181 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 182 return 1; 183 } 184 info.codec = ROAR_CODEC_DEFAULT; 178 185 } else if ( strcmp(k, "--half") == 0 || strcmp(k, "-half") == 0 ) { 179 186 div *= 2; -
roarclients/roarinterconnect.c
r5381 r5533 76 76 printf("\nOptions:\n\n"); 77 77 78 printf(" --server SERVER - Set server hostname\n" 79 " --remote SERVER - Set remote server\n" 80 " --type TYPE - Set type of remote server\n" 81 " --rate RATE - Set sample rate\n" 82 " --bits BITS - Set bits per sample\n" 83 " --chans CHANNELS - Set number of channels\n" 84 " --codec CODEC - Set the codec\n" 85 " --help - Show this help\n" 86 " --verbose -v - Be verbose\n" 78 printf(" --server SERVER - Set server hostname\n" 79 " --remote SERVER - Set remote server\n" 80 " --type TYPE - Set type of remote server\n" 81 " --rate -R RATE - Set sample rate\n" 82 " --bits -B BITS - Set bits per sample\n" 83 " --chans -C CHANNELS - Set number of channels\n" 84 " --codec -E CODEC - Set the codec\n" 85 " --aiprofile PROFILE - Set audio profile\n" 86 " --help - Show this help\n" 87 " --verbose -v - Be verbose\n" 87 88 ); 88 89 89 90 printf("\nPossible Types:\n\n"); 90 printf(" roar - RoarAudio Server\n"91 printf(" roar - RoarAudio Server\n" 91 92 #ifdef ROAR_HAVE_ESD 92 " esd - EsounD Server\n"93 #endif 94 " simple - PulseAudio using simple protocol\n"93 " esd - EsounD Server\n" 94 #endif 95 " simple - PulseAudio using simple protocol\n" 95 96 #ifdef _HAVE_OSS 96 " oss - Open Sound System (OSS) device\n"97 " oss - Open Sound System (OSS) device\n" 97 98 #endif 98 99 #ifdef _HAVE_RSOUND 99 " rsound - RSound server\n"100 " rsound - RSound server\n" 100 101 #endif 101 102 "\n" 102 " bidir - Connect bidirectional\n"103 " filter - Use local server as filter for remote server\n"104 " transmit - Transmit data from local server to remote server\n"105 " receive - Receive data from remote server\n"106 " recplay - Record from and play data to remote server\n"107 " record - Record data from remote server\n"103 " bidir - Connect bidirectional\n" 104 " filter - Use local server as filter for remote server\n" 105 " transmit - Transmit data from local server to remote server\n" 106 " receive - Receive data from remote server\n" 107 " recplay - Record from and play data to remote server\n" 108 " record - Record data from remote server\n" 108 109 ); 109 110 … … 257 258 struct roar_stream stream[1]; 258 259 struct roar_vio_calls vio; 259 #ifdef _HAVE_OSS260 260 struct roar_audio_info info; 261 #endif262 261 #ifdef _HAVE_RSOUND 263 262 rsound_t *rd; 264 263 enum rsd_format fmt = 0; 265 264 #endif 266 int rate = 44100;267 int bits = 16;268 int channels = 2;269 int codec = ROAR_CODEC_DEFAULT;270 265 int type = parse_type(NULL); 271 266 int tmp; … … 278 273 int rport; 279 274 275 if ( roar_profile2info(&info, "default") == -1 ) 276 return 1; 277 280 278 for (i = 1; i < argc; i++) { 281 279 k = argv[i]; … … 287 285 } else if ( strcmp(k, "--type") == 0 ) { 288 286 type = parse_type(argv[++i]); 289 } else if ( strcmp(k, "--rate") == 0 ) { 290 rate = roar_str2rate(argv[++i]); 291 } else if ( strcmp(k, "--bits") == 0 ) { 292 bits = roar_str2bits(argv[++i]); 293 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 294 channels = roar_str2channels(argv[++i]); 295 } else if ( strcmp(k, "--codec") == 0 ) { 296 codec = roar_str2codec(argv[++i]); 287 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 288 info.rate = roar_str2rate(argv[++i]); 289 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 290 info.bits = roar_str2bits(argv[++i]); 291 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 292 info.channels = roar_str2channels(argv[++i]); 293 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 294 info.codec = roar_str2codec(argv[++i]); 295 } else if ( !strcmp(k, "--aiprofile") ) { 296 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 297 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 298 return 1; 299 } 297 300 } else if ( strcmp(k, "--verbose") == 0 || strcmp(k, "-v") == 0 ) { 298 301 g_verbose++; … … 339 342 return 2; 340 343 } 341 if ( roar_vio_simple_stream(&vio, rate, channels, bits, codec, remote, tmp, CLIENT_NAME, -1) == -1 ) { 344 if ( roar_vio_simple_stream(&vio, 345 info.rate, info.channels, info.bits, info.codec, 346 remote, tmp, CLIENT_NAME, -1) == -1 ) { 342 347 fprintf(stderr, "Error: can not open RoarAudio stream to %s: %s\n", remote, roar_error2str(roar_error)); 343 348 return 2; … … 374 379 return 2; 375 380 } 376 info.rate = rate;377 info.channels = channels;378 info.bits = bits;379 info.codec = codec;380 381 if ( roar_cdriver_oss(&vio, "OSS", remote, &info, tmp) == -1 ) { 381 382 fprintf(stderr, "Error: can not open OSS device %s: %s\n", remote, roar_error2str(roar_error)); … … 393 394 tmp = ESD_STREAM|ESD_PLAY; 394 395 395 switch ( bits) {396 switch (info.bits) { 396 397 case 8: tmp |= ESD_BITS8; break; 397 398 case 16: tmp |= ESD_BITS16; break; … … 401 402 } 402 403 403 switch ( channels) {404 switch (info.channels) { 404 405 case 1: tmp |= ESD_MONO; break; 405 406 case 2: tmp |= ESD_STEREO; break; … … 410 411 411 412 // TODO: FIXME: this is only true if the esd runs on a LE system,... 412 if ( bits == 8 &&codec != ROAR_CODEC_PCM_U_LE ) {413 if ( info.bits == 8 && info.codec != ROAR_CODEC_PCM_U_LE ) { 413 414 fprintf(stderr, "Error: EsounD only supports unsigned PCM in 8 bit mode\n"); 414 415 return 2; 415 } else if ( bits == 16 &&codec != ROAR_CODEC_DEFAULT ) {416 } else if ( info.bits == 16 && info.codec != ROAR_CODEC_DEFAULT ) { 416 417 fprintf(stderr, "Error: EsounD only supports signed PCM in 16 bit mode\n"); 417 418 return 2; … … 420 421 switch (type & ST_MASK) { 421 422 case ST_FILTER: 422 rfh = esd_filter_stream(tmp, rate, remote, CLIENT_NAME);423 rfh = esd_filter_stream(tmp, info.rate, remote, CLIENT_NAME); 423 424 break; 424 425 case ST_TRANSMIT: 425 rfh = esd_play_stream(tmp, rate, remote, CLIENT_NAME);426 rfh = esd_play_stream(tmp, info.rate, remote, CLIENT_NAME); 426 427 localdir = ROAR_DIR_MONITOR; 427 428 break; 428 429 case ST_RECEIVE: 429 rfh = esd_monitor_stream(tmp, rate, remote, CLIENT_NAME);430 rfh = esd_monitor_stream(tmp, info.rate, remote, CLIENT_NAME); 430 431 localdir = ROAR_DIR_PLAY; 431 432 break; … … 439 440 #ifdef _HAVE_RSOUND 440 441 case MT_RSOUND: 441 fmt = para2rsdfmt( bits,codec);442 fmt = para2rsdfmt(info.bits, info.codec); 442 443 443 444 if ( fmt == 0 ) { … … 452 453 rsd_init(&rd); 453 454 rsd_set_param(rd, RSD_HOST, remote); 454 rsd_set_param(rd, RSD_CHANNELS, &channels); 455 rsd_set_param(rd, RSD_SAMPLERATE, &rate); 455 tmp = info.channels; 456 rsd_set_param(rd, RSD_CHANNELS, &tmp); 457 tmp = info.rate; 458 rsd_set_param(rd, RSD_SAMPLERATE, &tmp); 456 459 rsd_set_param(rd, RSD_FORMAT, &fmt); 457 460 #ifdef RSD_IDENTITY … … 526 529 } 527 530 528 if ( roar_stream_new(stream, rate, channels, bits,codec) == -1 ) {531 if ( roar_stream_new(stream, info.rate, info.channels, info.bits, info.codec) == -1 ) { 529 532 roar_disconnect(con); 530 533 return 21; -
roarclients/roarmon.c
r5381 r5533 37 37 " --bits -B BITS - Set bits per sample\n" 38 38 " --chans -C CHANNELS - Set number of channels\n" 39 " --codec CODEC - Set the codec\n" 39 " --codec -E CODEC - Set the codec\n" 40 " --aiprofile PROFILE - Set audio profile\n" 40 41 " --record - Run in record mode (Wave Audio only)\n" 41 42 " --wave - Output Wave Audio (PCM)\n" … … 54 55 55 56 int main (int argc, char * argv[]) { 56 int rate = -1; 57 int bits = -1; 58 int channels = -1; 59 int codec = -1; 57 struct roar_audio_info info = { 58 .rate = ROAR_AUDIO_INFO_INVALID, 59 .bits = ROAR_AUDIO_INFO_INVALID, 60 .channels = ROAR_AUDIO_INFO_INVALID, 61 .codec = ROAR_AUDIO_INFO_INVALID}; 60 62 int dir = ROAR_DIR_MONITOR; 61 63 int rel_id = -1; … … 84 86 server = argv[++i]; 85 87 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) { 86 rate = roar_str2rate(argv[++i]);88 info.rate = roar_str2rate(argv[++i]); 87 89 } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) { 88 bits = roar_str2bits(argv[++i]);90 info.bits = roar_str2bits(argv[++i]); 89 91 } else if ( !strcmp(k, "-b") ) { 90 bits = 8;92 info.bits = 8; 91 93 } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) { 92 channels = roar_str2channels(argv[++i]);94 info.channels = roar_str2channels(argv[++i]); 93 95 } else if ( !strcmp(k, "-m") ) { 94 channels = 1;95 } else if ( !strcmp(k, "--codec") ) {96 if ( ( codec = roar_str2codec(argv[++i])) == -1) {96 info.channels = 1; 97 } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) { 98 if ( (info.codec = roar_str2codec(argv[++i])) == ROAR_AUDIO_INFO_INVALID ) { 97 99 fprintf(stderr, "Error: Unknown codec: %s\n", argv[i]); 100 return 1; 101 } 102 103 } else if ( !strcmp(k, "--aiprofile") ) { 104 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 105 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 98 106 return 1; 99 107 } … … 140 148 case ROAR_DIR_MONITOR: 141 149 case ROAR_DIR_RECORD: 142 if ( rate == -1 )rate = ROAR_RATE_DEFAULT;143 if ( bits == -1 )bits = ROAR_BITS_DEFAULT;144 if ( channels == -1 )channels = ROAR_CHANNELS_DEFAULT;145 if ( codec == -1 )codec = ROAR_CODEC_DEFAULT;150 if ( info.rate == ROAR_AUDIO_INFO_INVALID ) info.rate = ROAR_RATE_DEFAULT; 151 if ( info.bits == ROAR_AUDIO_INFO_INVALID ) info.bits = ROAR_BITS_DEFAULT; 152 if ( info.channels == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_CHANNELS_DEFAULT; 153 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) info.codec = ROAR_CODEC_DEFAULT; 146 154 break; 147 155 case ROAR_DIR_MIDI_OUT: 148 if ( rate == -1 )rate = 0;149 if ( bits == -1 )bits = ROAR_MIDI_BITS;150 if ( channels == -1 )channels = ROAR_MIDI_CHANNELS_DEFAULT;151 if ( codec == -1 )codec = ROAR_CODEC_MIDI;156 if ( info.rate == ROAR_AUDIO_INFO_INVALID ) info.rate = 0; 157 if ( info.bits == ROAR_AUDIO_INFO_INVALID ) info.bits = ROAR_MIDI_BITS; 158 if ( info.channels == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_MIDI_CHANNELS_DEFAULT; 159 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) info.codec = ROAR_CODEC_MIDI; 152 160 break; 153 161 case ROAR_DIR_LIGHT_OUT: 154 if ( rate == -1 )rate = 0;155 if ( bits == -1 )bits = ROAR_LIGHT_BITS;156 if ( channels == -1 )channels = 0;157 if ( codec == -1 )codec = ROAR_CODEC_DMX512;162 if ( info.rate == ROAR_AUDIO_INFO_INVALID ) info.rate = 0; 163 if ( info.bits == ROAR_AUDIO_INFO_INVALID ) info.bits = ROAR_LIGHT_BITS; 164 if ( info.channels == ROAR_AUDIO_INFO_INVALID ) info.channels = 0; 165 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) info.codec = ROAR_CODEC_DMX512; 158 166 break; 159 167 case ROAR_DIR_COMPLEX_OUT: 160 if ( rate == -1 )rate = ROAR_COMPLEX_RATE;161 if ( bits == -1 )bits = ROAR_COMPLEX_BITS;162 if ( channels == -1 )channels = ROAR_COMPLEX_CHANNELS;163 if ( codec == -1 )codec = ROAR_COMPLEX_CODEC;168 if ( info.rate == ROAR_AUDIO_INFO_INVALID ) info.rate = ROAR_COMPLEX_RATE; 169 if ( info.bits == ROAR_AUDIO_INFO_INVALID ) info.bits = ROAR_COMPLEX_BITS; 170 if ( info.channels == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_COMPLEX_CHANNELS; 171 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) info.codec = ROAR_COMPLEX_CODEC; 164 172 break; 165 173 case ROAR_DIR_RDTCS_OUT: 166 if ( rate == -1 )rate = ROAR_RDTCS_RATE;167 if ( bits == -1 )bits = ROAR_RDTCS_BITS;168 if ( channels == -1 )channels = ROAR_RDTCS_CHANNELS;169 if ( codec == -1 )codec = ROAR_RDTCS_CODEC;174 if ( info.rate == ROAR_AUDIO_INFO_INVALID ) info.rate = ROAR_RDTCS_RATE; 175 if ( info.bits == ROAR_AUDIO_INFO_INVALID ) info.bits = ROAR_RDTCS_BITS; 176 if ( info.channels == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_RDTCS_CHANNELS; 177 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) info.codec = ROAR_RDTCS_CODEC; 170 178 break; 171 179 case ROAR_DIR_RAW_OUT: 172 180 case ROAR_DIR_THRU: 173 181 default: 174 if ( rate == -1 )rate = 0;175 if ( bits == -1 )bits = 0;176 if ( channels == -1 )channels = 0;177 if ( codec == -1 )codec = ROAR_CODEC_DEFAULT;182 if ( info.rate == ROAR_AUDIO_INFO_INVALID ) info.rate = 0; 183 if ( info.bits == ROAR_AUDIO_INFO_INVALID ) info.bits = 0; 184 if ( info.channels == ROAR_AUDIO_INFO_INVALID ) info.channels = 0; 185 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) info.codec = ROAR_CODEC_DEFAULT; 178 186 break; 179 187 } … … 184 192 } 185 193 186 if ( roar_stream_new(&s, rate, channels, bits,codec) == -1 ) {194 if ( roar_stream_new(&s, info.rate, info.channels, info.bits, info.codec) == -1 ) { 187 195 fprintf(stderr, "Error: can not create stream\n"); 188 196 roar_disconnect(&con); -
roarclients/roarmonhttp.c
r5381 r5533 47 47 " --bits -B BITS - Set bits per sample\n" 48 48 " --chans -C CHANNELS - Set number of channels\n" 49 " --codec CODEC - Set the codec\n" 49 " --codec -E CODEC - Set the codec\n" 50 " --aiprofile PROFILE - Set audio profile\n" 50 51 " --rel-id ID - Set ID of relative stream\n" 51 52 " --inetd - Start in inetd mode (STDIN and STDOUT connected to socket)\n" … … 231 232 232 233 int main (int argc, char * argv[]) { 233 int rate = 44100; 234 int bits = 16; 235 int channels = 2; 236 int codec = ROAR_CODEC_OGG_VORBIS; 234 struct roar_audio_info info; 237 235 int rel_id = -1; 238 236 int sflags = ROAR_FLAG_NONE; … … 252 250 #endif 253 251 252 if ( roar_profile2info(&info, "default") == -1 ) 253 return 1; 254 255 info.codec = ROAR_CODEC_OGG_VORBIS; 256 254 257 for (i = 1; i < argc; i++) { 255 258 k = argv[i]; … … 263 266 } else if ( !strcmp(k, "--server") ) { 264 267 roar_libroar_set_server(argv[++i]); 265 } else if ( !strcmp(k, "--codec") ) {266 codec = roar_str2codec(argv[++i]);268 } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) { 269 info.codec = roar_str2codec(argv[++i]); 267 270 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) { 268 rate = roar_str2rate(argv[++i]);271 info.rate = roar_str2rate(argv[++i]); 269 272 } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) { 270 bits = roar_str2bits(argv[++i]);273 info.bits = roar_str2bits(argv[++i]); 271 274 } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) { 272 channels = roar_str2channels(argv[++i]); 275 info.channels = roar_str2channels(argv[++i]); 276 } else if ( !strcmp(k, "--aiprofile") ) { 277 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 278 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 279 return 1; 280 } 273 281 } else if ( !strcmp(k, "--rel-id") ) { 274 282 rel_id = atoi(argv[++i]); … … 294 302 295 303 if ( !strcmp(k, "codec") ) { 296 if ( ( codec = roar_str2codec(v)) == -1)304 if ( (info.codec = roar_str2codec(v)) == ROAR_AUDIO_INFO_INVALID ) 297 305 return 1; 298 306 } else if ( !strcmp(k, "channels") ) { 299 channels = roar_str2channels(v);307 info.channels = roar_str2channels(v); 300 308 } else if ( !strcmp(k, "rate") ) { 301 rate = roar_str2rate(v);309 info.rate = roar_str2rate(v); 302 310 } else if ( !strcmp(k, "bits") ) { 303 bits = roar_str2bits(v); 311 info.bits = roar_str2bits(v); 312 } else if ( !strcmp(k, "aiprofile") ) { 313 if ( roar_profile2info(&info, v) == -1 ) 314 return 1; 304 315 } else if ( !strcmp(k, "rel-id") || !strcmp(k, "relid") ) { 305 316 rel_id = atoi(v); … … 328 339 } 329 340 330 if ( roar_stream_new(&s, rate, channels, bits,codec) == -1 ) {341 if ( roar_stream_new(&s, info.rate, info.channels, info.bits, info.codec) == -1 ) { 331 342 roar_disconnect(&con); 332 343 return 20; … … 361 372 362 373 if ( !gopher ) 363 print_header( codec, rate,channels);374 print_header(info.codec, info.rate, info.channels); 364 375 365 376 /* -
roarclients/roarphone.c
r5381 r5533 114 114 115 115 printf("\nAudio Options:\n\n"); 116 printf(" --rate RATE - Set sample rate\n" 117 " --bits BITS - Set bits per sample\n" 118 " --chans CHANNELS - Set number of channels\n" 116 printf(" --rate -R RATE - Set sample rate\n" 117 " --bits -B BITS - Set bits per sample\n" 118 " --chans -C CHANNELS - Set number of channels\n" 119 " --aiprofile PROFILE - Set audio profile\n" 119 120 ); 120 121 … … 129 130 130 131 printf("\nCodec Options:\n\n"); 131 printf(" --codec 132 printf(" --codec -E CODEC - Set the codec\n" 132 133 " --transcode - Use local transcodeing\n" 133 134 ); … … 436 437 } else if ( strcmp(k, "--io-flush") == 0 ) { 437 438 g_conf.ioflush_interval = atoi(argv[++i]); 438 } else if ( strcmp(k, "--rate") == 0 ) {439 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 439 440 info.rate = roar_str2rate(argv[++i]); 440 } else if ( strcmp(k, "--bits") == 0 ) {441 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 441 442 info.bits = roar_str2bits(argv[++i]); 442 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {443 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 443 444 info.channels = roar_str2channels(argv[++i]); 445 } else if ( !strcmp(k, "--aiprofile") ) { 446 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 447 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 448 return 1; 449 } 444 450 445 451 } else if ( strcmp(k, "--afi-downmix") == 0 ) { … … 459 465 g_conf.filter.in.speex_prep_vad = 1; 460 466 461 } else if ( strcmp(k, "--codec") == 0 ) {467 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 462 468 info.codec = roar_str2codec(argv[++i]); 463 469 -
roarclients/roarradio.c
r5381 r5533 35 35 printf("\nOptions:\n\n"); 36 36 37 printf(" --server SERVER - Set server hostname\n" 38 " --rate RATE - Set sample rate\n" 39 " --bits BITS - Set bits per sample\n" 40 " --chans CHANNELS - Set number of channels\n" 41 " --codec CODEC - Set the codec\n" 42 " --help - Show this help\n" 37 printf(" --server SERVER - Set server hostname\n" 38 " --rate -R RATE - Set sample rate\n" 39 " --bits -B BITS - Set bits per sample\n" 40 " --chans -C CHANNELS - Set number of channels\n" 41 " --codec -E CODEC - Set the codec\n" 42 " --aiprofile PROFILE - Set audio profile\n" 43 " --help - Show this help\n" 43 44 ); 44 45 … … 51 52 52 53 int main (int argc, char * argv[]) { 53 int rate = 44100; 54 int bits = 16; 55 int channels = 2; 56 int codec = ROAR_CODEC_OGG_VORBIS; 54 struct roar_audio_info info; 57 55 char * server = NULL; 58 56 char * k; … … 69 67 ssize_t slen; 70 68 69 if ( roar_profile2info(&info, "default") == -1 ) 70 return 1; 71 72 info.codec = ROAR_CODEC_OGG_VORBIS; 73 71 74 for (i = 1; i < argc; i++) { 72 75 k = argv[i]; … … 74 77 if ( strcmp(k, "--server") == 0 ) { 75 78 server = argv[++i]; 76 } else if ( strcmp(k, "--rate") == 0 ) { 77 rate = roar_str2rate(argv[++i]); 78 } else if ( strcmp(k, "--bits") == 0 ) { 79 bits = roar_str2bits(argv[++i]); 80 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 81 channels = roar_str2channels(argv[++i]); 82 } else if ( strcmp(k, "--codec") == 0 ) { 83 codec = roar_str2codec(argv[++i]); 79 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 80 info.rate = roar_str2rate(argv[++i]); 81 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 82 info.bits = roar_str2bits(argv[++i]); 83 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 84 info.channels = roar_str2channels(argv[++i]); 85 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 86 info.codec = roar_str2codec(argv[++i]); 87 } else if ( !strcmp(k, "--aiprofile") ) { 88 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 89 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 90 return 1; 91 } 84 92 } else if ( strcmp(k, "--help") == 0 ) { 85 93 usage(); … … 206 214 } 207 215 208 if ( roar_stream_new(stream, rate, channels, bits,codec) == -1 ) {216 if ( roar_stream_new(stream, info.rate, info.channels, info.bits, info.codec) == -1 ) { 209 217 roar_disconnect(con); 210 218 return 1; -
roarclients/roarshout.c
r5381 r5533 37 37 38 38 printf(" --server SERVER - Set server hostname\n" 39 " --rate RATE - Set sample rate\n" 40 " --bits BITS - Set bits per sample\n" 41 " --chans CHANNELS - Set number of channels\n" 42 " --codec CODEC - Set the codec\n" 39 " -R --rate RATE - Set sample rate\n" 40 " -B --bits BITS - Set bits per sample\n" 41 " -C --chans CHANNELS - Set number of channels\n" 42 " -E --codec CODEC - Set the codec\n" 43 " --aiprofile PROFILE\n" 44 " - Set audio profile\n" 43 45 " -h --help - Show this help\n" 44 46 " --pw-arg - Password is supplied as argument (default).\n" … … 90 92 int main (int argc, char * argv[]) { 91 93 enum { ARG, ASK, DSTR } pw_source = ARG; 92 int rate = 44100; 93 int bits = 16; 94 int channels = 2; 95 int codec = ROAR_CODEC_OGG_VORBIS; 94 struct roar_audio_info info; 96 95 char * server = NULL; 97 96 char * k; … … 113 112 char password_buf[128]; 114 113 114 if ( roar_profile2info(&info, "default") == -1 ) 115 return 1; 116 117 info.codec = ROAR_CODEC_OGG_VORBIS; 118 115 119 for (i = 1; i < argc; i++) { 116 120 k = argv[i]; … … 118 122 if ( strcmp(k, "--server") == 0 ) { 119 123 server = argv[++i]; 120 } else if ( strcmp(k, "--rate") == 0 ) { 121 rate = roar_str2rate(argv[++i]); 122 } else if ( strcmp(k, "--bits") == 0 ) { 123 bits = roar_str2bits(argv[++i]); 124 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 125 channels = roar_str2channels(argv[++i]); 126 } else if ( strcmp(k, "--codec") == 0 ) { 127 codec = roar_str2codec(argv[++i]); 124 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 125 info.rate = roar_str2rate(argv[++i]); 126 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 127 info.bits = roar_str2bits(argv[++i]); 128 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 129 info.channels = roar_str2channels(argv[++i]); 130 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 131 info.codec = roar_str2codec(argv[++i]); 132 } else if ( !strcmp(k, "--aiprofile") ) { 133 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 134 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 135 return 1; 136 } 128 137 } else if ( strcmp(k, "--pw-arg") == 0 ) { 129 138 pw_source = ARG; … … 254 263 shout_set_url(shout, s_url); 255 264 256 if ( (vss = roar_vs_new_simple(server, "roarshout", rate, channels, codec, bits, ROAR_DIR_MONITOR, &err)) == NULL ) { 265 if ( (vss = roar_vs_new_simple(server, "roarshout", 266 info.rate, info.channels, info.codec, info.bits, 267 ROAR_DIR_MONITOR, &err)) == NULL ) { 257 268 fprintf(stderr, "Error: can not start monitoring: %s\n", roar_vs_strerr(err)); 258 269 return 1; -
roarclients/roarsin.c
r5381 r5533 73 73 } 74 74 75 static void usage(const char * progname) { 76 fprintf(stderr, "Usage: %s [OPTIONS] [FUNCTION]\n", progname); 77 78 fprintf(stderr, "\nOptions:\n\n"); 79 fprintf(stderr, 80 " --help - Show this help\n" 81 " --server SERVER - Set server address\n" 82 " --rate -R RATE - Set sample rate to use\n" 83 " --freq FREQ - Set frequency (in Hz)\n" 84 " --time TIME - Set time (in sec)\n" 85 ); 86 87 fprintf(stderr, "\nFunctions:\n\n"); 88 fprintf(stderr, 89 " --sin - Use Sinus\n" 90 " --rect - Use Rectangle\n" 91 " --saw - Use Saw\n" 92 " --tri - Use Triangle\n" 93 " --trap - Use Trap\n" 94 ); 95 } 96 75 97 int main (int argc, char * argv[]) { 98 const char * server = NULL; 76 99 int rate = ROAR_RATE_DEFAULT; 77 100 int bits = 16; … … 94 117 } else if ( !strcmp(argv[i], "--time") ) { 95 118 length = atof(argv[++i]); 119 } else if ( !strcmp(argv[i], "--server") ) { 120 server = argv[++i]; 121 } else if ( !strcmp(argv[i], "--rate") || !strcmp(argv[i], "-R") ) { 122 rate = roar_str2rate(argv[++i]); 96 123 } else if ( !strcmp(argv[i], "--sin") ) { 97 124 func = sin; … … 104 131 } else if ( !strcmp(argv[i], "--trap") ) { 105 132 func = trap; 133 } else if ( !strcmp(argv[i], "--help") ) { 134 usage(argv[0]); 135 return 0; 106 136 } else { 137 usage(argv[0]); 107 138 return 2; 108 139 } … … 111 142 step = M_PI*2*freq/rate; 112 143 113 if ( (vss = roar_vs_new_playback( NULL, "sine gen", rate, channels, codec, bits, &err)) == NULL ) {144 if ( (vss = roar_vs_new_playback(server, "sine gen", rate, channels, codec, bits, &err)) == NULL ) { 114 145 fprintf(stderr, "Error: can not open playback: %s\n", roar_vs_strerr(err)); 115 146 exit(1); -
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.