Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5529)
+++ ChangeLog	(revision 5533)
@@ -2,4 +2,6 @@
 	* Try use-execed workaround also on UNIX Domain Sockets (Closes: #207)
 	* Implemented SHA1 support (Closes: #232)
+	* Fixed usage of -R/-B/-C/-E as well as --aiprofile in roarclients
+	  (Closes: #176)
 
 v. 1.0beta2 - Wed Jun 06 2012 19:56 CEST
Index: roarclients/roarbidir.c
===================================================================
--- roarclients/roarbidir.c	(revision 5381)
+++ roarclients/roarbidir.c	(revision 5533)
@@ -33,10 +33,11 @@
  printf("\nOptions:\n\n");
 
- printf("  --server SERVER    - Set server hostname\n"
-        "  --rate   RATE      - Set sample rate\n"
-        "  --bits   BITS      - Set bits per sample\n"
-        "  --chans  CHANNELS  - Set number of channels\n"
-        "  --codec  CODEC     - Set the codec\n"
-        "  --help             - Show this help\n"
+ printf("  --server SERVER      - Set server hostname\n"
+        "  --rate  -R RATE      - Set sample rate\n"
+        "  --bits  -B BITS      - Set bits per sample\n"
+        "  --chans -C CHANNELS  - Set number of channels\n"
+        "  --codec -E CODEC     - Set the codec\n"
+        "  --aiprofile PROFILE  - Set audio profile\n"
+        "  --help               - Show this help\n"
        );
 
@@ -44,8 +45,5 @@
 
 int main (int argc, char * argv[]) {
- int    rate     = ROAR_RATE_DEFAULT;
- int    bits     = ROAR_BITS_DEFAULT;
- int    channels = ROAR_CHANNELS_DEFAULT;
- int    codec    = ROAR_CODEC_DEFAULT;
+ struct roar_audio_info info;
  char * server   = NULL;
  char * k;
@@ -61,4 +59,7 @@
  ssize_t ret;
 
+ if ( roar_profile2info(&info, "default") == -1 )
+  return 1;
+
  if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 )
   return 1;
@@ -69,12 +70,17 @@
   if ( strcmp(k, "--server") == 0 ) {
    server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
-   channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 ) {
-   codec = roar_str2codec(argv[++i]);
+  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
+   info.rate = roar_str2rate(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
+   info.bits = roar_str2bits(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
+   info.channels = roar_str2channels(argv[++i]);
+  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
+   info.codec = roar_str2codec(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
   } else if ( strcmp(k, "--help") == 0 ) {
    usage();
@@ -93,5 +99,7 @@
  }
 
- if ( (vss = roar_vs_new_simple(server, "roarbidir", rate, channels, codec, bits, ROAR_DIR_BIDIR, &err)) == NULL ) {
+ if ( (vss = roar_vs_new_simple(server, "roarbidir",
+                                info.rate, info.channels, info.codec, info.bits,
+                                ROAR_DIR_BIDIR, &err)) == NULL ) {
   fprintf(stderr, "Error: can not start playback: %s\n", roar_error2str(err));
   if ( in != NULL )
Index: roarclients/roarcat.c
===================================================================
--- roarclients/roarcat.c	(revision 5457)
+++ roarclients/roarcat.c	(revision 5533)
@@ -37,5 +37,6 @@
         "  --bits  -B  BITS      - Set bits per sample\n"
         "  --chans -C  CHANNELS  - Set number of channels\n"
-        "  --codec     CODEC     - Set the codec\n"
+        "  --codec -E  CODEC     - Set the codec\n"
+        "  --aiprofile PROFILE   - Set audio profile\n"
         "  --wave                - Use Wave Audio (PCM) as input\n"
         "  --midi                - Use MIDI Audio as input\n"
@@ -70,4 +71,5 @@
  int file_opened = 0;
 
+ // TODO: make use of roar_stdin.
  if ( roar_vio_open_fh(&file, ROAR_STDIN) == -1 )
   return 1;
@@ -98,4 +100,9 @@
     return 1;
    }
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
 
   } else if ( !strcmp(k, "--wave") ) {
Index: roarclients/roarcatvio.c
===================================================================
--- roarclients/roarcatvio.c	(revision 5381)
+++ roarclients/roarcatvio.c	(revision 5533)
@@ -33,10 +33,11 @@
  printf("\nOptions:\n\n");
 
- printf("  --server SERVER    - Set server hostname\n"
-        "  --rate   RATE      - Set sample rate\n"
-        "  --bits   BITS      - Set bits per sample\n"
-        "  --chans  CHANNELS  - Set number of channels\n"
-        "  --codec  CODEC     - Set the codec\n"
-        "  --help             - Show this help\n"
+ printf("  --server -s SERVER    - Set server hostname\n"
+        "  --rate   -R RATE      - Set sample rate\n"
+        "  --bits   -B BITS      - Set bits per sample\n"
+        "  --chans  -C CHANNELS  - Set number of channels\n"
+        "  --codec  -E CODEC     - Set the codec\n"
+        "  --aiprofile PROFILE   - Set audio profile\n"
+        "  --help                - Show this help\n"
        );
 
@@ -44,6 +45,8 @@
 
 int main (int argc, char * argv[]) {
- struct roar_audio_info info = {.rate = ROAR_RATE_DEFAULT, .bits = ROAR_BITS_DEFAULT, .channels = ROAR_CHANNELS_DEFAULT};
- int    codec    = -1;
+ struct roar_audio_info info = {.rate = ROAR_RATE_DEFAULT,
+                                .bits = ROAR_BITS_DEFAULT,
+                                .channels = ROAR_CHANNELS_DEFAULT,
+                                .codec = ROAR_AUDIO_INFO_INVALID};
  int    auinfo_changed = 0;
  char * server   = NULL;
@@ -62,8 +65,8 @@
   } else if ( !strcmp(k, "-n") ) {
    name = argv[++i];
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") ) {
+  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
    info.rate = roar_str2rate(argv[++i]);
    auinfo_changed = 1;
-  } else if ( !strcmp(k, "--bits") ) {
+  } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
    info.bits = roar_str2bits(argv[++i]);
    auinfo_changed = 1;
@@ -71,5 +74,5 @@
    info.bits = 8;
    auinfo_changed = 1;
-  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") ) {
+  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
    info.channels = roar_str2channels(argv[++i]);
    auinfo_changed = 1;
@@ -77,6 +80,12 @@
    info.channels = 1;
    auinfo_changed = 1;
-  } else if ( !strcmp(k, "--codec") ) {
-   codec = roar_str2codec(argv[++i]);
+  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
+   info.codec = roar_str2codec(argv[++i]);
+   auinfo_changed = 1;
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
    auinfo_changed = 1;
   } else if ( !strcmp(k, "--help") ) {
@@ -92,8 +101,6 @@
  }
 
- if ( codec == -1 )
-  codec = ROAR_CODEC_DEFAULT;
-
- info.codec = codec;
+ if ( info.codec == ROAR_AUDIO_INFO_INVALID )
+  info.codec = ROAR_CODEC_DEFAULT;
 
  if ( (vss = roar_vs_new(server, name, &err)) == NULL ) {
Index: roarclients/roardtmf.c
===================================================================
--- roarclients/roardtmf.c	(revision 5381)
+++ roarclients/roardtmf.c	(revision 5533)
@@ -68,7 +68,5 @@
 
  printf("  --server SERVER    - Set server hostname\n"
-        "  --rate   RATE      - Set sample rate\n"
-//        "  --bits   BITS      - Set bits per sample\n"
-//        "  --codec  CODEC     - Set the codec\n"
+        "  --rate  -R RATE    - Set sample rate\n"
         "  --help             - Show this help\n"
        );
@@ -141,5 +139,5 @@
   if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
    server = argv[++i];
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") ) {
+  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
    rate = roar_str2rate(argv[++i]);
   } else if ( !strcmp(k, "--help") ) {
Index: roarclients/roarfilt.c
===================================================================
--- roarclients/roarfilt.c	(revision 5381)
+++ roarclients/roarfilt.c	(revision 5533)
@@ -45,26 +45,27 @@
  printf("\nOptions:\n\n");
 
- printf("  --server SERVER    - Set server hostname\n"
-        "  --rate   RATE      - Set sample rate\n"
-        "  --bits   BITS      - Set bits per sample\n"
-        "  --chans  CHANNELS  - Set number of channels\n"
-        "  --help             - Show this help\n"
+ printf("  --server SERVER     - Set server hostname\n"
+        "  --rate  -R RATE     - Set sample rate\n"
+        "  --bits  -B BITS     - Set bits per sample\n"
+        "  --chans -C CHANNELS - Set number of channels\n"
+        "  --aiprofile PROFILE - Set audio profile\n"
+        "  --help              - Show this help\n"
         "\n"
-        "  --half             - half the volume\n"
-        "  --double           - double the volume\n"
-        "  --amp VAL          - Set amplification\n"
-        "  --mul VAL          - Set mul\n"
-        "  --div VAL          - Set div\n"
-#ifdef ROAR_HAVE_LIBM
-        "  --lowpass freq     - lowpass filter (obsolete)\n"
-#endif
-        "  --filter  name     - add filter name\n"
-        "  --ffreq   freq     - set filter freq\n"
-        "  --fmul    mult     - set filter multiplier\n"
-        "  --fdiv    div      - set filter divider\n"
-        "  --fn      N        - set filter N parameter\n"
-        "  --flimit  limit    - set filter limit parameter\n"
-        "  --fmode   mode     - set filter mode parameter\n"
-        "  --fq      Q        - set filter quality\n"
+        "  --half              - half the volume\n"
+        "  --double            - double the volume\n"
+        "  --amp VAL           - Set amplification\n"
+        "  --mul VAL           - Set mul\n"
+        "  --div VAL           - Set div\n"
+#ifdef ROAR_HAVE_LIBM
+        "  --lowpass freq      - lowpass filter (obsolete)\n"
+#endif
+        "  --filter  name      - add filter name\n"
+        "  --ffreq   freq      - set filter freq\n"
+        "  --fmul    mult      - set filter multiplier\n"
+        "  --fdiv    div       - set filter divider\n"
+        "  --fn      N         - set filter N parameter\n"
+        "  --flimit  limit     - set filter limit parameter\n"
+        "  --fmode   mode      - set filter mode parameter\n"
+        "  --fq      Q         - set filter quality\n"
        );
 
@@ -176,4 +177,10 @@
   } else if ( strcmp(k, "-m") == 0 ) {
    info.channels = 1;
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
+   info.codec = ROAR_CODEC_DEFAULT;
   } else if ( strcmp(k, "--half") == 0 || strcmp(k, "-half") == 0 ) {
    div *= 2;
Index: roarclients/roarinterconnect.c
===================================================================
--- roarclients/roarinterconnect.c	(revision 5381)
+++ roarclients/roarinterconnect.c	(revision 5533)
@@ -76,34 +76,35 @@
  printf("\nOptions:\n\n");
 
- printf("  --server SERVER    - Set server hostname\n"
-        "  --remote SERVER    - Set remote server\n"
-        "  --type   TYPE      - Set type of remote server\n"
-        "  --rate   RATE      - Set sample rate\n"
-        "  --bits   BITS      - Set bits per sample\n"
-        "  --chans  CHANNELS  - Set number of channels\n"
-        "  --codec  CODEC     - Set the codec\n"
-        "  --help             - Show this help\n"
-        "  --verbose -v       - Be verbose\n"
+ printf("  --server SERVER     - Set server hostname\n"
+        "  --remote SERVER     - Set remote server\n"
+        "  --type   TYPE       - Set type of remote server\n"
+        "  --rate  -R RATE     - Set sample rate\n"
+        "  --bits  -B BITS     - Set bits per sample\n"
+        "  --chans -C CHANNELS - Set number of channels\n"
+        "  --codec -E CODEC    - Set the codec\n"
+        "  --aiprofile PROFILE - Set audio profile\n"
+        "  --help              - Show this help\n"
+        "  --verbose -v        - Be verbose\n"
        );
 
  printf("\nPossible Types:\n\n");
- printf("  roar               - RoarAudio Server\n"
+ printf("  roar                - RoarAudio Server\n"
 #ifdef ROAR_HAVE_ESD
-        "  esd                - EsounD Server\n"
-#endif
-        "  simple             - PulseAudio using simple protocol\n"
+        "  esd                 - EsounD Server\n"
+#endif
+        "  simple              - PulseAudio using simple protocol\n"
 #ifdef _HAVE_OSS
-        "  oss                - Open Sound System (OSS) device\n"
+        "  oss                 - Open Sound System (OSS) device\n"
 #endif
 #ifdef _HAVE_RSOUND
-        "  rsound             - RSound server\n"
+        "  rsound              - RSound server\n"
 #endif
         "\n"
-        "  bidir              - Connect bidirectional\n"
-        "  filter             - Use local server as filter for remote server\n"
-        "  transmit           - Transmit data from local server to remote server\n"
-        "  receive            - Receive data from remote server\n"
-        "  recplay            - Record from and play data to remote server\n"
-        "  record             - Record data from remote server\n"
+        "  bidir               - Connect bidirectional\n"
+        "  filter              - Use local server as filter for remote server\n"
+        "  transmit            - Transmit data from local server to remote server\n"
+        "  receive             - Receive data from remote server\n"
+        "  recplay             - Record from and play data to remote server\n"
+        "  record              - Record data from remote server\n"
        );
 
@@ -257,15 +258,9 @@
  struct roar_stream     stream[1];
  struct roar_vio_calls  vio;
-#ifdef _HAVE_OSS
  struct roar_audio_info info;
-#endif
 #ifdef _HAVE_RSOUND
  rsound_t *rd;
  enum rsd_format fmt = 0;
 #endif
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_DEFAULT;
  int    type     = parse_type(NULL);
  int    tmp;
@@ -278,4 +273,7 @@
  int    rport;
 
+ if ( roar_profile2info(&info, "default") == -1 )
+  return 1;
+
  for (i = 1; i < argc; i++) {
   k = argv[i];
@@ -287,12 +285,17 @@
   } else if ( strcmp(k, "--type") == 0 ) {
    type = parse_type(argv[++i]);
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
-   channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 ) {
-   codec = roar_str2codec(argv[++i]);
+  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
+   info.rate = roar_str2rate(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
+   info.bits = roar_str2bits(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
+   info.channels = roar_str2channels(argv[++i]);
+  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
+   info.codec = roar_str2codec(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
   } else if ( strcmp(k, "--verbose") == 0 || strcmp(k, "-v") == 0 ) {
    g_verbose++;
@@ -339,5 +342,7 @@
        return 2;
     }
-    if ( roar_vio_simple_stream(&vio, rate, channels, bits, codec, remote, tmp, CLIENT_NAME, -1) == -1 ) {
+    if ( roar_vio_simple_stream(&vio,
+                                info.rate, info.channels, info.bits, info.codec,
+                                remote, tmp, CLIENT_NAME, -1) == -1 ) {
      fprintf(stderr, "Error: can not open RoarAudio stream to %s: %s\n", remote, roar_error2str(roar_error));
      return 2;
@@ -374,8 +379,4 @@
        return 2;
     }
-    info.rate     = rate;
-    info.channels = channels;
-    info.bits     = bits;
-    info.codec    = codec;
     if ( roar_cdriver_oss(&vio, "OSS", remote, &info, tmp) == -1 ) {
      fprintf(stderr, "Error: can not open OSS device %s: %s\n", remote, roar_error2str(roar_error));
@@ -393,5 +394,5 @@
     tmp = ESD_STREAM|ESD_PLAY;
 
-    switch (bits) {
+    switch (info.bits) {
      case  8: tmp |= ESD_BITS8;  break;
      case 16: tmp |= ESD_BITS16; break;
@@ -401,5 +402,5 @@
     }
 
-    switch (channels) {
+    switch (info.channels) {
      case 1: tmp |= ESD_MONO;   break;
      case 2: tmp |= ESD_STEREO; break;
@@ -410,8 +411,8 @@
 
     // TODO: FIXME: this is only true if the esd runs on a LE system,...
-    if ( bits == 8 && codec != ROAR_CODEC_PCM_U_LE ) {
+    if ( info.bits == 8 && info.codec != ROAR_CODEC_PCM_U_LE ) {
      fprintf(stderr, "Error: EsounD only supports unsigned PCM in 8 bit mode\n");
      return 2;
-    } else if ( bits == 16 && codec != ROAR_CODEC_DEFAULT ) {
+    } else if ( info.bits == 16 && info.codec != ROAR_CODEC_DEFAULT ) {
      fprintf(stderr, "Error: EsounD only supports signed PCM in 16 bit mode\n");
      return 2;
@@ -420,12 +421,12 @@
     switch (type & ST_MASK) {
      case ST_FILTER:
-       rfh = esd_filter_stream(tmp, rate, remote, CLIENT_NAME);
+       rfh = esd_filter_stream(tmp, info.rate, remote, CLIENT_NAME);
       break;
      case ST_TRANSMIT:
-       rfh = esd_play_stream(tmp, rate, remote, CLIENT_NAME);
+       rfh = esd_play_stream(tmp, info.rate, remote, CLIENT_NAME);
        localdir = ROAR_DIR_MONITOR;
       break;
      case ST_RECEIVE:
-       rfh = esd_monitor_stream(tmp, rate, remote, CLIENT_NAME);
+       rfh = esd_monitor_stream(tmp, info.rate, remote, CLIENT_NAME);
        localdir = ROAR_DIR_PLAY;
       break;
@@ -439,5 +440,5 @@
 #ifdef _HAVE_RSOUND
   case MT_RSOUND:
-    fmt = para2rsdfmt(bits, codec);
+    fmt = para2rsdfmt(info.bits, info.codec);
 
     if ( fmt == 0 ) {
@@ -452,6 +453,8 @@
        rsd_init(&rd);
        rsd_set_param(rd, RSD_HOST,       remote);
-       rsd_set_param(rd, RSD_CHANNELS,   &channels);
-       rsd_set_param(rd, RSD_SAMPLERATE, &rate);
+       tmp = info.channels;
+       rsd_set_param(rd, RSD_CHANNELS,   &tmp);
+       tmp = info.rate;
+       rsd_set_param(rd, RSD_SAMPLERATE, &tmp);
        rsd_set_param(rd, RSD_FORMAT,     &fmt);
 #ifdef RSD_IDENTITY
@@ -526,5 +529,5 @@
  }
 
- if ( roar_stream_new(stream, rate, channels, bits, codec) == -1 ) {
+ if ( roar_stream_new(stream, info.rate, info.channels, info.bits, info.codec) == -1 ) {
   roar_disconnect(con);
   return 21;
Index: roarclients/roarmon.c
===================================================================
--- roarclients/roarmon.c	(revision 5381)
+++ roarclients/roarmon.c	(revision 5533)
@@ -37,5 +37,6 @@
         "  --bits  -B BITS      - Set bits per sample\n"
         "  --chans -C CHANNELS  - Set number of channels\n"
-        "  --codec    CODEC     - Set the codec\n"
+        "  --codec -E CODEC     - Set the codec\n"
+        "  --aiprofile PROFILE  - Set audio profile\n"
         "  --record             - Run in record mode (Wave Audio only)\n"
         "  --wave               - Output Wave Audio (PCM)\n"
@@ -54,8 +55,9 @@
 
 int main (int argc, char * argv[]) {
- int    rate     = -1;
- int    bits     = -1;
- int    channels = -1;
- int    codec    = -1;
+ struct roar_audio_info info = {
+  .rate = ROAR_AUDIO_INFO_INVALID,
+  .bits = ROAR_AUDIO_INFO_INVALID,
+  .channels = ROAR_AUDIO_INFO_INVALID,
+  .codec = ROAR_AUDIO_INFO_INVALID};
  int    dir      = ROAR_DIR_MONITOR;
  int    rel_id   = -1;
@@ -84,16 +86,22 @@
    server = argv[++i];
   } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
-   rate = roar_str2rate(argv[++i]);
+   info.rate = roar_str2rate(argv[++i]);
   } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
-   bits = roar_str2bits(argv[++i]);
+   info.bits = roar_str2bits(argv[++i]);
   } else if ( !strcmp(k, "-b") ) {
-   bits = 8;
+   info.bits = 8;
   } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   channels = roar_str2channels(argv[++i]);
+   info.channels = roar_str2channels(argv[++i]);
   } else if ( !strcmp(k, "-m") ) {
-   channels = 1;
-  } else if ( !strcmp(k, "--codec") ) {
-   if ( (codec = roar_str2codec(argv[++i])) == -1 ) {
+   info.channels = 1;
+  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
+   if ( (info.codec = roar_str2codec(argv[++i])) == ROAR_AUDIO_INFO_INVALID ) {
     fprintf(stderr, "Error: Unknown codec: %s\n", argv[i]);
+    return 1;
+   }
+
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
     return 1;
    }
@@ -140,40 +148,40 @@
   case ROAR_DIR_MONITOR:
   case ROAR_DIR_RECORD:
-    if ( rate     == -1 ) rate     = ROAR_RATE_DEFAULT;
-    if ( bits     == -1 ) bits     = ROAR_BITS_DEFAULT;
-    if ( channels == -1 ) channels = ROAR_CHANNELS_DEFAULT;
-    if ( codec    == -1 ) codec    = ROAR_CODEC_DEFAULT;
+    if ( info.rate      == ROAR_AUDIO_INFO_INVALID ) info.rate     = ROAR_RATE_DEFAULT;
+    if ( info.bits      == ROAR_AUDIO_INFO_INVALID ) info.bits     = ROAR_BITS_DEFAULT;
+    if ( info.channels  == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_CHANNELS_DEFAULT;
+    if ( info.codec     == ROAR_AUDIO_INFO_INVALID ) info.codec    = ROAR_CODEC_DEFAULT;
    break;
   case ROAR_DIR_MIDI_OUT:
-    if ( rate     == -1 ) rate     = 0;
-    if ( bits     == -1 ) bits     = ROAR_MIDI_BITS;
-    if ( channels == -1 ) channels = ROAR_MIDI_CHANNELS_DEFAULT;
-    if ( codec    == -1 ) codec    = ROAR_CODEC_MIDI;
+    if ( info.rate      == ROAR_AUDIO_INFO_INVALID ) info.rate     = 0;
+    if ( info.bits      == ROAR_AUDIO_INFO_INVALID ) info.bits     = ROAR_MIDI_BITS;
+    if ( info.channels  == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_MIDI_CHANNELS_DEFAULT;
+    if ( info.codec     == ROAR_AUDIO_INFO_INVALID ) info.codec    = ROAR_CODEC_MIDI;
    break;
   case ROAR_DIR_LIGHT_OUT:
-    if ( rate     == -1 ) rate     = 0;
-    if ( bits     == -1 ) bits     = ROAR_LIGHT_BITS;
-    if ( channels == -1 ) channels = 0;
-    if ( codec    == -1 ) codec    = ROAR_CODEC_DMX512;
+    if ( info.rate      == ROAR_AUDIO_INFO_INVALID ) info.rate     = 0;
+    if ( info.bits      == ROAR_AUDIO_INFO_INVALID ) info.bits     = ROAR_LIGHT_BITS;
+    if ( info.channels  == ROAR_AUDIO_INFO_INVALID ) info.channels = 0;
+    if ( info.codec     == ROAR_AUDIO_INFO_INVALID ) info.codec    = ROAR_CODEC_DMX512;
    break;
   case ROAR_DIR_COMPLEX_OUT:
-    if ( rate     == -1 ) rate     = ROAR_COMPLEX_RATE;
-    if ( bits     == -1 ) bits     = ROAR_COMPLEX_BITS;
-    if ( channels == -1 ) channels = ROAR_COMPLEX_CHANNELS;
-    if ( codec    == -1 ) codec    = ROAR_COMPLEX_CODEC;
+    if ( info.rate      == ROAR_AUDIO_INFO_INVALID ) info.rate     = ROAR_COMPLEX_RATE;
+    if ( info.bits      == ROAR_AUDIO_INFO_INVALID ) info.bits     = ROAR_COMPLEX_BITS;
+    if ( info.channels  == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_COMPLEX_CHANNELS;
+    if ( info.codec     == ROAR_AUDIO_INFO_INVALID ) info.codec    = ROAR_COMPLEX_CODEC;
    break;
   case ROAR_DIR_RDTCS_OUT:
-    if ( rate     == -1 ) rate     = ROAR_RDTCS_RATE;
-    if ( bits     == -1 ) bits     = ROAR_RDTCS_BITS;
-    if ( channels == -1 ) channels = ROAR_RDTCS_CHANNELS;
-    if ( codec    == -1 ) codec    = ROAR_RDTCS_CODEC;
+    if ( info.rate      == ROAR_AUDIO_INFO_INVALID ) info.rate     = ROAR_RDTCS_RATE;
+    if ( info.bits      == ROAR_AUDIO_INFO_INVALID ) info.bits     = ROAR_RDTCS_BITS;
+    if ( info.channels  == ROAR_AUDIO_INFO_INVALID ) info.channels = ROAR_RDTCS_CHANNELS;
+    if ( info.codec     == ROAR_AUDIO_INFO_INVALID ) info.codec    = ROAR_RDTCS_CODEC;
    break;
   case ROAR_DIR_RAW_OUT:
   case ROAR_DIR_THRU:
   default:
-    if ( rate     == -1 ) rate     = 0;
-    if ( bits     == -1 ) bits     = 0;
-    if ( channels == -1 ) channels = 0;
-    if ( codec    == -1 ) codec    = ROAR_CODEC_DEFAULT;
+    if ( info.rate      == ROAR_AUDIO_INFO_INVALID ) info.rate     = 0;
+    if ( info.bits      == ROAR_AUDIO_INFO_INVALID ) info.bits     = 0;
+    if ( info.channels  == ROAR_AUDIO_INFO_INVALID ) info.channels = 0;
+    if ( info.codec     == ROAR_AUDIO_INFO_INVALID ) info.codec    = ROAR_CODEC_DEFAULT;
    break;
  }
@@ -184,5 +192,5 @@
  }
 
- if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) {
+ if ( roar_stream_new(&s, info.rate, info.channels, info.bits, info.codec) == -1 ) {
   fprintf(stderr, "Error: can not create stream\n");
   roar_disconnect(&con);
Index: roarclients/roarmonhttp.c
===================================================================
--- roarclients/roarmonhttp.c	(revision 5381)
+++ roarclients/roarmonhttp.c	(revision 5533)
@@ -47,5 +47,6 @@
         "  --bits  -B  BITS      - Set bits per sample\n"
         "  --chans -C  CHANNELS  - Set number of channels\n"
-        "  --codec     CODEC     - Set the codec\n"
+        "  --codec -E  CODEC     - Set the codec\n"
+        "  --aiprofile PROFILE   - Set audio profile\n"
         "  --rel-id ID           - Set ID of relative stream\n"
         "  --inetd               - Start in inetd mode (STDIN and STDOUT connected to socket)\n"
@@ -231,8 +232,5 @@
 
 int main (int argc, char * argv[]) {
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_OGG_VORBIS;
+ struct roar_audio_info info;
  int    rel_id   = -1;
  int    sflags   = ROAR_FLAG_NONE;
@@ -252,4 +250,9 @@
 #endif
 
+ if ( roar_profile2info(&info, "default") == -1 )
+  return 1;
+
+ info.codec = ROAR_CODEC_OGG_VORBIS;
+
  for (i = 1; i < argc; i++) {
   k = argv[i];
@@ -263,12 +266,17 @@
   } else if ( !strcmp(k, "--server") ) {
    roar_libroar_set_server(argv[++i]);
-  } else if ( !strcmp(k, "--codec") ) {
-   codec = roar_str2codec(argv[++i]);
+  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
+   info.codec = roar_str2codec(argv[++i]);
   } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
-   rate = roar_str2rate(argv[++i]);
+   info.rate = roar_str2rate(argv[++i]);
   } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
-   bits = roar_str2bits(argv[++i]);
+   info.bits = roar_str2bits(argv[++i]);
   } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   channels = roar_str2channels(argv[++i]);
+   info.channels = roar_str2channels(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
   } else if ( !strcmp(k, "--rel-id") ) {
    rel_id = atoi(argv[++i]);
@@ -294,12 +302,15 @@
 
   if ( !strcmp(k, "codec") ) {
-   if ( (codec = roar_str2codec(v)) == -1 )
+   if ( (info.codec = roar_str2codec(v)) == ROAR_AUDIO_INFO_INVALID )
     return 1;
   } else if ( !strcmp(k, "channels") ) {
-   channels = roar_str2channels(v);
+   info.channels = roar_str2channels(v);
   } else if ( !strcmp(k, "rate") ) {
-   rate = roar_str2rate(v);
+   info.rate = roar_str2rate(v);
   } else if ( !strcmp(k, "bits") ) {
-   bits = roar_str2bits(v);
+   info.bits = roar_str2bits(v);
+  } else if ( !strcmp(k, "aiprofile") ) {
+   if ( roar_profile2info(&info, v) == -1 )
+    return 1;
   } else if ( !strcmp(k, "rel-id") || !strcmp(k, "relid") ) {
    rel_id = atoi(v);
@@ -328,5 +339,5 @@
  }
 
- if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) {
+ if ( roar_stream_new(&s, info.rate, info.channels, info.bits, info.codec) == -1 ) {
   roar_disconnect(&con);
   return 20;
@@ -361,5 +372,5 @@
 
  if ( !gopher )
-  print_header(codec, rate, channels);
+  print_header(info.codec, info.rate, info.channels);
 
 /*
Index: roarclients/roarphone.c
===================================================================
--- roarclients/roarphone.c	(revision 5381)
+++ roarclients/roarphone.c	(revision 5533)
@@ -114,7 +114,8 @@
 
  printf("\nAudio Options:\n\n");
- printf("  --rate     RATE      - Set sample rate\n"
-        "  --bits     BITS      - Set bits per sample\n"
-        "  --chans    CHANNELS  - Set number of channels\n"
+ printf("  --rate  -R RATE      - Set sample rate\n"
+        "  --bits  -B BITS      - Set bits per sample\n"
+        "  --chans -C CHANNELS  - Set number of channels\n"
+        "  --aiprofile PROFILE  - Set audio profile\n"
        );
 
@@ -129,5 +130,5 @@
 
  printf("\nCodec Options:\n\n");
- printf("  --codec    CODEC     - Set the codec\n"
+ printf("  --codec -E CODEC     - Set the codec\n"
         "  --transcode          - Use local transcodeing\n"
        );
@@ -436,10 +437,15 @@
   } else if ( strcmp(k, "--io-flush") == 0 ) {
    g_conf.ioflush_interval = atoi(argv[++i]);
-  } else if ( strcmp(k, "--rate") == 0 ) {
+  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
    info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
+  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
    info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
    info.channels = roar_str2channels(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
 
   } else if ( strcmp(k, "--afi-downmix") == 0 ) {
@@ -459,5 +465,5 @@
    g_conf.filter.in.speex_prep_vad = 1;
 
-  } else if ( strcmp(k, "--codec") == 0 ) {
+  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
    info.codec = roar_str2codec(argv[++i]);
 
Index: roarclients/roarradio.c
===================================================================
--- roarclients/roarradio.c	(revision 5381)
+++ roarclients/roarradio.c	(revision 5533)
@@ -35,10 +35,11 @@
  printf("\nOptions:\n\n");
 
- printf("  --server SERVER    - Set server hostname\n"
-        "  --rate   RATE      - Set sample rate\n"
-        "  --bits   BITS      - Set bits per sample\n"
-        "  --chans  CHANNELS  - Set number of channels\n"
-        "  --codec  CODEC     - Set the codec\n"
-        "  --help             - Show this help\n"
+ printf("  --server SERVER      - Set server hostname\n"
+        "  --rate  -R RATE      - Set sample rate\n"
+        "  --bits  -B BITS      - Set bits per sample\n"
+        "  --chans -C CHANNELS  - Set number of channels\n"
+        "  --codec -E CODEC     - Set the codec\n"
+        "  --aiprofile PROFILE  - Set audio profile\n"
+        "  --help               - Show this help\n"
        );
 
@@ -51,8 +52,5 @@
 
 int main (int argc, char * argv[]) {
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_OGG_VORBIS;
+ struct roar_audio_info info;
  char * server   = NULL;
  char * k;
@@ -69,4 +67,9 @@
  ssize_t slen;
 
+ if ( roar_profile2info(&info, "default") == -1 )
+  return 1;
+
+ info.codec = ROAR_CODEC_OGG_VORBIS;
+
  for (i = 1; i < argc; i++) {
   k = argv[i];
@@ -74,12 +77,17 @@
   if ( strcmp(k, "--server") == 0 ) {
    server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
-   channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 ) {
-   codec = roar_str2codec(argv[++i]);
+  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
+   info.rate = roar_str2rate(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
+   info.bits = roar_str2bits(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
+   info.channels = roar_str2channels(argv[++i]);
+  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
+   info.codec = roar_str2codec(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
   } else if ( strcmp(k, "--help") == 0 ) {
    usage();
@@ -206,5 +214,5 @@
  }
 
- if ( roar_stream_new(stream, rate, channels, bits, codec) == -1 ) {
+ if ( roar_stream_new(stream, info.rate, info.channels, info.bits, info.codec) == -1 ) {
   roar_disconnect(con);
   return 1;
Index: roarclients/roarshout.c
===================================================================
--- roarclients/roarshout.c	(revision 5381)
+++ roarclients/roarshout.c	(revision 5533)
@@ -37,8 +37,10 @@
 
  printf("    --server SERVER    - Set server hostname\n"
-        "    --rate   RATE      - Set sample rate\n"
-        "    --bits   BITS      - Set bits per sample\n"
-        "    --chans  CHANNELS  - Set number of channels\n"
-        "    --codec  CODEC     - Set the codec\n"
+        " -R --rate   RATE      - Set sample rate\n"
+        " -B --bits   BITS      - Set bits per sample\n"
+        " -C --chans  CHANNELS  - Set number of channels\n"
+        " -E --codec  CODEC     - Set the codec\n"
+        "    --aiprofile PROFILE\n"
+        "                       - Set audio profile\n"
         " -h --help             - Show this help\n"
         "    --pw-arg           - Password is supplied as argument (default).\n"
@@ -90,8 +92,5 @@
 int main (int argc, char * argv[]) {
  enum { ARG, ASK, DSTR } pw_source = ARG;
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_OGG_VORBIS;
+ struct roar_audio_info info;
  char * server   = NULL;
  char * k;
@@ -113,4 +112,9 @@
  char password_buf[128];
 
+ if ( roar_profile2info(&info, "default") == -1 )
+  return 1;
+
+ info.codec = ROAR_CODEC_OGG_VORBIS;
+
  for (i = 1; i < argc; i++) {
   k = argv[i];
@@ -118,12 +122,17 @@
   if ( strcmp(k, "--server") == 0 ) {
    server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
-   channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 ) {
-   codec = roar_str2codec(argv[++i]);
+  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
+   info.rate = roar_str2rate(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
+   info.bits = roar_str2bits(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
+   info.channels = roar_str2channels(argv[++i]);
+  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
+   info.codec = roar_str2codec(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
   } else if ( strcmp(k, "--pw-arg") == 0 ) {
    pw_source = ARG;
@@ -254,5 +263,7 @@
   shout_set_url(shout, s_url);
 
- if ( (vss = roar_vs_new_simple(server, "roarshout", rate, channels, codec, bits, ROAR_DIR_MONITOR, &err)) == NULL ) {
+ if ( (vss = roar_vs_new_simple(server, "roarshout",
+                                info.rate, info.channels, info.codec, info.bits,
+                                ROAR_DIR_MONITOR, &err)) == NULL ) {
   fprintf(stderr, "Error: can not start monitoring: %s\n", roar_vs_strerr(err));
   return 1;
Index: roarclients/roarsin.c
===================================================================
--- roarclients/roarsin.c	(revision 5381)
+++ roarclients/roarsin.c	(revision 5533)
@@ -73,5 +73,28 @@
 }
 
+static void usage(const char * progname) {
+ fprintf(stderr, "Usage: %s [OPTIONS] [FUNCTION]\n", progname);
+
+ fprintf(stderr, "\nOptions:\n\n");
+ fprintf(stderr,
+         "  --help                  - Show this help\n"
+         "  --server SERVER         - Set server address\n"
+         "  --rate   -R  RATE       - Set sample rate to use\n"
+         "  --freq FREQ             - Set frequency (in Hz)\n"
+         "  --time TIME             - Set time (in sec)\n"
+        );
+
+ fprintf(stderr, "\nFunctions:\n\n");
+ fprintf(stderr,
+         "  --sin                   - Use Sinus\n"
+         "  --rect                  - Use Rectangle\n"
+         "  --saw                   - Use Saw\n"
+         "  --tri                   - Use Triangle\n"
+         "  --trap                  - Use Trap\n"
+        );
+}
+
 int main (int argc, char * argv[]) {
+ const char * server = NULL;
  int rate     = ROAR_RATE_DEFAULT;
  int bits     = 16;
@@ -94,4 +117,8 @@
   } else if ( !strcmp(argv[i], "--time") ) {
    length = atof(argv[++i]);
+  } else if ( !strcmp(argv[i], "--server") ) {
+   server = argv[++i];
+  } else if ( !strcmp(argv[i], "--rate") || !strcmp(argv[i], "-R") ) {
+   rate = roar_str2rate(argv[++i]);
   } else if ( !strcmp(argv[i], "--sin") ) {
    func   = sin;
@@ -104,5 +131,9 @@
   } else if ( !strcmp(argv[i], "--trap") ) {
    func   = trap;
+  } else if ( !strcmp(argv[i], "--help") ) {
+   usage(argv[0]);
+   return 0;
   } else {
+   usage(argv[0]);
    return 2;
   }
@@ -111,5 +142,5 @@
  step   = M_PI*2*freq/rate;
 
- if ( (vss = roar_vs_new_playback(NULL, "sine gen", rate, channels, codec, bits, &err)) == NULL ) {
+ if ( (vss = roar_vs_new_playback(server, "sine gen", rate, channels, codec, bits, &err)) == NULL ) {
   fprintf(stderr, "Error: can not open playback: %s\n", roar_vs_strerr(err));
   exit(1);
Index: roarclients/roarvumeter.c
===================================================================
--- roarclients/roarvumeter.c	(revision 5381)
+++ roarclients/roarvumeter.c	(revision 5533)
@@ -45,14 +45,15 @@
  printf("\nOptions:\n\n");
 
- printf("  --server  SERVER   - Set server hostname\n"
-        "  --rate    RATE     - Set sample rate\n"
-        "  --bits    BITS     - Set bits per sample\n"
-        "  --chans   CHANNELS - Set number of channels\n"
-        "  --samples SAMPLES  - Set number of input samples per block\n"
-        "  --pc               - Use percent scale\n"
-        "  --db               - Use dB scale\n"
-        "  --beat             - Enable beat detection\n"
-        "  --lowpass FREQ     - Use lowpass to filter input (-%idB/dec)\n"
-        "  --help             - Show this help\n",
+ printf("  --server  SERVER    - Set server hostname\n"
+        "  --rate  -R RATE     - Set sample rate\n"
+        "  --bits  -B BITS     - Set bits per sample\n"
+        "  --chans -C CHANS    - Set number of channels\n"
+        "  --aiprofile PROFILE - Set audio profile\n"
+        "  --samples SAMPLES   - Set number of input samples per block\n"
+        "  --pc                - Use percent scale\n"
+        "  --db                - Use dB scale\n"
+        "  --beat              - Enable beat detection\n"
+        "  --lowpass FREQ      - Use lowpass to filter input (-%idB/dec)\n"
+        "  --help              - Show this help\n",
         LOWPASS_ORDER * 20
        );
@@ -163,8 +164,5 @@
  struct roardsp_filter      * filter;
  float  lowpass_freq = 0;
- int    rate     = ROAR_RATE_DEFAULT;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_DEFAULT;
+ struct roar_audio_info info;
  int    samples  = -1;
  char * server   = NULL;
@@ -174,4 +172,7 @@
  int    mode = 0;
 
+ if ( roar_profile2info(&info, "default") == -1 )
+  return 1;
+
  for (i = 1; i < argc; i++) {
   k = argv[i];
@@ -179,10 +180,15 @@
   if ( strcmp(k, "--server") == 0 ) {
    server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0) {
-   channels = roar_str2channels(argv[++i]);
+  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
+   info.rate = roar_str2rate(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
+   info.bits = roar_str2bits(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
+   info.channels = roar_str2channels(argv[++i]);
+  } else if ( !strcmp(k, "--aiprofile") ) {
+   if ( roar_profile2info(&info, argv[++i]) == -1 ) {
+    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error));
+    return 1;
+   }
   } else if ( strcmp(k, "--samples") == 0 ) {
    samples = atoi(argv[++i]);
@@ -213,5 +219,5 @@
 
  if ( samples == -1 )
-  samples = rate/10;
+  samples = info.rate/10;
 
  if ( roar_simple_connect(&con, server, "roarvumeter") == -1 ) {
@@ -220,5 +226,7 @@
  }
 
- if ( roar_vio_simple_new_stream_obj(&stream, &con, &s, rate, channels, bits, codec, ROAR_DIR_MONITOR, -1) == -1) {
+ if ( roar_vio_simple_new_stream_obj(&stream, &con, &s,
+                                     info.rate, info.channels, info.bits, ROAR_CODEC_DEFAULT,
+                                     ROAR_DIR_MONITOR, -1) == -1) {
   fprintf(stderr, "Error: can not start monetoring\n");
   return 1;
@@ -262,5 +270,5 @@
  }
 
- vumeter(&re, samples*channels, bits, channels, mode, &fchain);
+ vumeter(&re, samples*info.channels, info.bits, info.channels, mode, &fchain);
 
  printf("\n"); // if the reach this then roard has quited and we should print a newline
