Index: libroararts/libartsc.c
===================================================================
--- libroararts/libartsc.c	(revision 4708)
+++ libroararts/libartsc.c	(revision 4891)
@@ -43,7 +43,8 @@
 
 struct _libroarartsc_stream {
- struct roar_stream stream;
- int fh;
- int blocking;
+ roar_vs_t * vss;
+ struct roar_stream _stream;
+ int _fh;
+ int _blocking;
  int block_size;
  int dir;
@@ -82,5 +83,55 @@
  */
 const char *arts_error_text(int errorcode) {
- return strerror(errorcode);
+ return roar_vs_strerr(errorcode);
+}
+
+static arts_stream_t _arts_stream(int rate, int bits, int channels, const char *name, int dir) {
+ struct _libroarartsc_stream * s = roar_mm_malloc(sizeof(struct _libroarartsc_stream));
+ struct roar_stream * stream;
+ struct roar_audio_info auinfo;
+ struct roar_stream_info info;
+ struct roar_keyval kv[1];
+ int err = ROAR_ERROR_NONE;
+
+ if ( s == NULL )
+  return NULL;
+
+ if ( (s->vss = roar_vs_new_from_con(_libroarartsc_connection, &err)) == NULL ) {
+  roar_mm_free(s);
+  return NULL;
+ }
+
+ memset(&auinfo, 0, sizeof(auinfo));
+ auinfo.rate     = rate;
+ auinfo.channels = channels;
+ auinfo.bits     = bits;
+ auinfo.codec    = ROAR_CODEC_DEFAULT;
+
+ if ( roar_vs_stream(s->vss, &auinfo, dir, &err) == -1 ) {
+  roar_vs_close(s->vss, ROAR_VS_TRUE, &err);
+  roar_mm_free(s);
+  return NULL;
+ }
+
+ s->dir = dir;
+
+ stream = roar_vs_stream_obj(s->vss, &err);
+
+ if ( roar_stream_get_info(_libroarartsc_connection, stream, &info) != -1 ) {
+  s->block_size = info.block_size;
+ } else {
+  roar_vs_close(s->vss, ROAR_VS_TRUE, &err);
+  roar_mm_free(s);
+  return NULL;
+ }
+
+ if ( name != NULL && *name ) {
+  kv[0].key   = "description";
+  kv[0].value = (char*)name;
+
+  roar_vs_meta(s->vss, kv, 1, &err);
+ }
+
+ return (arts_stream_t) s;
 }
 
@@ -97,38 +148,5 @@
  */
 arts_stream_t arts_play_stream(int rate, int bits, int channels, const char *name) {
- struct _libroarartsc_stream * s = roar_mm_malloc(sizeof(struct _libroarartsc_stream));
- struct roar_meta meta;
- struct roar_stream_info info;
-
- if ( !s )
-  return NULL;
-
- if ( (s->fh = roar_simple_new_stream_obj(_libroarartsc_connection, &(s->stream),
-                                 rate, channels, bits, ROAR_CODEC_DEFAULT, ROAR_DIR_PLAY)) == -1 ) {
-  roar_mm_free(s);
-  return NULL;
- }
-
- s->dir = ROAR_DIR_PLAY;
-
- s->blocking = 1;
-
- if ( roar_stream_get_info(_libroarartsc_connection, &(s->stream), &info) != -1 ) {
-  s->block_size = info.block_size;
- } else {
-  close(s->fh);
-  roar_mm_free(s);
-  return NULL;
- }
-
- if ( name && *name ) {
-  meta.value  = (char*)name;
-  meta.key[0] = 0;
-  meta.type   = ROAR_META_TYPE_DESCRIPTION;
-
-  roar_stream_meta_set(_libroarartsc_connection, &(s->stream), ROAR_META_MODE_SET, &meta);
- }
-
- return (arts_stream_t) s;
+ return _arts_stream(rate, bits, channels, name, ROAR_DIR_PLAY);
 }
 
@@ -145,38 +163,5 @@
  */
 arts_stream_t arts_record_stream(int rate, int bits, int channels, const char *name) {
- struct _libroarartsc_stream * s = roar_mm_malloc(sizeof(struct _libroarartsc_stream));
- struct roar_meta meta;
- struct roar_stream_info info;
-
- if ( !s )
-  return NULL;
-
- if ( (s->fh = roar_simple_new_stream_obj(_libroarartsc_connection, &(s->stream),
-                                 rate, channels, bits, ROAR_CODEC_DEFAULT, ROAR_DIR_RECORD)) == -1 ) {
-  roar_mm_free(s);
-  return NULL;
- }
-
- s->dir = ROAR_DIR_RECORD;
-
- s->blocking = 1;
-
- if ( roar_stream_get_info(_libroarartsc_connection, &(s->stream), &info) != -1 ) {
-  s->block_size = info.block_size;
- } else {
-  close(s->fh);
-  roar_mm_free(s);
-  return NULL;
- }
-
- if ( name && *name ) {
-  meta.value  = (char*)name;
-  meta.key[0] = 0;
-  meta.type   = ROAR_META_TYPE_DESCRIPTION;
-
-  roar_stream_meta_set(_libroarartsc_connection, &(s->stream), ROAR_META_MODE_SET, &meta);
- }
-
- return (arts_stream_t) s;
+ return _arts_stream(rate, bits, channels, name, ROAR_DIR_RECORD);
 }
 
@@ -186,8 +171,8 @@
 void arts_close_stream(arts_stream_t stream) {
  struct _libroarartsc_stream * s = (struct _libroarartsc_stream *) stream;
- if ( !stream )
+ if ( stream == NULL )
   return;
 
- close(s->fh);
+ roar_vs_close(s->vss, ROAR_VS_TRUE, NULL);
 
  roar_mm_free(stream);
@@ -205,8 +190,8 @@
 int arts_read(arts_stream_t stream, void *buffer, int count) {
  struct _libroarartsc_stream * s = (struct _libroarartsc_stream *) stream;
- if ( !stream )
-  return -1;
-
- return read(s->fh, buffer, count);
+ if ( stream == NULL )
+  return -1;
+
+ return roar_vs_read(s->vss, buffer, count, NULL);
 }
 
@@ -225,5 +210,5 @@
   return -1;
 
- return write(s->fh, buffer, count);
+ return roar_vs_write(s->vss, buffer, count, NULL);
 }
 
@@ -240,9 +225,9 @@
 int arts_stream_set(arts_stream_t stream, arts_parameter_t param, int value) {
  struct _libroarartsc_stream * s = (struct _libroarartsc_stream *) stream;
- if ( !stream )
+ if ( stream == NULL )
   return -1;
 
  if ( param == ARTS_P_BLOCKING ) {
-  if ( roar_socket_nonblock(s->fh, value ? ROAR_SOCKET_BLOCK : ROAR_SOCKET_NONBLOCK) == -1 )
+  if ( roar_vs_blocking(s->vss, value ? ROAR_VS_TRUE : ROAR_VS_FALSE, NULL) == -1 )
    return -1;
   return arts_stream_get(stream, param);
@@ -262,8 +247,9 @@
 int arts_stream_get(arts_stream_t stream, arts_parameter_t param) {
  struct _libroarartsc_stream * s = (struct _libroarartsc_stream *) stream;
- fd_set sl;
- struct timeval tv;
-
- if ( !stream )
+ struct roar_vio_select vios;
+ struct roar_vio_selecttv rtv;
+ int events;
+
+ if ( stream == NULL )
   return -1;
 
@@ -271,17 +257,13 @@
    return s->block_size;
  } else if ( param == ARTS_P_BUFFER_SPACE ) {
-  FD_ZERO(&sl);
-  FD_SET(s->fh, &sl);
-
-  tv.tv_sec  = 0;
-  tv.tv_usec = 1;
-
-  if ( s->dir == ROAR_DIR_PLAY ) {
-   if (select(s->fh + 1, NULL, &sl, NULL, &tv) > 0)
-    return s->block_size;
-  } else {
-   if (select(s->fh + 1, &sl, NULL, NULL, &tv) > 0)
-    return s->block_size;
-  }
+  rtv.sec    = 0;
+  rtv.nsec   = 1000;
+
+  events     = s->dir == ROAR_DIR_PLAY ? ROAR_VIO_SELECT_WRITE : ROAR_VIO_SELECT_READ;
+
+  ROAR_VIO_SELECT_SETVIO(&vios, roar_vs_vio_obj(s->vss, NULL), events);
+
+  if ( roar_vio_select(&vios, 1, &rtv, NULL) == 1 )
+   return s->block_size;
 
   return 0;
@@ -291,5 +273,5 @@
   return 1;
  } else if ( param == ARTS_P_BLOCKING ) {
-  return s->blocking;
+  return roar_vs_blocking(s->vss, ROAR_VS_ASK, NULL) == ROAR_VS_TRUE ? 1 : 0;
  }
 
Index: libroarsndio/para.c
===================================================================
--- libroarsndio/para.c	(revision 4708)
+++ libroarsndio/para.c	(revision 4891)
@@ -173,5 +173,5 @@
   return 0;
 
- if ( roar_server_oinfo(&(hdl->con), &s) == -1 )
+ if ( roar_server_oinfo2(&(hdl->con), &s, ROAR_DIR_PLAY) == -1 )
   return 0;
 
