Index: roarclients/.cvsignore
===================================================================
--- roarclients/.cvsignore	(revision 5915)
+++ 	(revision )
@@ -1,37 +1,0 @@
-*.exe
-roarcat
-roarcat2sock
-roarcatad
-roarcatsendfile
-roarcatplay
-roarcatpassfh
-roarclientpass
-roarctl
-roarlight
-roarmon
-roarmonhttp
-roarbidir
-roarphone
-roarvumeter
-roarsockconnect
-roartypes
-roarfilt
-roarvorbis
-roarradio
-roarsin
-roar-config
-roarsocktypes
-roarvio
-roarshout
-polytest
-roarfctest
-pgptest
-pinentrytest
-roarcatvio
-zcattest
-pipetest
-roarinterconnect
-roarify
-roardtmf
-roarpluginrunner
-roarpluginapplication
Index: roarclients/.release-helper
===================================================================
--- roarclients/.release-helper	(revision 5413)
+++ 	(revision )
@@ -1,7 +1,0 @@
-#!RELEASE-HELPER:0.0beta0
-@RM roarcatsendfile.c
-@RM roarcat2sock.c
-@RM roarcatad.c
-@RM roarfctest.c
-@RM pinentrytest.c
-#!END
Index: roarclients/Makefile
===================================================================
--- roarclients/Makefile	(revision 5851)
+++ roarclients/Makefile	(revision 0)
@@ -1,118 +1,17 @@
-TARGETS_DEVEL=roartypes roar-config
-TARGETS_EXAMPLE=roarvorbis roarsin
-TARGETS_IO=roarcat roarcatplay roarcatvio roarbidir roarmon roarmonhttp roarradio
-TARGETS_CTL=roarctl roarlight roarinterconnect roarclientpass
-TARGETS_DSP=roarfilt roarvumeter roardtmf
-TARGETS_MISC=roarsockconnect roarphone roarshout
-TARGETS_M=
-TARGETS_VIO=roarvio
-TARGETS_PLUGINS=roarpluginrunner roarpluginapplication
+TARGETS=roarcat roarcatad roarctl roarmon
 
-#TARGETS_TESTS=zcattest pgptest pipetest polytest
-#TARGETS_OLD=roarcatpassfh roarsocktypes
+DEFINES        = -DDEBUG
+INCLUDE = -I../include -I./include
+CFLAGS  = -g -Wall -O2 $(DEFINES) $(INCLUDE)
+LDFLAGS = -g -L../lib/ -lroar
 
-TARGETS=$(TARGETS_IO) $(TARGETS_CTL) $(TARGETS_DSP) $(TARGETS_MISC) $(TARGETS_DEVEL) $(TARGETS_EXAMPLE) $(TARGETS_M) $(TARGETS_VIO) $(TARGETS_PLUGINS)
-
-# tools we maybe want to kick of the package
-TARGETS += $(TARGETS_TESTS) $(TARGETS_OLD)
-
-
-TOOLS=roarify
-
-include ../Makefile.conf
-include ../Makefile.inc
-
-#DEFINES        = -DDEBUG
-INCLUDE    = -I../include -I./include
-CFLAGS    += $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) $(DEFINES) $(INCLUDE) $(INCPATH)
-LDFLAGS   += $(DEBUG_g) $(Wall) -L../lib/ $(LDPATH)
-LIBS       = $(LIBROAR)
-SHOUTLIBS  = $(lib_shout) $(pthread) $(LIBS)
-VORBISLIBS = $(lib_vorbisfile) $(lib_vorbis) $(lib_ogg) $(LIBS)
-
-LNL        = $(CC) $(LDFLAGS) -o $@ $+
-L          = $(LNL) $(LIBS)
-
-all: ${TARGETS} $(TOOLS)
-	cp $(cp_v) ${TARGETS} $(TOOLS) ../lib/
+all: ${TARGETS}
+	cp -v ${TARGETS} ../lib/
 clean:
-	rm -f ${TARGETS} ${TOOLS} *.o
+	rm -f ${TARGETS} *.o
 new: clean all
 
 roarcat: roarcat.o
-	$L
 roarcatad: roarcatad.o
-	$L
-roarcat2sock: roarcat2sock.o
-	$L
-roarcatsendfile: roarcatsendfile.o
-	$L
-roarcatplay: roarcatplay.o
-	$L
-roarcatpassfh: roarcatpassfh.o
-	$L
-roarcatvio: roarcatvio.o
-	$L
-roarradio: roarradio.o
-	$L
 roarctl: roarctl.o
-	$L $(LIBROARDSP) $(lib_m)
 roarmon: roarmon.o
-	$L
-roarmonhttp: roarmonhttp.o
-	$L
-roarinterconnect: roarinterconnect.o
-	$L $(lib_esd) $(LIBROAREIO) $(lib_rsound)
-roarclientpass: roarclientpass.o
-	$L
-roarbidir: roarbidir.o
-	$L
-roarphone: roarphone.o
-	${CC} ${LDFLAGS} -o roarphone roarphone.o $(LIBROARDSP) $(LIBROAREIO) $(LIBS)
-roarfilt: roarfilt.o
-	${CC} ${LDFLAGS} -o roarfilt roarfilt.o $(LIBROARDSP) $(LIBS) $(lib_m)
-roarsin: roarsin.o
-	${CC} ${LDFLAGS} -o roarsin roarsin.o $(LIBROARDSP) $(LIBS) $(lib_m)
-roarvumeter: roarvumeter.o
-	${CC} ${LDFLAGS} -o roarvumeter roarvumeter.o $(LIBS) $(LIBROARDSP) $(lib_m)
-roardtmf: roardtmf.o
-	${CC} ${LDFLAGS} -o roardtmf roardtmf.o $(LIBS) $(LIBROARDSP)
-roarsockconnect: roarsockconnect.o
-	$L
-roarvio: roarvio.o
-	$L
-roarpluginrunner: roarpluginrunner.o
-	$L $(lib_dl)
-roartypes: roartypes.o
-	$L
-roarsocktypes: roarsocktypes.o
-	$L
-roar-config: roar-config.o
-	$(LNL) ../lib/libroar.a $(LIBROAR_NS)
-roarvorbis: roarvorbis.o
-	${CC} ${LDFLAGS} -o roarvorbis roarvorbis.o $(VORBISLIBS) $(LIBS)
-roarshout: roarshout.o
-	${CC} ${LDFLAGS} -o roarshout roarshout.o $(SHOUTLIBS) $(LIBS)
-polytest: polytest.o
-	${CC} ${LDFLAGS} -o polytest polytest.o $(LIBROARDSP) $(LIBS)
-roarlight: roarlight.o
-	${CC} ${LDFLAGS} -o roarlight roarlight.o $(LIBROARLIGHT) $(LIBS)
-pinentrytest: pinentrytest.o
-	$L
-zcattest: zcattest.o
-	$L
-pgptest: pgptest.o
-	$L
-pipetest: pipetest.o
-	$L
-roarfctest: roarfctest.o
-	${CC} ${LDFLAGS} -o roarfctest roarfctest.o $(LIBROARDSP) $(LIBS) $(lib_m)
-
-roarify.sht:
-roarify: roarify.sht
-	sed 's#%%%PREFIX_COMP_LIBS%%%#$(PREFIX_COMP_LIBS)#g; s#%%%PREFIX_COMP_BINS%%%#$(PREFIX_COMP_BINS)#g; s#%%%PREFIX_LIB%%%#$(PREFIX_LIB)#g; s#%%%VERSION%%%#$(COMMON_SOVERSION)#g;' < roarify.sht > roarify
-	chmod +rx roarify
-roarpluginapplication.sht:
-roarpluginapplication: roarpluginapplication.sht
-	cp roarpluginapplication.sht roarpluginapplication
-	chmod +rx roarpluginapplication
Index: roarclients/pgptest.c
===================================================================
--- roarclients/pgptest.c	(revision 6052)
+++ 	(revision )
@@ -1,71 +1,0 @@
-//pgptest.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUF_MAX 1024
-#define FILENAME "/tmp/bla.asc"
-#define PASSWORD "test"
-#define STRING   "Hello world!\n"
-
-int main (void) {
- char buf[BUF_MAX];
- size_t len;
- struct roar_vio_calls file, pgp;
-
- if ( roar_vio_open_file(&file, FILENAME, O_CREAT|O_TRUNC|O_WRONLY, 0666) == -1 ) {
-  ROAR_ERR("roar_vio_open_file(&file, FILENAME, O_CREAT|O_TRUNC|O_WRONLY, 0666) = -1");
-  return 1;
- }
-
- if ( roar_vio_open_pgp_encrypt_sym(&pgp, &file, PASSWORD, ROAR_VIO_PGP_OPTS_ASCII) == -1 ) {
-  ROAR_ERR("roar_vio_open_pgp_encrypt_sym(&pgp, &file, PASSWORD, ROAR_VIO_PGP_OPTS_ASCII) = -1");
-  return 1;
- }
-
- roar_vio_write(&pgp, STRING, strlen(STRING));
-
- roar_vio_close(&pgp);
-
-
- if ( roar_vio_open_file(&file, FILENAME, O_RDONLY, 0666) == -1 ) {
-  ROAR_ERR("roar_vio_open_file(&file, FILENAME, O_RDONLY, 0666) = -1");
-  return 1;
- }
-
- if ( roar_vio_open_pgp_decrypt(&pgp, &file, PASSWORD) == -1 ) {
-  ROAR_ERR("roar_vio_open_pgp_decrypt(&pgp, &file, PASSWORD) = -1");
-  return 1;
- }
-
- while ((len = roar_vio_read(&pgp, buf, BUF_MAX)))
-  write(ROAR_STDOUT, buf, len);
-
- roar_vio_close(&pgp);
-
- return 0;
-}
-
-//ll
Index: roarclients/pinentrytest.c
===================================================================
--- roarclients/pinentrytest.c	(revision 6052)
+++ 	(revision )
@@ -1,42 +1,0 @@
-//pinentrytest.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUF_MAX 1024
-
-int main (void) {
- char * pw;
- struct roar_pinentry pe[1];
-
- roar_pinentry_simple_open(pe);
- printf("roar_pinentry_getpin(%p, ['%s'], 'desc', 'prompt:') = %i\n", pe, pw, roar_pinentry_getpin(pe, &pw, "desc", "prompt:"));
- printf("roar_pinentry_confirm(%p, 'desc', 'Jo!', 'ne...') = %i\n", pe, roar_pinentry_confirm(pe, "desc", "Jo!", "ne..."));
- roar_pinentry_close(pe);
-
- return 0;
-}
-
-//ll
Index: roarclients/pipetest.c
===================================================================
--- roarclients/pipetest.c	(revision 6052)
+++ 	(revision )
@@ -1,70 +1,0 @@
-//pipetest.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <unistd.h>
-
-#define BUF_MAX 1024
-
-int main (void) {
-#ifdef ROAR_HAVE_FORK
- char buf[BUF_MAX];
- struct roar_vio_calls s0, s1;
- struct roar_vio_calls * me;
-
- if ( roar_vio_open_pipe(&s0, &s1, ROAR_VIO_PIPE_TYPE_AUTO, O_RDWR) == -1 ) {
-  fprintf(stderr, "Error: can not create pipe\n");
- }
-
- switch (fork()) {
-  case 0:
-    me = &s0;
-    roar_vio_close(&s1);
-   break;
-  default:
-    me = &s1;
-    roar_vio_close(&s0);
- }
-
- snprintf(buf, BUF_MAX, "Hello from pid %i\n", getpid());
- roar_vio_write(me, buf, strlen(buf));
-
- buf[0] = 0;
-
- roar_vio_read(me, buf, BUF_MAX);
- printf("This is pid %i: %s", getpid(), buf);
-
- roar_vio_close(me);
-
- roar_sleep(1); // wait for the other child...
-
- return 0;
-#else
- fprintf(stderr, "Error: no fork() support!\n");
- return 1;
-#endif
-}
-
-//ll
Index: roarclients/polytest.c
===================================================================
--- roarclients/polytest.c	(revision 6052)
+++ 	(revision )
@@ -1,52 +1,0 @@
-//polytest.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <libroardsp/libroardsp.h>
-
-#define BUF_MAX 1024
-
-int main (void) {
- int16_t  in[BUF_MAX];
- int16_t out[BUF_MAX];
- size_t il = 10;
- size_t ol = 20;
- size_t i;
- int tmp;
-
- for (i = 0; i < il; i++) {
-  scanf("%i", &tmp);
-  in[i] = tmp;
- }
-
- roar_conv_poly4_16(out, in, ol, il);
-
- for (i = 0; i < ol; i++)
-  printf("%i\n", out[i]);
-
- return 0;
-}
-
-//ll
Index: roarclients/roar-config.c
===================================================================
--- roarclients/roar-config.c	(revision 6067)
+++ 	(revision )
@@ -1,343 +1,0 @@
-//roar-config.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-static const struct {
- const char * name;
- const char * cflags;
- const char * libs;
-} flags[] = {
- // native/own libs:
- {"roar",      ROAR_CFLAGS, ROAR_LIBS        }, // NOTE: libroar *MUST* be the first entry
- {"roardsp",   ROAR_CFLAGS, ROAR_LIBS_DSP    },
- {"roarmidi",  ROAR_CFLAGS, ROAR_LIBS_MIDI   },
- {"roarlight", ROAR_CFLAGS, ROAR_LIBS_LIGHT  },
- {"roareio",   ROAR_CFLAGS, ROAR_LIBS_EIO    },
- // comp libs:
- {"roaresd",   ROAR_CFLAGS, ROAR_LIBS_C_ESD  },
- {"esd",       ROAR_CFLAGS, ROAR_LIBS_C_ESD  },
- {"roarartsc", ROAR_CFLAGS, ROAR_LIBS_C_ARTSC},
- {"artsc",     ROAR_CFLAGS, ROAR_LIBS_C_ARTSC},
- {"roarpulse", ROAR_CFLAGS, ROAR_LIBS_C_PULSE},
- {"pulse",     ROAR_CFLAGS, ROAR_LIBS_C_PULSE},
- {"roarpulse-simple", ROAR_CFLAGS, ROAR_LIBS_C_PULSE_SIMPLE},
- {"pulse-simple",     ROAR_CFLAGS, ROAR_LIBS_C_PULSE_SIMPLE},
- {"roarsndio", ROAR_CFLAGS, ROAR_LIBS_C_SNDIO},
- {"sndio",     ROAR_CFLAGS, ROAR_LIBS_C_SNDIO},
- {"roaryiff",  ROAR_CFLAGS, ROAR_LIBS_C_YIFF },
- {"Y2",        ROAR_CFLAGS, ROAR_LIBS_C_YIFF },
- {NULL, NULL, NULL}
-}, * flags_ptr = NULL;
-
-struct version {
- int major, minor, revision;
-};
-
-static struct version parse_version(const char * version) {
- struct version ret = {-1, -1, -1};
- char * next;
-
- if ( !strcasecmp(version, "current") )
-  version = ROAR_VERSION_COMMON;
-
- ret.major    = strtoll(version, &next, 0);
- ret.minor    = strtoll(next+1, &next, 0);
- ret.revision = strtoll(next+1, &next, 0);
-
- return ret;
-}
-
-static int compare_versions_eq(struct version a, struct version b) {
- return a.major == b.major && a.minor == b.minor && a.revision == b.revision;
-}
-
-static int compare_versions_gt(struct version a, struct version b) {
- if ( a.major > b.major )
-  return 1;
- if ( a.minor > b.minor )
-  return 1;
- if ( a.revision > b.revision )
-  return 1;
- return 0;
-}
-
-static int compare_versions_ge(struct version a, struct version b) {
- return compare_versions_gt(a, b) || compare_versions_eq(a, b);
-}
-
-static int compare_versions_lt(struct version a, struct version b) {
- return compare_versions_gt(b, a);
-}
-
-static int compare_versions_le(struct version a, struct version b) {
- return compare_versions_lt(a, b) || compare_versions_eq(a, b);
-}
-
-static const struct {
- const char * op;
- int neg;
- int (*func)(struct version a, struct version b);
-} compare_versions_funcs[] = {
- {"eq", 0, compare_versions_eq},
- {"ne", 1, compare_versions_eq},
- {"gt", 0, compare_versions_gt},
- {"ge", 0, compare_versions_ge},
- {"lt", 0, compare_versions_lt},
- {"le", 0, compare_versions_le}
-};
-
-static int compare_versions(const char * a, const char * op, const char * b) {
- struct version va = parse_version(a);
- struct version vb = parse_version(b);
- size_t i;
- int ret;
-
- ROAR_DBG("compare_versions(a='%s', op='%s', b='%s'): {%i, %i, %i} <%s> {%i, %i, %i}\n", a, op, b, va.major, va.minor, va.revision, op, vb.major, vb.minor, vb.revision);
-
- for (i = 0; i < (sizeof(compare_versions_funcs)/sizeof(*compare_versions_funcs)); i++) {
-  if ( !strcasecmp(compare_versions_funcs[i].op, op) ) {
-   ret = compare_versions_funcs[i].func(va, vb);
-   if ( compare_versions_funcs[i].neg )
-    ret = ret ? 0 : 1;
-
-   return ret ? 0 : 32;
-  }
- }
-
- ROAR_ERR("compare_versions(*): Operator \"%s\" not found.", op);
- return 1;
-}
-
-void print_path(const char * name, int null_as_universal, const char * product, const char * provider) {
- char * path = roar_libroar_get_path(name, null_as_universal, product, provider);
- if ( path == NULL ) {
-  fprintf(stderr, "Error: Can not get path: %s: %s\n", name, roar_errorstring);
-  return;
- }
- printf("%s\n", path);
- roar_mm_free(path);
-}
-
-void list_path(int null_as_universal, const char * product, const char * provider) {
- const char * names[32];
- char * path;
- size_t offset = 0;
- ssize_t ret;
- ssize_t i;
- const char * err;
- size_t errlen;
-
- while (1) {
-  ret = roar_libroar_list_path(names, sizeof(names)/sizeof(*names), offset);
-  if ( ret < 1 )
-   break;
-  offset += (size_t)ret;
-
-  for (i = 0; i < ret; i++) {
-   path = roar_libroar_get_path(names[i], null_as_universal, product, provider);
-   if ( path == NULL && roar_error == ROAR_ERROR_INVAL )
-    path = roar_libroar_get_path(names[i], 0, product, NULL);
-   if ( path == NULL && roar_error == ROAR_ERROR_INVAL )
-    path = roar_libroar_get_path(names[i], 0, NULL, NULL);
-   if ( path == NULL ) {
-    err = roar_errorstring;
-    errlen = roar_mm_strlen(err) + roar_mm_strlen("<Error: >") + 1;
-    path = roar_mm_malloc(errlen);
-    if ( path == NULL )
-     continue;
-    snprintf(path, errlen, "<Error: %s>", err);
-   }
-
-   printf("%-24s: %s\n", names[i], path);
-   roar_mm_free(path);
-  }
- }
-}
-
-void print_renderpath(const char * path) {
- char buf[1024];
-
- if ( roar_env_render_path_r(buf, sizeof(buf), path) != 0 ) {
-  fprintf(stderr, "Error: Can not render path: %s: %s\n", path, roar_errorstring);
-  return;
- }
- printf("%s\n", buf);
-}
-
-void usage (void) {
- printf("Usage: roar-config --version\n"
-        "       roar-config --compare-versions VERSIONA OPERATOR VERSIONB\n"
-        "       roar-config [{--output-pc|--output-normal}] [--libs] [--cflags] [LIB]\n"
-        "       roar-config [--product PRODUCT] [--provider PROVIDER] [--universal] {--path PATH|--list-path}\n"
-        "       roar-config --render-path PATH\n");
-
- printf("\nOptions:\n\n");
-
- printf("  --help              - Show this help\n"
-        "  --version           - Show version of library\n"
-        "  --compare-versions A OP B\n"
-        "                      - Compare version A against B with operator OP.\n"
-        "  --path NAME         - Print path NAME\n"
-        "  --list-path         - Print all known paths\n"
-        "  --product PRODUCT   - Product string for --path/--list-path\n"
-        "  --provider PROVIDER - Provider string for --path/--list-path\n"
-        "  --universal         - Use universal path for --path/--list-path\n"
-        "  --render-path PATH  - Print a rendered path\n"
-        "  --libs              - Show linker flags (-lxxx) needed to link library\n"
-        "  --cflags            - Show compiler flags needed to link library\n"
-        "  --output-pc         - Output PC format\n"
-        "  --output-normal     - Output in \"classical\" format\n"
-       );
-
-}
-
-#define _strcat(buf, n) strncat(buf, n, sizeof(buf)-1-strlen(buf))
-
-int main (int argc, char * argv[]) {
- enum { NORMAL, PC } mode = NORMAL;
- int null_as_universal = 0;
- const char * product = NULL;
- const char * provider = NULL;
- char * path;
- int i, h;
- int cflags = 0;
- int libs   = 0;
- char buf[1024] = {0};
-
- if ( argc == 1 ) {
-  usage();
-  return 0;
- }
-
- for (i = 1; i < argc; i++) {
-  if ( !strcmp(argv[i], "--version") ) {
-   printf("%s\n", ROAR_VERSION_COMMON);
-  } else if ( !strcmp(argv[i], "--help") || !strcmp(argv[i], "-h") ) {
-   usage();
-   return 0;
-  } else if ( !strcmp(argv[i], "--compare-versions") ) {
-   return compare_versions(argv[i+1], argv[i+2], argv[i+3]);
-  } else if ( !strcmp(argv[i], "--product") ) {
-   product = argv[++i];
-  } else if ( !strcmp(argv[i], "--provider") ) {
-   provider = argv[++i];
-  } else if ( !strcmp(argv[i], "--universal") ) {
-   null_as_universal = 1;
-  } else if ( !strcmp(argv[i], "--path") ) {
-   print_path(argv[++i], null_as_universal, product, provider);
-  } else if ( !strcmp(argv[i], "--list-path") ) {
-   list_path(null_as_universal, product, provider);
-  } else if ( !strcmp(argv[i], "--render-path") ) {
-   print_renderpath(argv[++i]);
-  } else if ( !strcmp(argv[i], "--libs") ) {
-   libs   = 1;
-  } else if ( !strcmp(argv[i], "--cflags") ) {
-   cflags = 1;
-  } else if ( !strcmp(argv[i], "--output-normal") ) {
-   mode = NORMAL;
-  } else if ( !strcmp(argv[i], "--output-pc") ) {
-   mode = PC;
-  } else if ( flags_ptr == NULL ) {
-   if ( !strncmp(argv[i], "lib", 3) )
-    argv[i] += 3;
-
-   for (h = 0; flags[h].name != NULL; h++) {
-    if ( !strcasecmp(argv[i], flags[h].name) )
-     flags_ptr = &(flags[h]);
-   }
-
-   if ( flags_ptr == NULL ) {
-    fprintf(stderr, "Unknown lib: %s\n", argv[i]);
-    return 2;
-   }
-  } else {
-   fprintf(stderr, "Unknown option: %s\n", argv[i]);
-   usage();
-   return 1;
-  }
- }
-
- if ( flags_ptr == NULL )
-  flags_ptr = &(flags[0]);
-
- switch (mode) {
-  case NORMAL:
-    if ( cflags || libs ) {
-     if ( cflags ) {
-      path = roar_libroar_get_path("prefix-inc", null_as_universal, product, provider);
-      if (path != NULL) {
-       _strcat(buf, "-I");
-       _strcat(buf, path);
-       _strcat(buf, " ");
-       roar_mm_free(path);
-      }
-      _strcat(buf, flags_ptr->cflags);
-     }
-
-     if ( libs ) {
-      path = roar_libroar_get_path("prefix-lib", null_as_universal, product, provider);
-      if (path != NULL) {
-       _strcat(buf, "-L");
-       _strcat(buf, path);
-       _strcat(buf, " ");
-       roar_mm_free(path);
-      }
-      _strcat(buf, flags_ptr->libs);
-     }
-
-     puts(buf);
-    }
-   break;
-  case PC:
-    printf("prefix=");
-    print_path("prefix", 0, NULL, NULL);
-    printf("exec_prefix=${prefix}\n");
-    printf("libdir=");
-    print_path("prefix-lib", 0, NULL, NULL);
-    printf("includedir=");
-    print_path("prefix-inc", 0, NULL, NULL);
-    printf("\n");
-    printf(
-           "Name: lib%s\n"
-           "Description: lib%s is part of RoarAudio Sound System\n"
-           "Version: %s\n"
-//           "Requires: libroar\n"
-           "Conflicts:\n"
-           "Libs: -L${libdir} %s\n"
-           "Cflags: -I${includedir} %s\n",
-           flags_ptr->name,
-           flags_ptr->name,
-           ROAR_VERSION_COMMON,
-           flags_ptr->libs,
-           flags_ptr->cflags
-          );
-   break;
- }
-
- return 0;
-}
-
-//ll
Index: roarclients/roarbidir.c
===================================================================
--- roarclients/roarbidir.c	(revision 6052)
+++ 	(revision )
@@ -1,156 +1,0 @@
-//roarbidir.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarbidir [OPTIONS]... [IN_FILE]\n");
-
- printf("\nOptions:\n\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"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- struct roar_audio_info info;
- const char * server   = NULL;
- const char * k;
- int    i;
- struct roar_vio_defaults  def;
- struct roar_vio_calls in_store;
- struct roar_vio_calls * in = NULL, * out = NULL;
- struct roar_vio_calls * vss_vio = NULL;
- roar_vs_t * vss;
- struct roar_vio_select vios[2];
- char buf[BUFSIZE];
- int err;
- 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;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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();
-   return 0;
-  } else if ( in == NULL ) {
-   if ( roar_vio_open_dstr(&in_store, k, &def, 1) == -1 ) {
-    fprintf(stderr, "Error: can not open file: %s: %s\n", k, roar_error2str(roar_error));
-    return 1;
-   }
-   in = &in_store;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- 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 )
-   roar_vio_close(in);
-  return 1;
- }
-
- if ( in  == NULL )
-  in  = roar_stdin;
- if ( out == NULL )
-  out = roar_stdout;
-
- vss_vio = roar_vs_vio_obj(vss, NULL);
-
- while (1) {
-  memset(vios, 0, sizeof(vios));
-
-  ROAR_VIO_SELECT_SETVIO(&(vios[0]), vss_vio, ROAR_VIO_SELECT_READ);
-  ROAR_VIO_SELECT_SETVIO(&(vios[1]), in, ROAR_VIO_SELECT_READ);
-
-  if ( (ret = roar_vio_select(vios, 2, NULL, NULL)) == -1 )
-   break;
-
-  if ( ret < 0 )
-   continue;
-
-  if ( vios[0].eventsa & ROAR_VIO_SELECT_READ ) {
-   if ( (ret = roar_vs_read(vss, buf, sizeof(buf), NULL)) == -1 )
-    break;
-   if ( roar_vio_write(out, buf, ret) != ret )
-    break;
-  }
-  if ( vios[1].eventsa & ROAR_VIO_SELECT_READ ) {
-   if ( (ret = roar_vio_read(in, buf, sizeof(buf))) == -1 )
-    break;
-   if ( roar_vs_write(vss, buf, ret, NULL) != ret )
-    break;
-  }
- }
-
- roar_vs_close(vss, ROAR_VS_TRUE, NULL);
-
- roar_vio_close(in);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarcat.c
===================================================================
--- roarclients/roarcat.c	(revision 6052)
+++ roarclients/roarcat.c	(revision 0)
@@ -1,26 +1,3 @@
 //roarcat.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
 
 #include <roaraudio.h>
@@ -29,23 +6,13 @@
 
 void usage (void) {
- printf("roarcat [OPTIONS]... [FILE]\n");
+ printf("roarcat [OPTIONS]...\n");
 
  printf("\nOptions:\n\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"
-        "  --wave                - Use Wave Audio (PCM) as input\n"
-        "  --midi                - Use MIDI Audio as input\n"
-        "  --light               - Use light control input\n"
-        "  --raw                 - Use raw input\n"
-        "  --complex             - Use complex input\n"
-        "  --rdtcs               - Use Radio Data and Transmitter Control System input\n"
-        "  --rel-id ID           - Set ID of relative stream\n"
-        "  --role ROLE           - Set stream role\n"
-        "  --help                - Show this help\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"
        );
 
@@ -53,93 +20,28 @@
 
 int main (int argc, char * argv[]) {
- 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_PLAY;
- int    rel_id   = -1;
- int    role     = ROAR_ROLE_UNKNOWN;
- const char * server   = NULL;
- const char * k;
+ int    rate     = 44100;
+ int    bits     = 16;
+ int    channels = 2;
+ int    codec    = ROAR_CODEC_DEFAULT;
+ char * server   = NULL;
+ char * k;
+ int    fh;
  int    i;
- const char * name = "roarcat";
- struct roar_connection    con;
- struct roar_stream        s;
- struct roar_vio_calls     file, * stream;
- struct roar_vio_defaults  def;
- int file_opened = 0;
-
- // TODO: make use of roar_stdin.
- if ( roar_vio_open_fh(&file, ROAR_STDIN) == -1 )
-  return 1;
-
- if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 )
-  return 1;
+ char buf[BUFSIZE];
 
  for (i = 1; i < argc; i++) {
   k = argv[i];
 
-  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( !strcmp(k, "-n") ) {
-   ROAR_CKHAVEARGS(1);
-   name = argv[++i];
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( !strcmp(k, "-b") ) {
-   info.bits = 8;
-  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( !strcmp(k, "-m") ) {
-   info.channels = 1;
-  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
-   ROAR_CKHAVEARGS(1);
-   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") ) {
-   ROAR_CKHAVEARGS(1);
-   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") ) {
-   dir   = ROAR_DIR_PLAY;
-  } else if ( !strcmp(k, "--midi") ) {
-   dir   = ROAR_DIR_MIDI_IN;
-  } else if ( !strcmp(k, "--light") ) {
-   dir   = ROAR_DIR_LIGHT_IN;
-  } else if ( !strcmp(k, "--raw") ) {
-   dir   = ROAR_DIR_RAW_IN;
-  } else if ( !strcmp(k, "--complex") ) {
-   dir   = ROAR_DIR_COMPLEX_IN;
-  } else if ( !strcmp(k, "--rdtcs") ) {
-   dir   = ROAR_DIR_RDTCS_IN;
-
-  } else if ( !strcmp(k, "--rel-id") ) {
-   ROAR_CKHAVEARGS(1);
-   rel_id = atoi(argv[++i]);
-  } else if ( !strcmp(k, "--role") ) {
-   ROAR_CKHAVEARGS(1);
-   role = roar_str2role(argv[++i]);
-
-  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) {
+  if ( strcmp(k, "--server") == 0 ) {
+   server = k;
+  } else if ( strcmp(k, "--rate") == 0 ) {
+   rate = atoi(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 ) {
+   bits = atoi(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
+   channels = atoi(argv[++i]);
+  } else if ( strcmp(k, "--help") == 0 ) {
    usage();
    return 0;
-  } else if ( !file_opened ) {
-   file_opened = 1;
-   if ( roar_vio_open_dstr(&file, k, &def, 1) == -1 ) {
-    fprintf(stderr, "Error: can not open file: %s: %s\n", k, roar_error2str(roar_error));
-    return 1;
-   }
   } else {
    fprintf(stderr, "Error: unknown argument: %s\n", k);
@@ -149,96 +51,14 @@
  }
 
- switch (dir) {
-  case ROAR_DIR_PLAY:
-    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_IN:
-    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_IN:
-    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_IN:
-    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_IN:
-    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_IN:
-  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;
+ if ( (fh = roar_simple_play(rate, channels, bits, codec, server, "roarcat")) == -1 ) {
+  fprintf(stderr, "Error: can not start playback\n");
+  return 1;
  }
 
- if ( roar_simple_connect(&con, server, name) == -1 ) {
-  fprintf(stderr, "Error: can not connect to server: %s\n", roar_error2str(roar_error));
-  return 10;
- }
+ while((i = read(0, buf, BUFSIZE)))
+  if (write(fh, buf, i) != i)
+   break;
 
- if ( roar_stream_new_by_info(&s, &info) == -1 ) {
-  fprintf(stderr, "Error: can not create stream\n");
-  roar_disconnect(&con);
-  return 20;
- }
-
- if ( rel_id != -1 ) {
-  if ( roar_stream_set_rel_id(&s, rel_id) ) {
-   fprintf(stderr, "Error: can not set id or realative stream\n");
-   roar_disconnect(&con);
-   return 21;
-  }
- }
-
- if ( roar_stream_connect(&con, &s, dir, -1) == -1 ) {
-  fprintf(stderr, "Error: can not connect stream to server\n");
-  roar_disconnect(&con);
-  return 11;
- }
-
- if ( role != ROAR_ROLE_UNKNOWN ) {
-  if ( roar_stream_set_role(&con, &s, role) == -1 ) {
-   fprintf(stderr, "Warning: can not set stream role\n");
-  }
- }
-
- if ( roar_stream_exec(&con, &s) == -1 ) {
-  fprintf(stderr, "Error: can not exec stream\n");
-  roar_disconnect(&con);
-  return 12;
- }
-
- if ( (stream = roar_get_connection_vio2(&con)) == NULL ) {
-  fprintf(stderr, "Error: can not get stream vio\n");
-  roar_disconnect(&con);
-  return 13;
- }
-
- if ( roar_vio_copy_data(stream, &file) == -1 ) {
-  fprintf(stderr, "Error: can not copy data from source to server.\n");
-  roar_vio_close(stream);
-  roar_vio_close(&file);
-  return 14;
- }
-
- roar_vio_close(stream);
- roar_vio_close(&file);
+ roar_simple_close(fh);
 
  return 0;
Index: roarclients/roarcat2sock.c
===================================================================
--- roarclients/roarcat2sock.c	(revision 6052)
+++ 	(revision )
@@ -1,100 +1,0 @@
-//roarcat2sock.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarcat2sock [OPTIONS]...\n");
-
- 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"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_DEFAULT;
- const char * server   = NULL;
- const char * k;
- int    i;
- int    fh;
- char buf[BUFSIZE];
- struct roar_connection con;
-
-
- roar_debug_bin_obsolete(argv[0], "roarcat", NULL);
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = atoi(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = atoi(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 ) {
-   channels = atoi(argv[++i]);
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( roar_simple_connect(&con, server, "roarcat2sock") == -1 ) {
-  ROAR_DBG("roar_simple_play(*): roar_simple_connect() faild!");
-  return 1;
- }
-
- if ( (fh = roar_simple_new_stream(&con, rate, channels, bits, codec, ROAR_DIR_PLAY)) == -1 ) {
-  roar_disconnect(&con);
-  return 1;
- }
-
- while((i = read(0, buf, BUFSIZE)))
-  write(fh, buf, i);
-
- close(fh);
-
- roar_disconnect(&con);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarcatad.c
===================================================================
--- roarclients/roarcatad.c	(revision 6052)
+++ roarclients/roarcatad.c	(revision 0)
@@ -1,33 +1,10 @@
 //roarcatad.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
 
 #include <roaraudio.h>
 
-#define BUFSIZE (1024*2)
+#define BUFSIZE 1024
 
 void usage (void) {
- printf("roarcatad [OPTIONS]...\n");
+ printf("roarcat [OPTIONS]...\n");
 
  printf("\nOptions:\n\n");
@@ -47,14 +24,11 @@
  int    channels = 2;
  int    codec    = ROAR_CODEC_DEFAULT;
- const char * server   = NULL;
- const char * k;
+ char * server   = NULL;
+ char * k;
  int    i;
  char buf[BUFSIZE];
  struct roar_connection con;
  struct roar_stream     s;
- struct roar_stream_info info;
 
-
- roar_debug_bin_obsolete(argv[0], "roarcat", NULL);
 
  for (i = 1; i < argc; i++) {
@@ -62,5 +36,5 @@
 
   if ( strcmp(k, "--server") == 0 ) {
-   server = argv[++i];
+   server = k;
   } else if ( strcmp(k, "--rate") == 0 ) {
    rate = atoi(argv[++i]);
@@ -81,25 +55,18 @@
  if ( roar_simple_connect(&con, server, "roarcatad") == -1 ) {
   ROAR_DBG("roar_simple_play(*): roar_simple_connect() faild!");
-  return 1;
+  return -1;
  }
 
  if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) {
   roar_disconnect(&con);
-  return 1;
+  return -1;
  }
 
- if ( roar_stream_connect(&con, &s, ROAR_DIR_PLAY, -1) == -1 ) {
+ if ( roar_stream_connect(&con, &s, ROAR_DIR_PLAY) == -1 ) {
   roar_disconnect(&con);
-  return 1;
+  return -1;
  }
 
- info.block_size = BUFSIZE;
-
- roar_stream_get_info(&con, &s, &info);
-
- if ( info.block_size > BUFSIZE )
-  info.block_size = BUFSIZE;
-
- while((i = read(0, buf, info.block_size)))
+ while((i = read(0, buf, BUFSIZE)))
   if (roar_stream_add_data(&con, &s, buf, i) == -1)
    break;
Index: roarclients/roarcatpassfh.c
===================================================================
--- roarclients/roarcatpassfh.c	(revision 6052)
+++ 	(revision )
@@ -1,112 +1,0 @@
-//roarcatpassfh.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUFSIZE (1024*2)
-
-void usage (void) {
- printf("roarcatpassfh [OPTIONS]...\n");
-
- 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"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_DEFAULT;
- char * server   = NULL;
- char * k;
- int    i;
- int    in = ROAR_STDIN;
- struct roar_connection con;
- struct roar_stream     s;
-
-
- roar_debug_bin_obsolete(argv[0], "roarcat", NULL);
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = atoi(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = atoi(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
-   channels = atoi(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 ) {
-   codec = roar_str2codec(argv[++i]);
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( roar_simple_connect(&con, server, "roarcatpassfh") == -1 ) {
-  ROAR_DBG("roar_simple_play(*): roar_simple_connect() faild!");
-  return 1;
- }
-
- if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) {
-  roar_disconnect(&con);
-  return 1;
- }
-
- if ( roar_stream_connect(&con, &s, ROAR_DIR_PLAY, -1) == -1 ) {
-  roar_disconnect(&con);
-  return 1;
- }
-
- if ( roar_stream_passfh(&con, &s, in) == -1 ) {
-  roar_disconnect(&con);
-  return 1;
- }
-
- close(in);
-
- roar_sleep(1000);
-
- roar_disconnect(&con);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarcatplay.c
===================================================================
--- roarclients/roarcatplay.c	(revision 6052)
+++ 	(revision )
@@ -1,144 +1,0 @@
-//roarcatplay.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarcatplay [OPTIONS]... [FILE]\n");
-
- printf("\nOptions:\n\n");
-
- printf("  --server SERVER       - Set server hostname\n"
-        "  --simple              - Use the simple interface (default)\n"
-        "  --verbose             - Use verbose output\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"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- 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;
- const char * server   = NULL;
- const char * file     = NULL;
- const char * k;
- int    i;
- int    verbose = 0;
- roar_vs_t * vss;
- int err;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 || strcmp(k, "-s") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--simple") == 0 ) {
-   /* no op */
-  } else if ( strcmp(k, "--verbose") == 0 || strcmp(k, "-v") == 0 ) {
-   verbose++;
-  } else if ( strcmp(k, "-n") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   i++;
-   roar_debug_option_obsolete(argv[0], "-n", NULL, "Will ignore it for now.");
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-R") ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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") == 0 || strcmp(k, "-h") == 0 ) {
-   usage();
-   return 0;
-  } else if ( file == NULL ) {
-   file = argv[i];
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( file == NULL )
-  file = "fh:stdin";
-
- if ( info.codec == ROAR_AUDIO_INFO_INVALID )
-  info.codec = ROAR_CODEC_DEFAULT;
-
- if ( (vss = roar_vs_new(server, "roarcatplay", &err)) == NULL ) {
-  fprintf(stderr, "Error: can not connect to server: %s: %s\n",
-   server == NULL ? "(default)" : server, roar_error2str(err));
-  return 10;
- }
-
- if ( auinfo_changed ) {
-  if ( roar_vs_stream(vss, &info, ROAR_DIR_PLAY, &err) == -1 ) {
-   fprintf(stderr, "Error: can not create new stream: %s\n", roar_error2str(err));
-   roar_vs_close(vss, ROAR_VS_TRUE, NULL);
-   return 10;
-  }
- }
-
- if ( roar_vs_file_simple(vss, file, &err) == -1 ) {
-  fprintf(stderr, "Error: can not open file: %s: %s\n", file, roar_error2str(err));
-  roar_vs_close(vss, ROAR_VS_TRUE, NULL);
-  return 10;
- }
-
- roar_vs_run(vss, NULL);
- roar_vs_sync(vss, ROAR_VS_WAIT, NULL);
- roar_vs_close(vss, ROAR_VS_FALSE, NULL);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarcatsendfile.c
===================================================================
--- roarclients/roarcatsendfile.c	(revision 6052)
+++ 	(revision )
@@ -1,103 +1,0 @@
-//roarcatsendfile.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarcatsendfile [OPTIONS]... [FILE]\n");
-
- 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"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- int    rate     = 44100;
- int    bits     = 16;
- int    channels = 2;
- int    codec    = ROAR_CODEC_DEFAULT;
- const char * server   = NULL;
- const char * k;
- int    fh;
- int    i;
- int    in = -1;
-
- roar_debug_bin_obsolete(argv[0], "roarcat", NULL);
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 ) {
-   rate = atoi(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 ) {
-   bits = atoi(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) {
-   channels = atoi(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 ) {
-   codec = atoi(argv[++i]);
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else if ( in == -1 ) {
-   if ( (in = open(k, O_RDONLY, 0644)) == -1 ) {
-    fprintf(stderr, "Error: can not open file: %s: %s\n", k, strerror(errno));
-    return 1;
-   }
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( (fh = roar_simple_play(rate, channels, bits, codec, server, "roarcatsendfile")) == -1 ) {
-  fprintf(stderr, "Error: can not start playback\n");
-  return 1;
- }
-
- if ( in == -1 )
-  in = ROAR_STDIN;
-
- roar_file_send_raw(fh, in);
-
- roar_simple_close(fh);
-
- close(in);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarcatvio.c
===================================================================
--- roarclients/roarcatvio.c	(revision 6052)
+++ 	(revision )
@@ -1,136 +1,0 @@
-//roarcatvio.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarcatvio [OPTIONS]... [FILE]\n");
-
- printf("\nOptions:\n\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"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- 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;
- const char * server   = NULL;
- const char * k;
- int    i;
- const char * name = "roarcatvio";
- roar_vs_t * vss;
- const char * filename = NULL;
- int err;
-
- roar_debug_bin_obsolete(argv[0], "roarcatplay", NULL);
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
-   server = argv[++i];
-  } else if ( !strcmp(k, "-n") ) {
-   name = argv[++i];
-  } 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") || !strcmp(k, "-B") ) {
-   info.bits = roar_str2bits(argv[++i]);
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "-b") ) {
-   info.bits = 8;
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   info.channels = roar_str2channels(argv[++i]);
-   auinfo_changed = 1;
-  } else if ( !strcmp(k, "-m") ) {
-   info.channels = 1;
-   auinfo_changed = 1;
-  } 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") ) {
-   usage();
-   return 0;
-  } else if ( filename == NULL ) {
-   filename    = k;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( info.codec == ROAR_AUDIO_INFO_INVALID )
-  info.codec = ROAR_CODEC_DEFAULT;
-
- if ( (vss = roar_vs_new(server, name, &err)) == NULL ) {
-  fprintf(stderr, "Error: can not connect to server: %s: %s\n",
-   server == NULL ? "(default)" : server, roar_error2str(err));
-  return 10;
- }
-
- if ( auinfo_changed ) {
-  if ( roar_vs_stream(vss, &info, ROAR_DIR_PLAY, &err) == -1 ) {
-   fprintf(stderr, "Error: can not create new stream: %s\n", roar_error2str(err));
-   roar_vs_close(vss, ROAR_VS_TRUE, NULL);
-   return 10;
-  }
- }
-
- if ( roar_vs_file_simple(vss, filename, &err) == -1 ) {
-  fprintf(stderr, "Error: can not open file: %s: %s\n", filename, roar_error2str(err));
-  roar_vs_close(vss, ROAR_VS_TRUE, NULL);
-  return 10;
- }
-
- roar_vs_run(vss, NULL);
-
- roar_vs_sync(vss, ROAR_VS_WAIT, NULL);
- roar_vs_close(vss, ROAR_VS_FALSE, NULL);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarclientpass.c
===================================================================
--- roarclients/roarclientpass.c	(revision 6052)
+++ 	(revision )
@@ -1,300 +1,0 @@
-//roarclientpass.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-/* ckport options:
- * ckport: ignore-symbol: roar_socket_open of target libroar0 -- Used to get a clientfh.
- */
-
-#include <roaraudio.h>
-
-void usage (void) {
- printf("roarclientpass [OPTIONS]...\n");
-
- printf("\nOptions:\n\n");
-
- printf("  --server    SERVER    - Set server hostname\n"
-        "  --stdin               - Client is on stdin\n"
-        "  --stdout              - Client is on stdout\n"
-        "  --stdio               - Same as --stdin --stdout\n"
-        "  --stderr              - Client is on stderr\n"
-        "  --client-fh FH        - Client is on FH\n"
-        "  --proto PROTO         - Client uses protocol PROTO (default: RoarAudio)\n"
-        "  --byteorder BO        - Client uses byteorder BO (default: network)\n"
-        "  --listen              - This is a listen mode connection\n"
-        "  --command CMD         - Command to use: passfh or exec (default: passfh)\n"
-        "  --mode MODE           - Set mode of operation: none, listen, connect (default: none)\n"
-        "  --bind BIND           - Set host/node/path for mode listen and connect\n"
-        "  --port PORT           - Set port for mode listen and connect\n"
-//        "  --type TYPE           - Set type for mode listen and connect (default: unknown)\n"
-        "  --help                - Show this help\n"
-       );
-
-}
-
-#define _BV(x) (1<<(x))
-#define F_STDIN  _BV(ROAR_STDIN)
-#define F_STDOUT _BV(ROAR_STDOUT)
-#define F_STDERR _BV(ROAR_STDERR)
-
-int run (int client, int in, int out) {
- struct roar_vio_calls socks[3];
- struct roar_vio_select vios[4];
- int alive = 1;
- int ret;
- ssize_t len;
- char buf[1024];
- int i;
-
- roar_vio_open_fh_socket(&(socks[0]), client);
- roar_vio_open_fh_socket(&(socks[1]), in);
- roar_vio_open_fh_socket(&(socks[2]), out);
-
- while (alive) {
-  ROAR_VIO_SELECT_SETVIO(&(vios[0]), &(socks[0]), ROAR_VIO_SELECT_READ);
-  ROAR_VIO_SELECT_SETVIO(&(vios[1]), &(socks[0]), ROAR_VIO_SELECT_WRITE);
-  ROAR_VIO_SELECT_SETVIO(&(vios[2]), &(socks[1]), ROAR_VIO_SELECT_READ);
-  ROAR_VIO_SELECT_SETVIO(&(vios[3]), &(socks[2]), ROAR_VIO_SELECT_WRITE);
-
-  while (1) {
-   ret = roar_vio_select(vios, 4, NULL, NULL);
-
-   if ( ret < 0 )
-    break;
-
-   if ( ret == 0 )
-    continue;
-
-   if ( vios[0].eventsa && vios[3].eventsa )
-    break;
-   if ( vios[1].eventsa && vios[2].eventsa )
-    break;
-
-   for (i = 0; i < 4; i++)
-    if ( vios[i].eventsa )
-     vios[i].eventsq |= ROAR_VIO_SELECT_NO_RETEST;
-  }
-
-  if ( ret < 0 )
-   break;
-
-
-  if ( (vios[0].eventsa & ROAR_VIO_SELECT_READ) && (vios[3].eventsa & ROAR_VIO_SELECT_WRITE) ) {
-   len = roar_vio_read(&(socks[0]), buf, sizeof(buf));
-
-   if ( len < 1 ) {
-    alive = 0;
-   } else {
-    if ( roar_vio_write(&(socks[2]), buf, len) != len )
-     break;
-   }
-  }
-
-  if ( (vios[1].eventsa & ROAR_VIO_SELECT_WRITE) && (vios[2].eventsa & ROAR_VIO_SELECT_READ) ) {
-   len = roar_vio_read(&(socks[1]), buf, sizeof(buf));
-
-   if ( len < 1 ) {
-    alive = 0;
-   } else {
-    if ( roar_vio_write(&(socks[0]), buf, len) != len )
-     break;
-   }
-  }
- }
-
- roar_vio_close(&(socks[0]));
- roar_vio_close(&(socks[1]));
- roar_vio_close(&(socks[2]));
-
- return 0;
-}
-
-int main (int argc, char * argv[]) {
- struct roar_connection    con;
- struct roar_client        client;
- const char * server    = NULL;
- const char * k;
- int    i;
- int    clientfh  = -1;
- int    cflags    = 0;
- int    flags     = 0;
- int    proto     = ROAR_PROTO_ROARAUDIO;
- int    byteorder = ROAR_BYTEORDER_NETWORK;
- int    mode      = ROAR_SOCKET_MODE_NONE;
- int    type      = ROAR_SOCKET_TYPE_UNKNOWN;
- const char * host      = NULL;
- int    port      = -1;
- enum {PASSFH, EXEC} command = PASSFH;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( !strcmp(k, "--stdin") ) {
-   cflags |= F_STDIN;
-  } else if ( !strcmp(k, "--stdout") ) {
-   cflags |= F_STDOUT;
-  } else if ( !strcmp(k, "--stderr") ) {
-   cflags |= F_STDERR;
-  } else if ( !strcmp(k, "--stdio") ) {
-   cflags |= F_STDIN|F_STDOUT;
-  } else if ( !strcmp(k, "--client-fh") ) {
-   ROAR_CKHAVEARGS(1);
-   clientfh = atoi(argv[++i]);
-  } else if ( !strcmp(k, "--proto") ) {
-   ROAR_CKHAVEARGS(1);
-   proto = roar_str2proto(argv[++i]);
-  } else if ( !strcmp(k, "--byteorder") ) {
-   ROAR_CKHAVEARGS(1);
-   byteorder = roar_str2byteorder(argv[++i]);
-  } else if ( !strcmp(k, "--listen") ) {
-   flags |= ROAR_CLIENTPASS_FLAG_LISTEN;
-  } else if ( !strcmp(k, "--command") ) {
-   ROAR_CKHAVEARGS(1);
-   k = argv[++i];
-   if ( !strcasecmp(k, "passfh") ) {
-    command = PASSFH;
-   } else if ( !strcasecmp(k, "exec") ) {
-    command = EXEC;
-   } else {
-    ROAR_ERR("unknown command: %s", k);
-    return 1;
-   }
-  } else if ( !strcmp(k, "--mode") ) {
-   ROAR_CKHAVEARGS(1);
-   k = argv[++i];
-   if ( !strcasecmp(k, "none") ) {
-    mode = ROAR_SOCKET_MODE_NONE;
-   } else if ( !strcasecmp(k, "listen") ) {
-    mode = ROAR_SOCKET_MODE_LISTEN;
-    flags |= ROAR_CLIENTPASS_FLAG_LISTEN;
-   } else if ( !strcasecmp(k, "connect") ) {
-    mode = ROAR_SOCKET_MODE_CONNECT;
-    flags |= ROAR_CLIENTPASS_FLAG_LISTEN;
-    flags -= ROAR_CLIENTPASS_FLAG_LISTEN;
-   } else {
-    ROAR_ERR("unknown mode: %s", k);
-    return 1;
-   }
-  } else if ( !strcmp(k, "--bind") ) {
-   ROAR_CKHAVEARGS(1);
-   host = argv[++i];
-  } else if ( !strcmp(k, "--port") ) {
-   ROAR_CKHAVEARGS(1);
-   port = atoi(argv[++i]);
-  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) {
-   usage();
-   return 0;
-  } else {
-   ROAR_ERR("unknown argument: %s", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( cflags & F_STDERR ) {
-#ifdef ROAR_HAVE_SYSLOG
-  roar_debug_set_stderr_mode(ROAR_DEBUG_MODE_SYSLOG);
-#else
-  roar_debug_set_stderr_vio(roar_stderr);
-#endif
- } else {
-  roar_debug_set_stderr_vio(roar_stderr);
- }
-
- if ( mode != ROAR_SOCKET_MODE_NONE ) {
-  if ( clientfh != -1 ) {
-   ROAR_ERR("Too may socket types given");
-   return 30;
-  }
-
-  if ( host == NULL ) {
-   ROAR_ERR("No bind address given. Use --bind.");
-   return 33;
-  }
-
-  clientfh = roar_socket_open(mode, type, host, port);
-
-  if ( clientfh == -1 ) {
-   ROAR_ERR("Unabled to open socket");
-   return 31;
-  }
- }
-
- if ( clientfh == -1 ) {
-  if ( cflags & F_STDIN ) {
-   clientfh = ROAR_STDIN;
-  } else if ( cflags & F_STDOUT ) {
-   clientfh = ROAR_STDOUT;
-  } else if ( cflags & F_STDERR ) {
-   clientfh = ROAR_STDERR;
-  } else {
-   ROAR_ERR("No client socket given");
-   return 32;
-  }
- }
-
- roar_client_new(&client);
- roar_client_set_proto(&client, proto, byteorder);
-
- if ( command != EXEC )
-  roar_client_set_fh(&client, clientfh);
-
- if ( roar_simple_connect(&con, server, "roarclientpass") == -1 ) {
-  ROAR_ERR("Can not connect to server");
-  return 10;
- }
-
- switch (command) {
-  case PASSFH:
-    if ( roar_client_pass(&con, &client, flags) == -1 ) {
-     ROAR_ERR("Can not pass client fh to server");
-     roar_disconnect(&con);
-     return 20;
-    }
-   break;
-  case EXEC:
-    if ( roar_client_exec(&con, &client, flags) == -1 ) {
-     ROAR_ERR("Can not exec client on server");
-     roar_disconnect(&con);
-     return 20;
-    }
-
-    if ( run(client.fh, clientfh, cflags & F_STDOUT ? ROAR_STDOUT : clientfh) == -1 ) {
-     ROAR_ERR("Can not run data copy runner");
-     return 20;
-    }
-
-    return 0;
-   break;
- }
-
- roar_disconnect(&con);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarctl.c
===================================================================
--- roarclients/roarctl.c	(revision 6052)
+++ roarclients/roarctl.c	(revision 0)
@@ -1,396 +1,38 @@
 //roarctl.c:
 
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-/* ckport options:
- * ckport: ignore-symbol: roar_req of target libroar0 -- Used within ping command.
- */
-
-#define _UNITS_T_BASE_USEC
-
 #include <roaraudio.h>
-#include <roaraudio/units.h>
-#include <libroardsp/libroardsp.h>
-
-#if defined(ROAR_HAVE_SETGID) && defined(ROAR_HAVE_SETUID)
-#define _POSIX_USERS
-#endif
-
-#ifdef _POSIX_USERS
-#include <pwd.h>
-#include <grp.h>
-#endif
-
-#include <sys/time.h>
-#include <time.h>
-
-#ifdef ROAR_HAVE_LIBM
-#include <math.h>
-#endif
-
-int g_verbose = 0;
-
-void display_client (struct roar_connection * con, int id);
-void display_stream (struct roar_connection * con, int id);
-int display_mixer (struct roar_connection * con, int stream);
-int show_meta_all (struct roar_connection * con, int id);
 
 void usage (void) {
- printf("roarctl [OPTIONS]... COMMAND [OPTS] [COMMAND [OPTS] [COMMAND [OPTS] [...]]]\n");
+ printf("roarcat [OPTIONS]... COMMAND [OPTS] [COMMAND [OPTS] [COMMAND [OPTS] [...]]]\n");
 
  printf("\nOptions:\n\n");
 
- printf("  --server SERVER         - Set server hostname\n"
-        "  --help                  - Show this help\n"
-        "  --verbose   -v          - Show verbose output\n"
-        "  --list-aiprofiles       - Show audio info profiles and exit\n"
-        "  --list-libstandards     - Gets list of library (libroar) supported standards\n"
-        "  --enum-servers          - Show a list of possible servers\n"
-        "  --hash-password         - Hash a password and exit\n"
+ printf("  --server SERVER    - Set server hostname\n"
+        "  --help             - Show this help\n"
        );
 
  printf("\nCommands:\n\n");
  printf(
-        "  help                    - Show this help\n"
-        "  sleep TIME              - Sleeps for TIME seconds\n"
-#ifdef ROAR_HAVE_GETTIMEOFDAY
-        "  ping  NUM               - Do NUM pings using NOOP commands\n"
-#endif
-        "  servername              - Show name of server currently connected to\n"
-        "  whoami                  - Get own client ID\n"
+        "  help               - Show this help\n"
         "\n"
-        "  beep                    - Ask the server to beep.\n"
+        "  standby, off       - Go into standby mode\n"
+        "  resume, on         - Go into active mode\n"
+        "  standbymode        - Show current standby mode\n"
+        "  exit               - Quits the roard (must be used as last command)\n"
         "\n"
-        "  listaiprofiles          - list audio info profiles\n"
-        "  aiprofileget PROFILE    - show audio info profile PROFILE\n"
+        "  kick TYPE ID       - Kicks object of TYPE with id ID\n"
+        "                       Types: client stream sample source\n"
         "\n"
-        "  standby, off            - Go into standby mode\n"
-        "  resume, on              - Go into active mode\n"
-        "  standbymode             - Show current standby mode\n"
-        "  exit                    - Quits the roard (must be used as last command)\n"
-        "  terminate               - Like exit but let the server up to serve still connected clients,\n"
-        "                            new clients cann't connect and the server terminates after the last\n"
-        "                            client disconnected\n"
-        "\n"
-        "  volume ID CHAN [scale S] V0 V1...\n"
-        "                          - Sets volume for stream ID\n"
-        "                            CHAN is the number of channels or 'mono' or 'stereo'\n"
-        "                            if mono or stereo is chosen roarctl trys to set\n"
-        "                            sensfull values for all channels even if the output\n"
-        "                            is has more channels.\n"
-        "                            An optional scale can be given using S.\n"
-        "                            all other args are the volumes of the channels\n"
-        "                            you may use integer or percent values.\n"
-        "                            percent values can floating points.\n"
-        "\n"
-        "  flag   ID FLAGS         - Sets flags FLAGS on stream ID. FLAGS may be a comma\n"
-        "                            separated list of flags.\n"
-        "  unflag ID FLAGS         - Unsets flags on a stream. See flag.\n"
-        "  toogleflag ID FLAGS     - Toggels flags on a stream. See flag.\n"
-        "  protectflag ID FLAGS    - Protects flags on a stream. Those flags can not be\n"
-        "                            changed anymore after the they got protected. See flag.\n"
-        "\n"
-        "  role ID ROLE            - Set role ROLE on stream ID.\n"
-        "\n"
-        "  kick TYPE ID            - Kicks object of TYPE with id ID\n"
-        "                            Types: client stream sample source\n"
-        "  newvirtual P D E R B C  - Adds a new virtual (child) stream\n"
-        "                            Parameters:\n"
-        "                             P: Parent stream ID, D: Direction,\n"
-        "                             E: codEc, R: sample Rate,\n"
-        "                             B: bits per sample, C: nummer of channels\n"
-        "\n"
-        "  metaget  ID TYPE        - Read meta date of type TYPE from stream ID\n"
-// TODO: document metaset here.
-        "  metasave ID FILE        - Saves meta data of stream ID to file FILE\n"
-        "  metaload ID FILE        - Loads meta data from file FILE and set it on stream ID\n"
-        "\n"
-        "  serverinfo              - Gets general information about the server\n"
-        "  libinfo                 - Gets general information about the library (libroar)\n"
-        "  servertime              - Gets server's time\n"
-        "  serveroinfo             - Gets Information about server output\n"
-        "  serveroinfo2 DIR        - Gets Information about server output for stream direction dir\n"
-        "\n"
-        "  serverstandards         - Gets list of server supported standards\n"
-        "  libstandards            - Gets list of library (libroar) supported standards\n"
-        "\n"
-        "  listclients             - Gets Information about clients\n"
-        "  clientinfo ID           - Gets Information about client ID\n"
-        "  liststreams             - Gets Information about streams\n"
-        "  streaminfo ID           - Gets Information about stream ID\n"
-        "  allinfo                 - Get all infos\n"
+        "  serveroinfo        - Gets Informations about server output\n"
+        "  listclients        - Gets Informations about clients\n"
+        "  liststreams        - Gets Informations about streams\n"
+        "  allinfo            - Get all infos\n"
        );
 }
 
-static void _bin2hex(char * out, char * in, size_t inlen, int uppercase) {
- const char * tab = uppercase ? "0123456789ABCDEF" : "0123456789abcdef";
- unsigned char c;
- int nib0, nib1;
-
- for (; inlen; inlen--) {
-  c = *(in++);
-  nib0 = (c & 0x0F) >> 0;
-  nib1 = (c & 0xF0) >> 4;
-//  printf("inlen=%zu, c=%u, nibs={%i, %i}\n", inlen, (unsigned)c, nib1, nib0);
-  *(out++) = tab[nib1];
-  *(out++) = tab[nib0];
- }
- *out = 0;
-}
-
-int hash_password (void) {
- char * pw = NULL;
- char salt[8];
- char digest[24];
- char out[2*(8+24)+3+5+1] = "tiger:";
-
- if ( roar_passwd_simple_ask_pw(&pw, "Password to hash?", NULL) == -1 )
-  return -1;
-
- roar_random_gen_nonce(salt, sizeof(salt));
-
- roar_hash_salted_buffer(digest, pw, roar_mm_strlen(pw), ROAR_HT_TIGER, salt, sizeof(salt));
-
- roar_mm_free(pw);
-
- _bin2hex(out+6, salt, sizeof(salt), 0);
- out[6+16] = ':';
- _bin2hex(out+6+16+1, digest, sizeof(digest), 0);
-
- out[sizeof(out)-1] = 0;
-
- printf("Password: %s\n", out);
-
- return 0;
-}
-
-int enum_servers (void) {
- struct roar_server * list;
- struct roar_server * c;
- int flags    = ROAR_ENUM_FLAG_DESC|ROAR_ENUM_FLAG_LOCATION;
- int dir      = -1;
- int socktype = -1;
- int i;
-
- if ( (list = roar_enum_servers(flags, dir, socktype)) == NULL )
-  return -1;
-
- printf("Server           Location         Description\n");
- printf("----------------------------------------------------------------------\n");
-
- for (i = 0; ; i++) {
-  c = &(list[i]);
-  printf("%-16s %-16s %s\n",
-             c->server      == NULL ? "(default)" : c->server,
-             c->location    == NULL ? ""          : c->location,
-             c->description == NULL ? ""          : c->description
-        );
-  if ( c->server == NULL )
-   break;
- }
-
- roar_enum_servers_free(list);
-
- return 0;
-}
-
-#ifdef ROAR_HAVE_GETTIMEOFDAY
-int ping (struct roar_connection * con, int num) {
- struct timeval         try, ans;
- struct roar_message    m;
- register int           ret;
- int                    i;
- double                 cur, min = 3600*1000, max = 0, sum = 0;
-
- if ( num == 0 )
-  return 0;
-
- for (i = 0; i < num; i++) {
-  memset(&m, 0, sizeof(m));
-
-  m.cmd = ROAR_CMD_NOOP;
-  m.stream  = -1;
-  m.datalen =  0;
-
-  // we use roar_req() directly here because of speed.
-  // roar_noop() does basicly the same but is a bit slower.
-
-  gettimeofday(&try, NULL);
-  ret = roar_req(con, &m, NULL);
-  gettimeofday(&ans, NULL);
-
-  if ( ret == -1 )
-   return -1;
-
-  while (ans.tv_sec > try.tv_sec) {
-   ans.tv_sec--;
-   ans.tv_usec += 1000000;
-  }
-  ans.tv_usec -= try.tv_usec;
-
-  cur = ans.tv_usec/1000.0;
-
-  printf("Pong from server: seq=%i time=%.3f%cs\n", i, cur < 0.5 ? cur*1000.0 : cur, cur < 0.5 ? 'u' : 'm');
-
-  sum += cur;
-  if ( min > cur )
-   min = cur;
-  if ( cur > max )
-   max = cur;
-
-  if ( i != (num - 1) )
-   roar_sleep(1);
- }
-
- printf("\n--- ping statistics ---\n");
- printf("%i packets transmitted\n", i);
- printf("rtt min/avg/max = %.3f/%.3f/%.3f ms\n", min, sum/(double)i, max);
-
- return 0;
-}
-#endif
-
-#define _pm(m,n) if ( info->m != NULL ) printf(con != NULL ? "Server %-15s: %s\n" : "Library %-14s: %s\n", (n), (info->m));
-void server_info (struct roar_connection * con) {
- struct roar_server_info * info = con != NULL ? roar_server_info(con) : roar_library_info();
- long hostid;
-
- if ( info == NULL ) {
-  fprintf(stderr, "Error: can not get server info\n");
-  return;
- }
-
- _pm(version, "Version");
- _pm(location, "Location");
- _pm(description, "Description");
- _pm(contact, "Contact");
- _pm(serial, "Serial");
- _pm(address, "Address");
- _pm(uiurl, "UI URL");
- _pm(license, "License");
-// _pm(hostid, "HostID");
- if ( info->hostid != NULL ) {
-  if ( sscanf(info->hostid, "0x%lx", &hostid) != 1 )
-   hostid = 0;
-
-  if ( hostid ) {
-   printf(con != NULL ? "Server %-15s: %s (%li.%li.%li.%li)\n"
-                      : "Library %-14s: %s (%li.%li.%li.%li)\n", "HostID", info->hostid,
-           ((hostid & 0x00FF0000UL) >> 16UL),
-           ((hostid & 0xFF000000UL) >> 24UL),
-           ((hostid & 0x000000FFUL) >>  0UL),
-           ((hostid & 0x0000FF00UL) >>  8UL)
-         );
-  } else {
-   _pm(hostid, "HostID");
-  }
- }
- _pm(build, "Build");
- _pm(un.sysname, "System sysname");
- _pm(un.release, "System release");
- _pm(un.nodename, "System nodename");
- _pm(un.machine, "System machine");
-
- roar_server_info_free(info);
-}
-#undef _pm
-
-void server_time (struct roar_connection * con) {
- struct roar_time time;
-#ifdef ROAR_HAVE_CTIME_R
- time_t server_time;
- char server_time_buf[32];
-#endif
-
-
- if ( roar_get_time(con, &time) == -1 ) {
-  fprintf(stderr, "Error: can not get server time: %s\n", roar_vs_strerr(roar_error));
-  return;
- }
-
-#ifdef ROAR_HAVE_CTIME_R
- server_time = time.t_sec;
- if ( ctime_r(&server_time, server_time_buf) == NULL )
-  server_time_buf[0] = 0;
-
- if ( server_time_buf[0] )
-  if ( server_time_buf[strlen(server_time_buf)-1] == '\n' )
-   server_time_buf[strlen(server_time_buf)-1] = 0;
-#endif
-
- if ( g_verbose ) {
-  printf("Server time           : %s%s%s%" LIBROAR__ll "u.%06" LIBROAR__ll "u [+%" LIBROAR__ll "u/2^64] sec\n",
-#ifdef ROAR_HAVE_CTIME_R
-         "\"",
-         server_time_buf,
-         "\" ",
-#else
-         "", "", "",
-#endif
-         (LIBROAR__longlong unsigned int)time.t_sec,
-         (LIBROAR__longlong unsigned int) time.t_ssec / (LIBROAR__longlong unsigned int)18446744073709LLU,
-         (LIBROAR__longlong unsigned int) time.t_ssec);
- } else {
-  if ( time.c_freq == 1000000000LL && time.t_ssec == 0 ) {
-   printf("Server time           : %s%s%s%" LIBROAR__ll "u sec\n",
-#ifdef ROAR_HAVE_CTIME_R
-         "\"",
-         server_time_buf,
-         "\" ",
-#else
-         "", "", "",
-#endif
-          (LIBROAR__longlong unsigned int)time.t_sec);
-  } else {
-   printf("Server time           : %s%s%s%" LIBROAR__ll "u.%06" LIBROAR__ll"u sec\n",
-#ifdef ROAR_HAVE_CTIME_R
-         "\"",
-         server_time_buf,
-         "\" ",
-#else
-         "", "", "",
-#endif
-          (LIBROAR__longlong unsigned int)time.t_sec,
-          (LIBROAR__longlong unsigned int) time.t_ssec / (LIBROAR__longlong unsigned int)18446744073709LLU);
-  }
- }
- if ( time.c_freq )
-  printf("Server clock frequency: %f Hz\n", (float)((double)time.c_freq / (double)1000000000.));
- if ( time.c_drift ) {
-#ifdef ROAR_HAVE_LIBM
-  printf("Server clock drift    : %" LIBROAR__ll "u:2^64 (~10^%f)\n",
-         (LIBROAR__longlong unsigned int)time.c_drift, logf((float)time.c_drift)/2.302585f);
-#else
-  printf("Server clock drift    : %" LIBROAR__ll "u:2^64\n",
-         (LIBROAR__longlong unsigned int)time.c_drift);
-#endif
- }
-}
-
-void server_oinfo (struct roar_connection * con, int dir) {
+void server_oinfo (struct roar_connection * con) {
  struct roar_stream s;
 
- if ( roar_server_oinfo(con, &s, dir) == -1 ) {
+ if ( roar_server_oinfo(con, &s) == -1 ) {
   fprintf(stderr, "Error: can not get server output info\n");
   return;
@@ -398,5 +40,5 @@
 
  printf("Stream direction      : %s\n", roar_dir2str(s.dir));
- printf("Server Output rate    : %i Hz\n", s.info.rate);
+ printf("Server Output rate    : %i\n", s.info.rate);
  printf("Server Output bits    : %i\n", s.info.bits);
  printf("Server Output channels: %i\n", s.info.channels);
@@ -404,85 +46,4 @@
                                      s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "");
 // printf("Server Output rate: %i", s.info.rate);
-  if ( g_verbose > 1 && s.pos != (uint32_t)-1 ) {
-   if ( s.info.rate && s.info.channels ) {
-    printf("Server Position       : %lu S (%.3fs)\n", (unsigned long int) s.pos, (float)s.pos/(s.info.rate*s.info.channels));
-   } else {
-    printf("Server Position       : %lu S\n", (unsigned long int) s.pos);
-   }
-  }
-}
-
-static void print_stds (const struct roar_stds * stds) {
- size_t i;
- int vendor, standard, version;
- char numbuf[2][8];
- const char * vendor_name;
-
- for (i = 0; i < stds->stds_len; i++) {
-  vendor   = ROAR_STD_VENDOR(stds->stds[i]);
-  standard = ROAR_STD_STD(stds->stds[i]);
-  version  = ROAR_STD_VERSION(stds->stds[i]);
-
-  if ( (vendor_name = roar_stds_vendor2str(vendor)) == NULL ) {
-   snprintf(numbuf[0], sizeof(numbuf[0]), "%i", vendor);
-   numbuf[0][sizeof(numbuf[0])-1] = 0;
-   vendor_name = numbuf[0];
-  }
-
-  if ( version == 0 ) {
-   numbuf[1][0] = 0;
-  } else {
-   snprintf(numbuf[1], sizeof(numbuf[1]), "-%i", version);
-   numbuf[1][sizeof(numbuf[1])-1] = 0;
-  }
-
-  printf("Server standard       : %s-%i%s\n", vendor_name, standard, numbuf[1]);
- }
-}
-
-void server_standards (struct roar_connection * con) {
- struct roar_stds * stds;
-
- if ( roar_caps_stds(con, &stds, NULL, -1) == -1 ) {
-  fprintf(stderr, "Error: can not get server standards\n");
-  return;
- }
-
- print_stds(stds);
-
- roar_stds_free(stds);
-}
-
-void lib_standards (void) {
- print_stds(libroar_libstds());
-}
-
-const char * proc_name (pid_t pid) {
- static char ret[80] = "?";
-#ifdef __linux__
- char file[80], buf[80], *r;
- int  i;
-
- snprintf(file, sizeof(file)-1, "/proc/%i/exe", pid);
- file[sizeof(file)-1] = 0;
-
- ret[0] = '?';
- ret[1] = 0;
-
- if ( (i = readlink(file, buf, sizeof(buf)-1)) != -1 ) {
-  buf[i] = 0;
-  if ( (r = strrchr(buf, '/')) != NULL ) {
-   r++;
-   if ( *r != 0 ) {
-    strncpy(ret, r, sizeof(ret)-1);
-    ret[sizeof(ret)-1] = 0;
-   }
-  }
- }
-#else
- (void)pid;
-#endif
-
- return ret;
 }
 
@@ -490,5 +51,7 @@
  int i;
  int num;
+ int h;
  int id[ROAR_CLIENTS_MAX];
+ struct roar_client c;
 
  if ( (num = roar_list_clients(con, id, ROAR_CLIENTS_MAX)) == -1 ) {
@@ -498,96 +61,18 @@
 
  for (i = 0; i < num; i++) {
-  display_client(con, id[i]);
- }
-}
-
-void display_client (struct roar_connection * con, int id) {
- static int self_id = -1;
- static struct roar_client   self_client_store;
- static struct roar_client * self_client = NULL;
- struct roar_client c;
- char tmp[80];
- int h;
-#ifdef _POSIX_USERS
- struct group  * grp = NULL;
- struct passwd * pwd = NULL;
-#endif
-
- if ( self_id == -1 ) {
-  if ( (self_id = roar_get_clientid(con)) != -1 ) {
-   if ( roar_get_client(con, &self_client_store, self_id) == -1 ) {
-    self_id = -1;
-   } else {
-    self_client = &self_client_store;
-   }
-  }
- }
-
- printf("client %i:\n", id);
- if ( roar_get_client(con, &c, id) == -1 ) {
-  fprintf(stderr, "Error: can not get client info\n");
-  return;
- }
-
- if ( c.name[0] != '\0' )
-  printf("Client name           : %s\n", c.name);
-  if ( roar_nnode_get_socktype(&(c.nnode)) != ROAR_SOCKET_TYPE_UNKNOWN ) {
-  if ( roar_nnode_to_str(&(c.nnode), tmp, sizeof(tmp)) == 0 ) {
-   printf("Client network node   : %s\n", tmp);
-  }
- }
-
- if ( c.pid != -1 ) {
-  if ( self_id != -1 && roar_nnode_cmp(&(self_client->nnode), &(c.nnode)) == 0 ) {
-   printf("Client PID            : %i(%s)\n", c.pid, proc_name(c.pid));
-  } else { 
-   printf("Client PID            : %i\n", c.pid);
-  }
- }
- if ( c.uid != -1 ) {
-#ifdef _POSIX_USERS
-  if ( self_id != -1 && roar_nnode_cmp(&(self_client->nnode), &(c.nnode)) == 0 ) {
-   pwd = getpwuid(c.uid);
-   grp = getgrgid(c.gid);
-   printf("Client UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?");
-  } else {
-#else
-  if ( 1 ) {
-#endif
-   printf("Client UID/GID        : %i/%i\n", c.uid, c.gid);
-  }
- }
-
- if ( g_verbose && c.proto != ROAR_PROTO_NONE ) {
-  printf("Client Protocol       : %s\n", roar_proto2str(c.proto));
- }
-
- if ( g_verbose && c.byteorder != ROAR_BYTEORDER_UNKNOWN ) {
-  if ( c.byteorder == ROAR_BYTEORDER_NETWORK ) {
-   roar_mm_strscpy(tmp, " (network byteorder");
-  } else {
-   *tmp = 0;
-  }
-
-  if ( c.byteorder == ROAR_BYTEORDER_NATIVE ) {
-   if ( *tmp ) {
-    roar_mm_strscat(tmp, ", native");
-   } else {
-    roar_mm_strscpy(tmp, " (native");
-   }
-  }
-
-  if ( *tmp )
-   roar_mm_strscat(tmp, ")");
-
-  printf("Client Byteorder      : %s%s\n", roar_byteorder2str(c.byteorder), tmp);
- }
-
- if ( c.execed != -1 )
-  printf("Execed stream         : %i\n", c.execed);
-
- for (h = 0; h < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; h++)
-  if ( c.streams[h] != -1 )
-   printf("stream                : %i\n", c.streams[h]);
+  printf("client %i:\n", id[i]);
+  if ( roar_get_client(con, &c, id[i]) == -1 ) {
+   fprintf(stderr, "Error: can not get client info\n");
+   continue;
+  }
+  printf("Player name           : %s\n", c.name);
+  if ( c.execed != -1 )
+   printf("Execed stream         : %i\n", c.execed);
+
+  for (h = 0; h < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; h++)
+   if ( c.streams[h] != -1 )
+    printf("stream                : %i\n", c.streams[h]);
+ }
+
 }
 
@@ -596,4 +81,6 @@
  int num;
  int id[ROAR_STREAMS_MAX];
+ struct roar_stream s;
+
 
  if ( (num = roar_list_streams(con, id, ROAR_STREAMS_MAX)) == -1 ) {
@@ -603,606 +90,28 @@
 
  for (i = 0; i < num; i++) {
-  display_stream(con, id[i]);
- }
-}
-
-void display_stream (struct roar_connection * con, int id) {
- char chanmap[ROAR_MAX_CHANNELS];
- struct roar_stream s;
- struct roar_stream_info info;
- char buffer[1024];
- char * flags = buffer;
- char * name  = buffer;
- char * infotext;
- const char * mime;
- size_t len;
-
- printf("stream %i:\n", id);
- if ( roar_get_stream(con, &s, id) == -1 ) {
-  fprintf(stderr, "Error: can not get stream info\n");
-  return;
- }
- printf("Stream direction      : %s\n", roar_dir2str(s.dir));
-
- if ( roar_stream_get_name(con, &s, name, sizeof(buffer)) == 0 )
-  printf("Stream name           : %s\n", name);
-
- if ( (int)s.pos_rel_id == -1 ) {
-  printf("Relativ position id   : none (stream not synchronized)\n");
- } else if ( (int)s.pos_rel_id == id ) {
-  printf("Relativ position id   : %i (self synchronized)\n", s.pos_rel_id);
- } else {
-  printf("Relativ position id   : %i (synchronized)\n", s.pos_rel_id);
- }
- if ( g_verbose > 1 && s.pos != (uint32_t)-1 ) {
-  if ( s.info.rate && s.info.channels ) {
-   printf("Position              : %lu S (%.3fs)\n", (unsigned long int) s.pos,
-                                   (float)s.pos/(s.info.rate*s.info.channels));
-  } else {
-   printf("Position              : %lu S\n", (unsigned long int) s.pos);
-  }
- }
-
- switch (s.dir) {
-  case ROAR_DIR_MIDI_IN:
-  case ROAR_DIR_MIDI_OUT:
-    infotext = " ticks/s";
-   break;
-  case ROAR_DIR_LIGHT_IN:
-  case ROAR_DIR_LIGHT_OUT:
-    infotext = " updates/s";
-   break;
-  default:
-    infotext = " Hz";
- }
- if ( s.info.rate )
-  printf("Stream sample rate    : %i%s\n", s.info.rate, infotext);
- if ( s.info.bits )
-  printf("Stream bits           : %i\n", s.info.bits);
- if ( s.info.channels )
-  printf("Stream channels       : %i\n", s.info.channels);
-
- mime = roar_codec2mime(s.info.codec);
- printf("Stream codec          : %2i (%s%s%s%s)\n", s.info.codec, roar_codec2str(s.info.codec),
-                                      s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "",
-                                      mime == NULL ? "" : " mimetype:",
-                                      mime == NULL ? "" : mime
-                                     );
- if ( roar_stream_get_info(con, &s, &info) != -1 ) {
-  if ( info.codec != s.info.codec ) {
-   mime = roar_codec2mime(info.codec);
-   printf("Streamed codec        : %2i (%s%s%s%s)\n", info.codec, roar_codec2str(info.codec),
-                                      info.codec == ROAR_CODEC_DEFAULT ? " native" : "",
-                                      mime == NULL ? "" : " mimetype:",
-                                      mime == NULL ? "" : mime
-                                     );
-  }
-
-  if ( g_verbose ) {
-   if ( info.block_size )
-    printf("Stream block size     : %i Byte\n", info.block_size);
-
-   printf("Underruns pre/post    : %i/%i\n",   info.pre_underruns, info.post_underruns);
-   if ( g_verbose > 1 )
-    printf("Stream delay          : %ims (%.2fm)\n",   (int)info.delay/1000, (info.delay*(float)_SPEED_OF_SOUND));
-
-   if ( g_verbose > 1 )
-    printf("Stream mixer          : %i\n",   info.mixer);
-
-   if ( g_verbose > 1 )
-    printf("Stream state          : %s\n",   roar_streamstate2str(info.state));
-
-   if ( g_verbose > 1 )
-    printf("Stream role           : %s\n",   roar_role2str(info.role));
-
-   *flags = 0;
-#define _strcat(dst,src) roar_mm_strlcat((dst),(src), sizeof(buffer))
-   if ( info.flags & ROAR_FLAG_PRIMARY )
-    _strcat(flags, "primary ");
-   if ( info.flags & ROAR_FLAG_SYNC )
-    _strcat(flags, "sync ");
-   if ( info.flags & ROAR_FLAG_OUTPUT )
-    _strcat(flags, "output ");
-   if ( info.flags & ROAR_FLAG_SOURCE )
-    _strcat(flags, "source ");
-   if ( info.flags & ROAR_FLAG_META )
-    _strcat(flags, "meta ");
-   if ( info.flags & ROAR_FLAG_AUTOCONF )
-    _strcat(flags, "autoconf ");
-   if ( info.flags & ROAR_FLAG_CLEANMETA )
-    _strcat(flags, "cleanmeta ");
-   if ( info.flags & ROAR_FLAG_HWMIXER )
-    _strcat(flags, "hwmixer ");
-   if ( info.flags & ROAR_FLAG_PAUSE )
-    _strcat(flags, "pause ");
-   if ( info.flags & ROAR_FLAG_MUTE )
-    _strcat(flags, "mute ");
-   if ( info.flags & ROAR_FLAG_MMAP )
-    _strcat(flags, "mmap ");
-   if ( info.flags & ROAR_FLAG_ANTIECHO )
-    _strcat(flags, "antiecho ");
-   if ( info.flags & ROAR_FLAG_VIRTUAL )
-    _strcat(flags, "virtual ");
-   if ( info.flags & ROAR_FLAG_RECSOURCE )
-    _strcat(flags, "recsource ");
-   if ( info.flags & ROAR_FLAG_PASSMIXER )
-    _strcat(flags, "passmixer ");
-   if ( info.flags & ROAR_FLAG_PRETHRU )
-    _strcat(flags, "prethru ");
-   if ( info.flags & ROAR_FLAG_IMMUTABLE )
-    _strcat(flags, "immutable ");
-   if ( info.flags & ROAR_FLAG_ENHANCE )
-    _strcat(flags, "enhance ");
-   if ( info.flags & ROAR_FLAG_SINGLESINK )
-    _strcat(flags, "singlesink ");
-#undef _strcat
-
-   printf("Flags                 : %s\n", flags);
-  }
- }
-
- if ( g_verbose && (s.info.channels != 0 && s.info.channels <= ROAR_MAX_CHANNELS) ) {
-  len = ROAR_MAX_CHANNELS;
-  if ( roar_stream_get_chanmap(con, &s, chanmap, &len) == -1 ) {
-   fprintf(stderr, "Error: can not get stream channel map\n");
-  } else {
-   if ( roardsp_chanlist2str(chanmap, len, buffer, 1024) == -1 ) {
-    fprintf(stderr, "Error: can not convert channel map into string\n");
-   } else {
-    printf("Channel Map           : %s\n", buffer);
-   }
-  }
- }
-
- if ( s.dir != ROAR_DIR_THRU ) {
-  if ( s.info.channels != 0 && s.info.channels <= ROAR_MAX_CHANNELS ) {
-   display_mixer(con, id);
-  }
-  show_meta_all(con, id);
- }
-}
-
-int display_mixer (struct roar_connection * con, int stream) {
- struct roar_stream_rpg rpg;
- struct roar_mixer_settings mixer;
- struct roar_stream s;
- int channels;
- int i;
- float fs;
-
- if ( roar_get_vol(con, stream, &mixer, &channels) == -1 ) {
-  fprintf(stderr, "Error: can not get stream mixer info for stream %i\n", stream);
-  return -1;
- }
-
- roar_stream_new_by_id(&s, stream);
- if ( roar_stream_get_rpg(con, &s, &rpg) != -1 ) {
-  printf("ReplayGain Mode       : %s\n", roar_rpgmode2str(rpg.mode));
- }
-
-#ifdef ROAR_HAVE_LIBM
-#define _DB ", %.2fdB"
-#else
-#define _DB ""
-#endif
-
- fs = (float)mixer.scale / 100.;
-
- if ( channels ) { // we hide RPG info for zero-channel streams
-  printf("Mixer ReplayGain      : %i/%i (%.2f%%" _DB ")\n", mixer.rpg_mul, mixer.rpg_div,
-                                                          100.*(float)mixer.rpg_mul/((float)mixer.rpg_div)
-#ifdef ROAR_HAVE_LIBM
-                           , 20*log10f((float)mixer.rpg_mul/(float)mixer.rpg_div)
-#endif
-        );
- }
-
- for (i = 0; i < channels; i++)
-  printf("Mixer volume chan %2i  : %i/%i (%.2f%%" _DB ")\n", i, mixer.mixer[i], mixer.scale,
-                           (float)mixer.mixer[i]/fs
-#ifdef ROAR_HAVE_LIBM
-                          , 20*log10f((float)mixer.mixer[i]/(float)mixer.scale)
-#endif
-        );
-
- return 0;
-}
-
-static unsigned int set_mixer_parse_volume (char * k, int len, uint16_t scale) {
- float fs = scale;
-
- switch (k[len - 1]) {
-  case '%':
-    k[len - 1] = 0;
-    return (atof(k)*fs)/100.;
-   break;
-#ifdef ROAR_HAVE_LIBM
-  case 'b':
-  case 'B':
-    // TODO: can we hanle the error better?
-    if ( len < 2 )
-     return 0;
-
-    k[len - 2] = 0;
-    return powf(10, atof(k)/20.f)*fs;
-   break;
-#endif
- }
-
- return atoi(k);
-}
-
-int set_mixer (struct roar_connection * con, int * cur, int max, char * arg[]) {
- uint16_t scale = 65535;
- int chans = 0;
- int id;
- int i;
- int len;
- int old_chans;
- char * k;
- struct roar_mixer_settings mixer;
- struct roar_mixer_settings old_mixer;
- int mode = ROAR_SET_VOL_ALL;
-
- if (*cur + 2 > max)
-  return -1;
-
- id = atoi(arg[++(*cur)]);
-
- k = arg[++(*cur)];
-
- if ( !strcmp(arg[*cur + 1], "scale") ) {
-  (*cur)++; // 'scale'
-  (*cur)++;
-  scale = set_mixer_parse_volume(arg[*cur], strlen(arg[*cur]), 65535);
- }
-
- mixer.scale = scale;
-
- if ( roar_get_vol(con, id, &old_mixer, &old_chans) == -1 ) {
-  fprintf(stderr, "Error: can not get stream mixer info for stream %i\n", id);
-  return -1;
- }
-
- if ( strcmp(k, "mono") == 0 ) {
-  chans = 1;
-  mode  = ROAR_SET_VOL_UNMAPPED;
- } else if ( strcmp(k, "stereo") == 0 ) {
-  chans = 2;
-  mode  = ROAR_SET_VOL_UNMAPPED;
- } else {
-  chans = atoi(k);
- }
-
- // ensure most simple mode:
- if ( old_chans == chans && mode == ROAR_SET_VOL_UNMAPPED )
-  mode = ROAR_SET_VOL_ALL;
-
- if ( *cur + chans > max )
-  return -1;
-
- for (i = 0; i < chans; i++) {
-  k   = arg[++(*cur)];
-  len = strlen(k);
-
-  mixer.mixer[i] = set_mixer_parse_volume(k, len, scale);
- }
-
- if ( roar_set_vol(con, id, &mixer, chans, mode) == 0 )
-  return 0;
-
- // no fallback if already using ROAR_SET_VOL_ALL:
- if ( mode == ROAR_SET_VOL_ALL )
-  return -1;
-
- if ( roar_conv_volume(&mixer, &mixer, old_chans, chans) == -1 )
-  return -1;
-
- chans = old_chans;
- mode  = ROAR_SET_VOL_ALL;
-
- if ( roar_set_vol(con, id, &mixer, chans, mode) == 0 )
-  return 0;
-
- return -1;
-}
-
-
-int newvirtual (struct roar_connection * con, char *p_s, char *d_s, char *e_s, char *r_s, char *b_s, char *c_s) {
- struct roar_stream s;
- int dir    = roar_str2dir(d_s);
- int parent = atoi(p_s);
-
- ROAR_DBG("newvirtual(*): dir=%i, parent=%i", dir, parent);
-
- if ( roar_stream_new(&s, roar_str2rate(r_s), roar_str2channels(c_s), roar_str2bits(b_s), roar_str2codec(e_s)) == -1 )
-  return -1;
-
- return roar_simple_connect_virtual(con, &s, parent, dir);
-}
-
-int set_meta (struct roar_connection * con, int id, char * mode, char * type, char * val) {
- struct roar_meta   meta;
- struct roar_stream s;
- int mode_i = ROAR_META_MODE_SET;
-
- if ( roar_stream_new_by_id(&s, id) == -1 )
-  return -1;
-
-// printf("set_meta(*): mode='%s', type='%s', val='%s'\n", mode, type, val);
-
- if ( strcmp(mode, "add") == 0 ) {
-  mode_i = ROAR_META_MODE_ADD;
- }
-
- meta.type   = roar_meta_inttype(type);
- meta.value  = val;
- meta.key[0] = 0;
-
- if ( meta.type == -1 ) {
-  fprintf(stderr, "Error: unknown type: %s\n", type);
-  return -1;
- }
-
-// printf("D: type=%i, mode=%i\n", meta.type, mode_i);
-
- if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 )
-  return -1;
-
- meta.type  = ROAR_META_TYPE_NONE;
- meta.value = NULL;
-
- return roar_stream_meta_set(con, &s, ROAR_META_MODE_FINALIZE, &meta);
-}
-
-int load_meta (struct roar_connection * con, int id, char * file) {
- struct roar_meta   meta;
- struct roar_stream s;
- int mode_i = ROAR_META_MODE_SET;
- FILE * in;
- char lion[1024];
- char * v;
-
- if ( roar_stream_new_by_id(&s, id) == -1 )
-  return -1;
-
- if ( (in = fopen(file, "r")) == NULL )
-  return -1;
-
- while (fgets(lion, 1024, in) != NULL) {
-  if ( (v = strtok(lion, "\r\n")) != NULL )
-   if ( (v = strtok(NULL, "\r\n")) != NULL )
-    *(v-1) = 0;
-
-  if ( (v = strstr(lion, "=")) == NULL ) {
-   fprintf(stderr, "Error: can not parse meta data lion: %s\n", lion);
+  printf("stream %i:\n", id[i]);
+  if ( roar_get_stream(con, &s, id[i]) == -1 ) {
+   fprintf(stderr, "Error: can not get stream info\n");
    continue;
   }
-
-  *v++ = 0;
-
-  meta.type   = roar_meta_inttype(lion);
-  meta.value  = v;
-  meta.key[0] = 0;
-
-  if ( meta.type == -1 ) {
-   fprintf(stderr, "Error: unknown type: %s\n", lion);
-   continue;
-  }
-
-  if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 ) {
-   fclose(in);
-   return -1;
-  }
- }
-
- fclose(in);
-
- meta.type  = ROAR_META_TYPE_NONE;
- meta.value = NULL;
-
- return roar_stream_meta_set(con, &s, ROAR_META_MODE_FINALIZE, &meta);
-}
-
-int show_meta_type (struct roar_connection * con, int id, const char * type) {
- struct roar_meta   meta;
- struct roar_stream s;
-
- if ( roar_stream_new_by_id(&s, id) == -1 )
-  return -1;
-
- meta.type  = roar_meta_inttype(type);
-
- if ( meta.type == -1 ) {
-  fprintf(stderr, "Error: unknown type: %s\n", type);
-  return -1;
- }
-
- if ( roar_stream_meta_get(con, &s, &meta) == -1 )
-  return -1;
-
- printf("Meta %-17s: %s\n", roar_meta_strtype(meta.type), meta.value);
-
- roar_meta_free(&meta);
-
- return 0;
-}
-
-int show_meta_all (struct roar_connection * con, int id) {
- struct roar_stream s;
- int types[ROAR_META_MAX_PER_STREAM];
- int i;
- int len;
-
- if ( roar_stream_new_by_id(&s, id) == -1 )
-  return -1;
-
- if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 )
-  return -1;
-
- for (i = 0; i < len; i++)
-  show_meta_type(con, id, roar_meta_strtype(types[i]));
-
- return 0;
-}
-
-int save_meta (struct roar_connection * con, int id, char * file) {
- struct roar_stream s;
- struct roar_meta   meta;
- int types[ROAR_META_MAX_PER_STREAM];
- int i;
- int len;
- FILE * out;
-
- if ( roar_stream_new_by_id(&s, id) == -1 )
-  return -1;
-
- if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 )
-  return -1;
-
- if ( (out = fopen(file, "w")) == NULL )
-  return -1;
-
- for (i = 0; i < len; i++) {
-/*
-  show_meta_type(con, id, roar_meta_strtype(types[i]));
-*/
-  meta.type  = types[i];
-
-  if ( roar_stream_meta_get(con, &s, &meta) == -1 )
-   continue;
-
-//  printf("Meta %-17s: %s\n", roar_meta_strtype(meta.type), meta.value);
-
-  fprintf(out, "%s=%s\n", roar_meta_strtype(meta.type), meta.value);
-
-  roar_meta_free(&meta);
- }
-
- fclose(out);
-
- return 0;
-}
-
-int set_flags (struct roar_connection * con, int id, int action, char * flags) {
- uint32_t f = ROAR_FLAG_NONE;
- char * c;
- struct roar_stream s[1];
-
- if ( roar_stream_new_by_id(s, id) == -1 )
-  return -1;
-
- c = strtok(flags, ",");
- while (c != NULL) {
-  if ( !strcmp(c, "meta") ) {
-   f |= ROAR_FLAG_META;
-  } else if ( !strcmp(c, "primary") ) {
-   f |= ROAR_FLAG_PRIMARY;
-  } else if ( !strcmp(c, "sync") ) {
-   f |= ROAR_FLAG_SYNC;
-  } else if ( !strcmp(c, "cleanmeta") ) {
-   f |= ROAR_FLAG_CLEANMETA;
-  } else if ( !strcmp(c, "hwmixer") ) {
-   f |= ROAR_FLAG_HWMIXER;
-  } else if ( !strcmp(c, "pause") ) {
-   f |= ROAR_FLAG_PAUSE;
-  } else if ( !strcmp(c, "mute") ) {
-   f |= ROAR_FLAG_MUTE;
-  } else if ( !strcmp(c, "mmap") ) {
-   f |= ROAR_FLAG_MMAP;
-  } else if ( !strcmp(c, "antiecho") ) {
-   f |= ROAR_FLAG_ANTIECHO;
-  } else if ( !strcmp(c, "recsource") ) {
-   f |= ROAR_FLAG_RECSOURCE;
-  } else if ( !strcmp(c, "passmixer") ) {
-   f |= ROAR_FLAG_PASSMIXER;
-  } else if ( !strcmp(c, "virtual") ) {
-   f |= ROAR_FLAG_VIRTUAL;
-  } else if ( !strcmp(c, "prethru") ) {
-   f |= ROAR_FLAG_PRETHRU;
-  } else if ( !strcmp(c, "immutable") ) {
-   f |= ROAR_FLAG_IMMUTABLE;
-  } else if ( !strcmp(c, "enhance") ) {
-   f |= ROAR_FLAG_ENHANCE;
-  } else if ( !strcmp(c, "singlesink") ) {
-   f |= ROAR_FLAG_SINGLESINK;
-  } else {
-   fprintf(stderr, "Error: unknown flag: %s\n", c);
-   return -1;
-  }
-
-  c = strtok(NULL, ",");
- }
-
- return roar_stream_set_flags(con, s, f, action);
-}
-
-int set_role (struct roar_connection * con, int id, int role) {
- struct roar_stream s;
-
- if ( id == -1 )
-  return -1;
-
- if ( roar_stream_new_by_id(&s, id) == -1 )
-  return -1;
-
- if ( roar_stream_set_role(con, &s, role) == -1 )
-  return -1;
-
- return 0;
-}
-
-int show_aiprofile (const char * profile) {
- struct roar_audio_info info;
- const char * mime;
-
- if ( roar_profile2info(&info, profile) == -1 ) {
-  fprintf(stderr, "Error: unknown profile: %s\n", profile);
-  return -1;
- }
-
- mime = roar_codec2mime(info.codec);
-
- printf("Profile Name          : %s\n", profile);
-
- if ( info.rate )
-  printf("Profile sample rate   : %i\n", info.rate);
- if ( info.bits )
-  printf("Profile bits          : %i\n", info.bits);
- if ( info.channels )
-  printf("Profile channels      : %i\n", info.channels);
-
- printf("Profile codec         : %2i (%s%s%s%s)\n", info.codec, roar_codec2str(info.codec),
-                                       info.codec == ROAR_CODEC_DEFAULT ? " native" : "",
-                                       mime == NULL ? "" : " mimetype:",
-                                       mime == NULL ? "" : mime);
-
- return 0;
-}
-
-int list_aiprofiles (void) {
- const char * list[1024];
- ssize_t ret;
- ssize_t i;
-
- ret = roar_profiles_list(list, 1024, 0);
-
- if ( ret == -1 ) {
-  fprintf(stderr, "Error: can not read list of profiles\n");
-  return -1;
- }
-
- for (i = 0; i < ret; i++) {
-  printf("profile %" LIBROAR__ll "i:\n", (LIBROAR__longlong signed int)i);
-  show_aiprofile(list[i]);
- }
-
- return 0;
-}
+  printf("Stream direction      : %s\n", roar_dir2str(s.dir));
+  if ( s.pos_rel_id == -1 )
+   printf("Relativ position id   : none (stream not synchronized)\n");
+  else
+   printf("Relativ position id   : %i\n", s.pos_rel_id);
+  printf("Input rate            : %i\n", s.info.rate);
+  printf("Input bits            : %i\n", s.info.bits);
+  printf("Input channels        : %i\n", s.info.channels);
+  printf("Input codec           : %i (%s%s)\n", s.info.codec, roar_codec2str(s.info.codec),
+                                      s.info.codec == ROAR_CODEC_DEFAULT ? " native" : "");
+ }
+
+}
+
 
 int main (int argc, char * argv[]) {
  struct roar_connection con;
- const char * server   = NULL;
- const char * k = NULL;
+ char * server   = NULL;
+ char * k = NULL;
  int    i;
  int    t = 0;
@@ -1212,22 +121,7 @@
 
   if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "-v") == 0 || strcmp(k, "--verbose") == 0 ) {
-   g_verbose++;
+   server = k;
   } else if ( strcmp(k, "--help") == 0 ) {
    usage();
-   return 0;
-  } else if ( strcmp(k, "--list-aiprofiles") == 0 ) {
-   list_aiprofiles();
-   return 0;
-  } else if ( strcmp(k, "--list-libstandards") == 0 ) {
-   lib_standards();
-   return 0;
-  } else if ( strcmp(k, "--enum-servers") == 0 ) {
-   enum_servers();
-   return 0;
-  } else if ( strcmp(k, "--hash-password") == 0 ) {
-   hash_password();
    return 0;
   } else if ( *k == '-' ) {
@@ -1242,7 +136,11 @@
  // connect
 
- if ( roar_simple_connect(&con, server, "roarctl") == -1 ) {
-  fprintf(stderr, "Error: Can not connect to server: %s: %s(%i)\n",
-          server == NULL ? "(default)" : server, roar_vs_strerr(roar_error), roar_error);
+ if ( roar_connect(&con, server) == -1 ) {
+  fprintf(stderr, "Error: Can not connect to server\n");
+  return 1;
+ }
+
+ if ( roar_identify(&con, "roarctl") == -1 ) {
+  fprintf(stderr, "Error: Can not identify to server\n");
   return 1;
  }
@@ -1262,20 +160,4 @@
    usage();
 
-  } else if ( !strcmp(k, "sleep") ) {
-   ROAR_CKHAVEARGS(1);
-   roar_sleep(atoi(argv[++i]));
-
-  } else if ( !strcmp(k, "ping") ) {
-   ROAR_CKHAVEARGS(1);
-#ifdef ROAR_HAVE_GETTIMEOFDAY
-   if ( ping(&con, atoi(argv[++i])) == -1 ) {
-    fprintf(stderr, "Error: can not ping\n");
-   }
-#else
-    fprintf(stderr, "Error: ping not supported.\n");
-    i++;
-#endif
-  } else if ( !strcmp(k, "servername") ) {
-   printf("Server Name           : %s\n", roar_get_connection_server(&con));
 
   } else if ( !strcmp(k, "standby") || !strcmp(k, "off") ) {
@@ -1293,15 +175,8 @@
 
   } else if ( !strcmp(k, "exit") ) {
-   if ( roar_terminate(&con, 0) == -1 ) {
+   if ( roar_exit(&con) == -1 ) {
     fprintf(stderr, "Error: can not quit server\n");
    } else {
     printf("Server quited\n");
-    break;
-   }
-  } else if ( !strcmp(k, "terminate") ) {
-   if ( roar_terminate(&con, 1) == -1 ) {
-    fprintf(stderr, "Error: can not terminate server\n");
-   } else {
-    printf("Server got asked to quited\n");
     break;
    }
@@ -1319,45 +194,12 @@
    }
 
-  } else if ( !strcmp(k, "whoami") ) {
-   printf("My client ID is: %i\n", roar_get_clientid(&con));
-  } else if ( !strcmp(k, "beep") ) {
-   roar_beep(&con, NULL);
-  } else if ( !strcmp(k, "serverinfo") ) {
-   server_info(&con);
-  } else if ( !strcmp(k, "libinfo") ) {
-   server_info(NULL);
-  } else if ( !strcmp(k, "servertime") ) {
-   server_time(&con);
   } else if ( !strcmp(k, "serveroinfo") ) {
-   server_oinfo(&con, -1);
-  } else if ( !strcmp(k, "serveroinfo2") ) {
-   t = roar_str2dir(argv[++i]);
-   if ( t == -1 ) {
-    fprintf(stderr, "Error: unknown stream direction: %s\n", argv[i]);
-   } else {
-    server_oinfo(&con, t);
-   }
-  } else if ( !strcmp(k, "serverstandards") ) {
-   server_standards(&con);
-  } else if ( !strcmp(k, "libstandards") ) {
-   lib_standards();
+   server_oinfo(&con);
   } else if ( !strcmp(k, "listclients") ) {
    list_clients(&con);
-  } else if ( !strcmp(k, "clientinfo") ) {
-   ROAR_CKHAVEARGS(1);
-   display_client(&con, atoi(argv[++i]));
   } else if ( !strcmp(k, "liststreams") ) {
    list_streams(&con);
-  } else if ( !strcmp(k, "streaminfo") ) {
-   ROAR_CKHAVEARGS(1);
-   display_stream(&con, atoi(argv[++i]));
   } else if ( !strcmp(k, "allinfo") ) {
-   server_info(&con);
-   printf("\n");
-   server_time(&con);
-   printf("\n");
-   server_standards(&con);
-   printf("\n");
-   server_oinfo(&con, -1);
+   server_oinfo(&con);
    printf("\n");
    list_clients(&con);
@@ -1366,7 +208,14 @@
 
   } else if ( !strcmp(k, "kick") ) {
-   ROAR_CKHAVEARGS(2);
-   t = roar_str2ot((k = argv[++i]));
-   if ( t == -1 ) {
+   k = argv[++i];
+   if ( !strcmp(k, "client") ) {
+    t = ROAR_OT_CLIENT;
+   } else if ( !strcmp(k, "stream") ) {
+    t = ROAR_OT_STREAM;
+   } else if ( !strcmp(k, "sample") ) {
+    t = ROAR_OT_SAMPLE;
+   } else if ( !strcmp(k, "source") ) {
+    t = ROAR_OT_SOURCE;
+   } else {
     fprintf(stderr, "Error: unknown type: %s\n", k);
     continue;
@@ -1379,114 +228,4 @@
    }
 
-  } else if ( !strcmp(k, "newvirtual") ) {
-   ROAR_CKHAVEARGS(6);
-   if ( newvirtual(&con, argv[i+1], argv[i+2], argv[i+3], argv[i+4], argv[i+5], argv[i+6]) == -1 ) {
-    fprintf(stderr, "Error: can not create new virtual stream\n");
-   } else {
-    printf("virtual stream created\n");
-   }
-   i += 6;
-
-  } else if ( !strcmp(k, "volume") ) {
-   ROAR_CKHAVEARGS(2); /* we may need more, but this is the minimum */
-   if ( set_mixer(&con, &i, argc, argv) == -1 ) {
-    fprintf(stderr, "Error: can not set volume\n");
-   } else {
-    printf("volume changed\n");
-   }
-
-  } else if ( !strcmp(k, "flag") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( set_flags(&con, atoi(argv[i]), ROAR_SET_FLAG, argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not set flags\n");
-   } else {
-    printf("flags changed\n");
-   }
-   i++;
-  } else if ( !strcmp(k, "unflag") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( set_flags(&con, atoi(argv[i]), ROAR_RESET_FLAG, argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not reset flags\n");
-   } else {
-    printf("flags changed\n");
-   }
-   i++;
-  } else if ( !strcmp(k, "toggleflag") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( set_flags(&con, atoi(argv[i]), ROAR_TOGGLE_FLAG, argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not toggle flags\n");
-   } else {
-    printf("flags changed\n");
-   }
-   i++;
-  } else if ( !strcmp(k, "protectflag") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( set_flags(&con, atoi(argv[i]), ROAR_NOOP_FLAG|ROAR_PROTECT_FLAG, argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not protect flags\n");
-   } else {
-    printf("flags protected\n");
-   }
-   i++;
-
-  } else if ( !strcmp(k, "role") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( set_role(&con, atoi(argv[i]), roar_str2role(argv[i+1])) == -1 ) {
-    fprintf(stderr, "Error: can not set stream role\n");
-   } else {
-    printf("stream role set\n");
-   }
-   i++;
-
-  } else if ( !strcmp(k, "metaset") ) {
-   ROAR_CKHAVEARGS(4);
-   i++;
-   if ( set_meta(&con, atoi(argv[i]), argv[i+1], argv[i+2], argv[i+3]) == -1 ) {
-    fprintf(stderr, "Error: can not set meta data\n");
-   } else {
-    printf("meta data changed\n");
-   }
-   i += 3;
-  } else if ( !strcmp(k, "metaget") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( show_meta_type(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not get meta data\n");
-   }
-   i++;
-  } else if ( !strcmp(k, "metasave") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( save_meta(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not get meta data\n");
-   } else {
-    printf("meta data saved\n");
-   }
-   i++;
-  } else if ( !strcmp(k, "metaload") ) {
-   ROAR_CKHAVEARGS(2);
-   i++;
-   if ( load_meta(&con, atoi(argv[i]), argv[i+1]) == -1 ) {
-    fprintf(stderr, "Error: can not set meta data\n");
-   } else {
-    printf("meta data saved\n");
-   }
-   i++;
-
-
-  } else if ( !strcmp(k, "listaiprofiles") || !strcmp(k, "listprofiles") ) {
-   if ( list_aiprofiles() == -1 ) {
-    fprintf(stderr, "Error: can not list profiles\n");
-   }
-  } else if ( !strcmp(k, "aiprofileget") || !strcmp(k, "profileget") ) {
-   ROAR_CKHAVEARGS(1);
-   i++;
-   if ( show_aiprofile(argv[i]) == -1 ) {
-    fprintf(stderr, "Error: can not get profile data\n");
-   }
   } else {
    fprintf(stderr, "Error: invalid command: %s\n", k);
Index: roarclients/roardtmf.c
===================================================================
--- roarclients/roardtmf.c	(revision 6052)
+++ 	(revision )
@@ -1,166 +1,0 @@
-//roardtmf.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <libroardsp/libroardsp.h>
-
-#ifdef ROAR_HAVE_LIBM
-#include <math.h>
-
-// in ms:
-#if 0
-#define ON_TIME  (180)
-#define OFF_TIME ( 80)
-#else
-#define ON_TIME  (180)
-#define OFF_TIME ( 80)
-#endif
-#define SUM_TIME (ON_TIME+OFF_TIME)
-
-void usage (void) {
- printf("roardtmf [OPTIONS]... PHONE NUMBER\n");
-
- printf("\nOptions:\n\n");
-
- printf("  --server SERVER    - Set server hostname\n"
-        "  --rate  -R RATE    - Set sample rate\n"
-        "  --help             - Show this help\n"
-        "  --mode-dtmf        - Use standard DTMF (default)\n"
-        "  --mode-roar        - Use RoarAudio extended DTMF\n"
-       );
-
-}
-
-int main (int argc, char * argv[]) {
- enum {
-  MODE_DTMF,
-  MODE_ROAR
- } mode = MODE_DTMF;
- int    rate     = ROAR_RATE_DEFAULT;
- const char * server   = NULL;
- const char * k;
- int    i;
- const char * name = "roardtmf";
- roar_vs_t * vss = NULL;
- const char * tones = NULL;
- void * buf;
- size_t len_break;
- size_t len_tone;
- size_t samples;
- size_t len;
- uint16_t c;
- int err;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
-   ROAR_CKHAVEARGS(1);
-   rate = roar_str2rate(argv[++i]);
-  } else if ( !strcmp(k, "--mode-dtmf") ) {
-   mode = MODE_DTMF;
-  } else if ( !strcmp(k, "--mode-roar") ) {
-   mode = MODE_ROAR;
-  } else if ( !strcmp(k, "--help") ) {
-   usage();
-   return 0;
-  } else if ( tones == NULL ) {
-   tones = argv[i++];
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( tones == NULL ) {
-  return 1;
- }
-
- len_break = roar_dtmf_mus2samples(OFF_TIME * 1000, rate);
- len_tone  = roar_dtmf_mus2samples(ON_TIME  * 1000, rate);
- samples = len_break + len_tone;
-
-/*
- printf("samples=%llu\n", (long long unsigned int)samples);
- return 0;
-*/
-
- if ( (buf = roar_mm_malloc((len = 16*samples/8))) == NULL )
-  return 4;
-
- if ( (vss = roar_vs_new_playback(server, name, rate, 1, ROAR_CODEC_DEFAULT, 16, &err)) == NULL ) {
-  fprintf(stderr, "Error: can not start playback: %s\n", roar_vs_strerr(err));
-  roar_mm_free(buf);
-  return 1;
- }
-
- while ( (c = *tones) != 0 ) {
-  tones++;
-
-  if ( mode == MODE_DTMF ) {
-   if ( c == '+' || c == '.' || c == '_' )
-    continue;
-  } else if ( mode == MODE_ROAR ) {
-   c = ROAR_DTMF_CHAR_ROAR(c);
-  }
-
-  if ( mode == MODE_DTMF && c == ' ' ) {
-   roar_dtmf_break(buf, len_tone, rate, ROAR_DTMF_OPTIONS_NONE);
-  } else {
-   if ( roar_dtmf_tone(buf, len_tone, rate, ROAR_DTMF_OPTIONS_NONE, c) == -1 ) {
-    roar_mm_free(buf);
-    return 5;
-   }
-  }
-  roar_dtmf_tone(buf+len_tone*sizeof(int16_t), len_break, rate, ROAR_DTMF_OPTIONS_NONE,
-                 mode == MODE_DTMF ? ROAR_DTMF_CHAR_BREAK : ROAR_DTMF_CHAR_NOOP);
-  if ( roar_vs_write(vss, buf, len, &err) != (ssize_t)len ) {
-   fprintf(stderr, "Error: can not write data: %s\n", roar_vs_strerr(err));
-   roar_mm_free(buf);
-   return 5;
-  }
- }
-
- roar_vs_sync(vss, ROAR_VS_WAIT, NULL);
-
- roar_vs_close(vss, ROAR_VS_FALSE, 0);
-
- roar_mm_free(buf);
-
- return 0;
-}
-
-#else
-int main (void) {
- fprintf(stderr, "Error: No Math library support compiled in.\n");
- return 1;
-}
-#endif
-
-//ll
Index: roarclients/roarfctest.c
===================================================================
--- roarclients/roarfctest.c	(revision 6052)
+++ 	(revision )
@@ -1,250 +1,0 @@
-//roarfctest.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>  /* libroar */
-
-#ifdef ROAR_HAVE_LIBM
-
-#include <math.h>       /* sin() */
-#include <stdio.h>      /* *printf*() */
-#include <libroardsp/libroardsp.h>
-
-void usage (void) {
- printf("roarfctest [OPTIONS]...\n");
-
- printf("\nOptions:\n\n");
-
- printf(
-        "  --rate      RATE      - Set sample rate\n"
-        "  --sfreq     SFREQ     - Start frequency \n"
-        "  --efreq     EFREQ     - End frequency\n"
-        "  --engage    ENGAGE    - This option is not documented\n"
-        "  --tmax      TMAX      - This option is not documented\n"
-        "  --gnuplot             - Output data using gnuplot(1)\n"
-        "  --rmsout    RMSOUT    - Set output file for RMS data\n"
-        "  --help   -h           - Show this help\n"
-       );
-}
-
-int main (int argc, char * argv[]) {
- int rate     = ROAR_RATE_DEFAULT;
- int bits     = 16;
- int channels = 1; /* mono */
- int codec    = ROAR_CODEC_DEFAULT;
- float freq   = 523.2;            /* middle C */
- float step; //   = M_PI*2*freq/rate; /* how much time per sample we have to encode ... */
- float t      = 0; /* current time */
- float length;
- int16_t amp  = 32767;
- int      i;
- char   * k;
- int32_t  tmp;
- int16_t  out[1024];
- int16_t  maxval, maxval_in;
- uint32_t sc, sc_tot = 0;
- int      count = 0;
- float    rms, rms_in = amp/sqrt(2);
- float    worklen;
- float    sfreq  = 1, efreq = -1;
- float    engage = 0;
- float    tmax   = 1024;
- struct roardsp_filterchain fc[1];
- struct roardsp_filter      filt[3];
- struct roar_stream         stream[1];
- FILE * rmsout = NULL;
- int kill_var;
-#ifdef ROAR_HAVE_BIN_GNUPLOT
- int do_gnuplot = 0;
-#endif
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-  kill_var = 1;
-
-  if ( !strcmp(k, "--rate") ) {
-   rate = atoi(argv[++i]);
-  } else if ( !strcmp(k, "--sfreq") ) {
-   sfreq = atof(argv[++i]);
-  } else if ( !strcmp(k, "--efreq") ) {
-   efreq = atof(argv[++i]);
-  } else if ( !strcmp(k, "--engage") ) {
-   engage = atof(argv[++i]);
-  } else if ( !strcmp(k, "--tmax") ) {
-   tmax = atof(argv[++i]);
-#ifdef ROAR_HAVE_BIN_GNUPLOT
-  } else if ( !strcmp(k, "--gnuplot") ) {
-   do_gnuplot = 1;
-#endif
-  } else if ( !strcmp(k, "--rmsout") ) {
-   rmsout = fopen(argv[++i], "w");
-  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) {
-   usage();
-   return 0;
-  } else {
-   kill_var = 0;
-  }
-
-  if ( kill_var )
-   *k = 0;
- }
-
-#ifdef ROAR_HAVE_BIN_GNUPLOT
- if ( do_gnuplot && rmsout == NULL ) {
-  if ( (rmsout = popen(ROAR_HAVE_BIN_GNUPLOT, "w")) != NULL ) {
-   fprintf(rmsout, "set grid\n");
-   fprintf(rmsout, "set log x 10\n");
-   fprintf(rmsout, "set log y 10\n");
-   fprintf(rmsout, "plot \"-\" with lines title \"filter amplification\"\n");
-  }
- }
-#endif
-
- if ( roar_stream_new(stream, rate, channels, bits, codec) == -1 ) {
-  pclose(rmsout);
-  return 2;
- }
-
- if ( roardsp_filter_init(filt, stream, ROARDSP_FILTER_DCBLOCK) == -1 ) {
-  ROAR_ERR("main(*): roardsp_filter_init() failed: errno=%s(%i)", strerror(errno), errno);
-  pclose(rmsout);
-  return 1;
- }
-
-/*
- freq = 1000;
- roardsp_filter_ctl(filt, ROARDSP_FCTL_FREQ, &freq);
-*/
-
- if ( roardsp_filter_init(filt+1, stream, ROARDSP_FILTER_HIGHP) == -1 ) {
-  ROAR_ERR("main(*): roardsp_filter_init() failed: errno=%s(%i)", strerror(errno), errno);
-  pclose(rmsout);
-  return 1;
- }
-
- freq = 1000;
- roardsp_filter_ctl(filt+1, ROARDSP_FCTL_FREQ, &freq);
-
- if ( roardsp_filter_init(filt+2, stream, ROARDSP_FILTER_AMP) == -1 ) {
-  ROAR_ERR("main(*): roardsp_filter_init() failed: errno=%s(%i)", strerror(errno), errno);
-  pclose(rmsout);
-  return 1;
- }
-
- tmp = 2;
- roardsp_filter_ctl(filt+2, ROARDSP_FCTL_DIV, &tmp);
- tmp = 3;
- roardsp_filter_ctl(filt+2, ROARDSP_FCTL_MUL, &tmp);
-
-
- roardsp_fchain_init(fc);
- roardsp_fchain_add(fc, filt);
-// roardsp_fchain_add(fc, filt+1);
-// roardsp_fchain_add(fc, filt+2);
-
- fprintf(stderr, "Starting analysis in frequency domain...\n");
-
- if ( efreq == -1 )
-  efreq = (float)rate/2;
-
- length = 5/sfreq;
-
- for (freq = sfreq; freq < efreq; freq *= (1+exp(1)/100), length /= (1+exp(1)/100)) {
-  step      = M_PI*2*freq/rate;
-  maxval    = -amp;
-  maxval_in = -amp;
-  sc        = 0;
-  rms       = 0;
-  t         = -engage;
-
-  if ( roardsp_fchain_reset(fc, ROARDSP_RESET_STATE) == -1 ) {
-   ROAR_ERR("Can not reset filterchain.");
-   return 8;
-  }
-
-
-  worklen = length;
-
-  if ( worklen > tmax )
-   worklen = tmax;
-
-  worklen = 2*M_PI*freq*worklen;
-
-
-  while (t < worklen) {
-   for (i = 0; i < 1024; i++) {
-    out[i] = amp*sin(t);
-    if ( out[i] > maxval_in )
-     maxval_in = out[i];
-    t += step;
-   }
-
-   roardsp_fchain_calc(fc, out, 1024);
-
-   if ( t >= 0 ) {
-    for (i = 0; i < 1024; i++) {
-     rms += out[i] * out[i];
-     if ( out[i] > maxval )
-      maxval = out[i];
-    }
-    sc += 1024;
-   } else {
-    sc_tot += 1024;
-   }
-  }
-
-  count++;
-  sc_tot += sc;
-
-  rms /= sc;
-  rms  = sqrt(rms);
-//  rms /= amp;
-  rms /= rms_in;
-
-  printf("%f: %f %u %f\n", freq, (float)maxval/maxval_in, sc, rms);
-
-  if ( rmsout != NULL )
-   fprintf(rmsout, "%f: %f\n", freq, rms);
- }
-
-
- fprintf(stderr, "Finished analysis in frequency domain: done tests on a total of %u samples on %i frequencies\n",
-           sc_tot, count);
-
- roardsp_fchain_uninit(fc);
-
- if ( rmsout != NULL )
-  pclose(rmsout);
-
- return 0;
-}
-
-#else
-int main (void) {
- fprintf(stderr, "Error: No Math library support compiled in.\n");
- return 1;
-}
-#endif
-
-//ll
Index: roarclients/roarfilt.c
===================================================================
--- roarclients/roarfilt.c	(revision 6052)
+++ 	(revision )
@@ -1,243 +1,0 @@
-//roarfilt.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <libroardsp/libroardsp.h>
-
-#ifdef ROAR_HAVE_LIBM
-#include <math.h>
-#endif
-
-#define BUFFERSIZE 1024
-
-void usage (void) {
- printf("roarfilt [OPTIONS]...\n");
-
- printf("\nOptions:\n\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"
-        "  --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"
-       );
-
-}
-
-#define _volX(bits,twobits,sf) \
-void vol##bits (void * data, int32_t mul, int32_t div, size_t len) { \
- int##bits##_t * samples = (int##bits##_t *) data; \
- size_t i; \
-\
- len /= sf; \
-\
- for (i = 0; i < len; i++) \
-  samples[i] = ((int##twobits##_t) samples[i] * mul) / div; \
-}
-
-_volX( 8,16,1)
-_volX(16,32,2)
-_volX(32,64,4)
-
-int main (int argc, char * argv[]) {
- struct roar_audio_info info;
- const char  * server   = NULL;
- const char  * k;
- int     i;
- int32_t mul = 1, div = 1;
- int     filter_id;
- int32_t tmp;
- float   tmpfp;
- char    buf[BUFFERSIZE];
- struct roardsp_filterchain fc;
- struct roardsp_filter      filter_real[8];
- struct roardsp_filter    * filter = filter_real - 1;
- struct roar_stream         stream;
- struct roar_vio_calls      svio;
-
- _LIBROAR_IGNORE_RET(roar_profile2info(&info, "default-server"));
- info.codec = ROAR_CODEC_DEFAULT;
-
- roardsp_fchain_init(&fc);
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 || strcmp(k, "-s") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 || strcmp(k, "-r") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "-b") == 0 ) {
-   info.bits = 8;
-  } else if ( strcmp(k, "-m") == 0 ) {
-   info.channels = 1;
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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;
-  } else if ( strcmp(k, "--double") == 0 || strcmp(k, "-double") == 0 ) {
-   mul *= 2;
-  } else if ( strcmp(k, "--amp") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   mul *= atoi(argv[++i]);
-  } else if ( strcmp(k, "--mul") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   mul  = atoi(argv[++i]);
-  } else if ( strcmp(k, "--div") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   div  = atoi(argv[++i]);
-  } else if ( strcmp(k, "--filter") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   stream.info = info;
-   filter_id = roardsp_filter_str2id(argv[++i]);
-   if ( filter_id == -1 ) {
-    ROAR_WARN("Can not add filter as filter ID is unknown: %s: %s", argv[i], roar_error2str(roar_error));
-   } else {
-    filter++;
-    if ( roardsp_filter_init(filter, &stream, filter_id) == -1 ) {
-     ROAR_WARN("Can not add filter: %s: %s", argv[i], roar_error2str(roar_error));
-     filter--;
-    } else {
-     roardsp_fchain_add(&fc, filter);
-    }
-   }
-  } else if ( strcmp(k, "--ffreq") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmpfp = atof(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_FREQ, &tmpfp);
-  } else if ( strcmp(k, "--fmul") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmp = atoi(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_MUL, &tmp);
-  } else if ( strcmp(k, "--fdiv") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmp = atoi(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_DIV, &tmp);
-  } else if ( strcmp(k, "--fn") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmp = atoi(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_N, &tmp);
-  } else if ( strcmp(k, "--fq") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmp = atoi(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_Q, &tmp);
-  } else if ( strcmp(k, "--flimit") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmp = atoi(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_LIMIT, &tmp);
-  } else if ( strcmp(k, "--fmode") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   tmp = atoi(argv[++i]);
-   roardsp_filter_ctl(filter, ROARDSP_FCTL_MODE, &tmp);
-  } else if ( strcmp(k, "--help") == 0 || strcmp(k, "-h") == 0 ) {
-   usage();
-   return 0;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( roar_vio_simple_stream(&svio,
-                             info.rate, info.channels, info.bits, info.codec,
-                             server, ROAR_DIR_FILTER, "roarfilt", -1) == -1 ) {
-  fprintf(stderr, "Error: can not start playback\n");
-  return 1;
- }
-
- if ( mul == div &&
-      roardsp_fchain_num(&fc) == 0 ) {
-  fprintf(stderr, "Error: filter is useless!\n");
-  return 0;
- }
-
- switch (info.bits) {
-  case 8:
-    while((i = roar_vio_read(&svio, buf, sizeof(buf)))) {
-     vol8((void*)buf, mul, div, i);
-     roardsp_fchain_calc(&fc, (void*)buf, (8*i)/info.bits);
-     if (roar_vio_write(&svio, buf, i) != i)
-      break;
-    }
-   break;
-  case 16:
-    while((i = roar_vio_read(&svio, buf, sizeof(buf)))) {
-     if ( mul != div )
-      vol16((void*)buf, mul, div, i);
-     roardsp_fchain_calc(&fc, (void*)buf, (8*i)/info.bits);
-     if (roar_vio_write(&svio, buf, i) != i)
-      break;
-    }
-   break;
-  case 32:
-    while((i = roar_vio_read(&svio, buf, sizeof(buf)))) {
-     vol32((void*)buf, mul, div, i);
-     roardsp_fchain_calc(&fc, (void*)buf, (8*i)/info.bits);
-     if (roar_vio_write(&svio, buf, i) != i)
-      break;
-    }
-   break;
-  default:
-    fprintf(stderr, "Error: %i bits per sample is not supported!\n", (int)info.bits);
-    return 1;
- }
-
- roar_vio_close(&svio);
-
- roardsp_fchain_uninit(&fc);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarify.sht
===================================================================
--- roarclients/roarify.sht	(revision 4398)
+++ 	(revision )
@@ -1,109 +1,0 @@
-#!/bin/sh
-
-usage() {
- echo "Usage: $0 program ..."
- echo "or:"
- echo "Usage: $0 [OPTIONS] -- program ..."
- echo "or:"
- echo "Usage: $0 --help"
- echo
- echo "Options:"
- echo " --help               - This help"
- echo " --print-env-bash     - Print needed ENVs in bash mode"
- echo " --server SERVER      - Sets server to SERVER"
- echo " --load   MODULE      - Force loading of MODULE"
- echo " --no-load-roar       - Do not preload libroar"
- echo " --no-load-oss        - Do not preload libroaross (OSS Emulation)"
-}
-
-CMD=false
-
-print_env=false
-print_mode=none
-
-preload_libroar='%%%PREFIX_LIB%%%/libroar.so.%%%VERSION%%% '
-preload_libroaross='%%%PREFIX_LIB%%%/libroaross.so.%%%VERSION%%% '
-
-while [ "$1" != '' ]
-do
- k="$1"
- shift;
-
- case "$k" in
-  '--')
-   CMD="$1"
-   shift;
-   break;
-  ;;
-  '--server')
-   export ROAR_SERVER="$1"
-   shift;
-  ;;
-  '--load')
-   LD_PRELOAD="%%%PREFIX_COMP_LIBS%%%/lib$1.so $LD_PRELOAD"
-   shift;
-  ;;
-  '--no-load-roar')
-   preload_libroar=''
-  ;;
-  '--no-load-oss')
-   preload_libroaross=''
-  ;;
-  '--help'|'-h')
-   usage;
-   exit 0;
-  ;;
-  '--print-env-bash')
-   print_env=true
-   print_mode=bash
-  ;;
-  '-'*)
-   echo "$0: Error: Unknown option: $k" >&2
-   usage >&2;
-   exit 1
-  ;;
-  *)
-   CMD="$k"
-   break;
-  ;;
- esac
-done
-
-# spaces are included in $preload_*
-LD_PRELOAD="$preload_libroar$preload_libroaross$LD_PRELOAD"
-
-if [ "$LD_PRELOAD" = '' ]
-then
- unset LD_PRELOAD
-else
- export LD_PRELOAD
-fi
-
-if [ "$LD_LIBRARY_PATH" = '' ]
-then
- export LD_LIBRARY_PATH='%%%PREFIX_COMP_LIBS%%%'
-else
- export LD_LIBRARY_PATH='%%%PREFIX_COMP_LIBS%%%'":$LD_LIBRARY_PATH"
-fi
-export PATH='%%%PREFIX_COMP_BINS%%%'":$PATH"
-
-if $print_env
-then
- case "$print_mode" in
-  'bash')
-   [ "$ROAR_SERVER" != '' ] && echo "ROAR_SERVER='$ROAR_SERVER'; export ROAR_SERVER;"
-   [ "$LD_PRELOAD"  != '' ] && echo "LD_PRELOAD='$LD_PRELOAD'; export LD_PRELOAD;"
-   echo "LD_LIBRARY_PATH='$LD_LIBRARY_PATH'; export LD_LIBRARY_PATH;"
-   echo "PATH='$PATH'; export PATH;"
-  ;;
-  *)
-   echo "Error: unknown print env mode: $print_mode" >&2
-   exit 1;
-  ;;
- esac
- exit 0;
-fi
-
-exec $(exec -- echo -- 2>/dev/null) "$CMD" "$@"
-
-#ll
Index: roarclients/roarinterconnect.c
===================================================================
--- roarclients/roarinterconnect.c	(revision 6052)
+++ 	(revision )
@@ -1,580 +1,0 @@
-//roarinterconnect.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-/* ckport options:
- * ckport: ignore-symbol: roar_cdriver_oss of target libroareio0 -- For OSS streams
- */
-
-// configure ROAR_INFO()
-int g_verbose = 0;
-#define ROAR_DBG_INFOVAR g_verbose
-
-#include <roaraudio.h>
-#include <libroareio/libroareio.h>
-
-#ifdef ROAR_HAVE_ESD
-#include <esd.h>
-#endif
-
-#ifdef ROAR_HAVE_LIBRSOUND
-#include <rsound.h>
-#ifdef RSD_EXEC
-#define _HAVE_RSOUND
-#endif
-#endif
-
-#if defined(ROAR_HAVE_OSS_BSD) || defined(ROAR_HAVE_OSS)
-#define _HAVE_OSS
-#endif
-
-#define CLIENT_NAME "roarinterconnect"
-
-#define MT_NONE     0x00
-#define MT_MASK     0xF0
-#define MT_ROAR     0x10
-#define MT_ESD      0x20
-#define MT_SIMPLE   0x30
-#define MT_OSS      0x40
-#define MT_RSOUND   0x50
-#define MT_DEFAULT  MT_ROAR
-
-#define ST_NONE     0x00
-#define ST_MASK     0x0F
-#define ST_BIDIR    0x01
-#define ST_FILTER   0x02
-#define ST_TRANSMIT 0x03
-#define ST_RECEIVE  0x04
-#define ST_RECPLAY  0x05
-#define ST_RECORD   0x06
-// no default here as the default depend on the server type
-
-void usage (void) {
- printf("roarinterconnect [OPTIONS]...\n");
-
- 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  -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"
-#ifdef ROAR_HAVE_ESD
-        "  esd                 - EsounD Server\n"
-#endif
-        "  simple              - PulseAudio using simple protocol\n"
-#ifdef _HAVE_OSS
-        "  oss                 - Open Sound System (OSS) device\n"
-#endif
-#ifdef _HAVE_RSOUND
-        "  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"
-       );
-
-}
-
-int parse_type (char * type) {
- int ret = MT_NONE|ST_NONE;
- char * colon;
-
- if ( type != NULL ) {
-  while (type != NULL && *type) {
-   if ( (colon = strstr(type, ":")) != NULL ) {
-    *colon = 0;
-     colon++;
-   }
-
-   if ( !strcmp(type, "roar") ) {
-    ret -= ret & MT_MASK;
-    ret += MT_ROAR;
-   } else if ( !strcmp(type, "esd") ) {
-    ret -= ret & MT_MASK;
-    ret += MT_ESD;
-   } else if ( !strcmp(type, "simple") ) {
-    ret -= ret & MT_MASK;
-    ret += MT_SIMPLE;
-   } else if ( !strcmp(type, "oss") ) {
-    ret -= ret & MT_MASK;
-    ret += MT_OSS;
-   } else if ( !strcmp(type, "rsound") ) {
-    ret -= ret & MT_MASK;
-    ret += MT_RSOUND;
-   } else if ( !strcmp(type, "bidir") ) {
-    ret -= ret & ST_MASK;
-    ret += ST_BIDIR;
-   } else if ( !strcmp(type, "filter") ) {
-    ret -= ret & ST_MASK;
-    ret += ST_FILTER;
-   } else if ( !strcmp(type, "transmit") ) {
-    ret -= ret & ST_MASK;
-    ret += ST_TRANSMIT;
-   } else if ( !strcmp(type, "receive") ) {
-    ret -= ret & ST_MASK;
-    ret += ST_RECEIVE;
-   } else if ( !strcmp(type, "recplay") ) {
-    ret -= ret & ST_MASK;
-    ret += ST_RECPLAY;
-   } else if ( !strcmp(type, "record") ) {
-    ret -= ret & ST_MASK;
-    ret += ST_RECORD;
-   } else {
-    return MT_NONE|ST_NONE;
-   }
-
-   type = colon;
-  }
- }
-
- if ( (ret & MT_MASK) == MT_NONE )
-  ret |= MT_DEFAULT;
-
- if ( (ret & ST_MASK) == ST_NONE ) {
-  switch (ret & MT_MASK) {
-   case MT_ROAR:   ret |= ST_BIDIR;    break;
-   case MT_ESD:    ret |= ST_FILTER;   break;
-   case MT_SIMPLE: ret |= ST_TRANSMIT; break; // we use ST_TRANSMIT because ST_BIDIR is
-                                              // very unlike to be configured at the server side.
-   case MT_OSS:    ret |= ST_BIDIR;    break;
-   case MT_RSOUND: ret |= ST_TRANSMIT; break; // RSound does only handle playback streams.
-   default:
-     return MT_NONE|ST_NONE; // error case
-    break;
-  }
- }
-
- return ret;
-}
-
-#ifdef _HAVE_RSOUND
-// RSound format helper function:
-enum rsd_format para2rsdfmt (uint32_t bits, uint32_t codec) {
- switch (codec) {
-  case ROAR_CODEC_PCM_S_LE:
-    switch (bits) {
-#ifdef RSD_S8
-     case  8: return RSD_S8;     break;
-#endif
-#ifdef RSD_S16_LE
-     case 16: return RSD_S16_LE; break;
-#endif
-#ifdef RSD_S32_LE
-     case 32: return RSD_S32_LE; break;
-#endif
-    }
-   break;
-  case ROAR_CODEC_PCM_S_BE:
-    switch (bits) {
-#ifdef RSD_S8
-     case  8: return RSD_S8;     break;
-#endif
-#ifdef RSD_S16_BE
-     case 16: return RSD_S16_BE; break;
-#endif
-#ifdef RSD_S32_BE
-     case 32: return RSD_S32_BE; break;
-#endif
-    }
-   break;
-  case ROAR_CODEC_PCM_U_LE:
-    switch (bits) {
-#ifdef RSD_U8
-     case  8: return RSD_U8;     break;
-#endif
-#ifdef RSD_U16_LE
-     case 16: return RSD_U16_LE; break;
-#endif
-#ifdef RSD_U32_LE
-     case 32: return RSD_U32_LE; break;
-#endif
-    }
-   break;
-  case ROAR_CODEC_PCM_U_BE:
-    switch (bits) {
-#ifdef RSD_U8
-     case  8: return RSD_U8;     break;
-#endif
-#ifdef RSD_U16_BE
-     case 16: return RSD_U16_BE; break;
-#endif
-#ifdef RSD_U32_BE
-     case 32: return RSD_U32_BE; break;
-#endif
-    }
-   break;
-#ifdef RSD_ALAW
-  case ROAR_CODEC_ALAW:
-    return RSD_ALAW;
-   break;
-#endif
-#ifdef RSD_MULAW
-  case ROAR_CODEC_MULAW:
-    return RSD_MULAW;
-   break;
-#endif
- }
- return 0;
-}
-#endif
-
-int main (int argc, char * argv[]) {
- struct roar_connection con[1];
- struct roar_stream     stream[1];
- struct roar_vio_calls  vio;
- struct roar_audio_info info;
-#ifdef _HAVE_RSOUND
- rsound_t *rd;
- enum rsd_format fmt = 0;
-#endif
- int    type     = parse_type(NULL);
- int    tmp;
- const char * server   = NULL;
- char * remote   = "+slp"; // we hope SLP located server is not local one
- char * k;
- int    rfh;
- int    i;
- int    localdir = ROAR_DIR_BIDIR;
- int    rport;
-
- if ( roar_profile2info(&info, "default") == -1 )
-  return 1;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--remote") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   remote = argv[++i];
-  } else if ( strcmp(k, "--type") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   type = parse_type(argv[++i]);
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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++;
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( server != NULL && !strcmp(server, "+invalid") ) {
-  return 0;
- }
-
- switch (type & MT_MASK) {
-  case MT_ROAR:
-    switch (type & ST_MASK) {
-     case ST_BIDIR:
-       tmp      = ROAR_DIR_BIDIR;
-      break;
-     case ST_FILTER:
-       tmp      = ROAR_DIR_FILTER;
-      break;
-     case ST_TRANSMIT:
-       tmp      = ROAR_DIR_PLAY;
-       localdir = ROAR_DIR_MONITOR;
-      break;
-     case ST_RECEIVE:
-       tmp      = ROAR_DIR_MONITOR;
-       localdir = ROAR_DIR_PLAY;
-      break;
-     case ST_RECPLAY:
-       tmp      = ROAR_DIR_RECPLAY;
-      break;
-     case ST_RECORD:
-       tmp      = ROAR_DIR_RECORD;
-       localdir = ROAR_DIR_PLAY;
-      break;
-     default:
-       fprintf(stderr, "Error: unknown stream type\n");
-       return 2;
-    }
-    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;
-    }
-    if ( roar_vio_ctl(&vio, ROAR_VIO_CTL_GET_FH, &rfh) == -1 ) {
-     fprintf(stderr, "Error: can not get filehandle for RoarAudio stream: %s\n", roar_error2str(roar_error));
-     roar_vio_close(&vio);
-     return 2;
-    }
-   break;
-#ifdef _HAVE_OSS
-  case MT_OSS:
-    switch (type & ST_MASK) {
-     case ST_BIDIR:
-       tmp      = ROAR_DIR_BIDIR;
-      break;
-     case ST_TRANSMIT:
-       tmp      = ROAR_DIR_PLAY;
-       localdir = ROAR_DIR_MONITOR;
-      break;
-     case ST_RECEIVE:
-       tmp      = ROAR_DIR_MONITOR;
-       localdir = ROAR_DIR_PLAY;
-      break;
-     case ST_RECPLAY:
-       tmp      = ROAR_DIR_RECPLAY;
-      break;
-     case ST_RECORD:
-       tmp      = ROAR_DIR_RECORD;
-       localdir = ROAR_DIR_PLAY;
-      break;
-     default:
-       fprintf(stderr, "Error: unknown stream type\n");
-       return 2;
-    }
-    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));
-     return 2;
-    }
-    if ( roar_vio_ctl(&vio, ROAR_VIO_CTL_GET_FH, &rfh) == -1 ) {
-     fprintf(stderr, "Error: can not get filehandle for OSS device %s: %s\n", remote, roar_error2str(roar_error));
-     roar_vio_close(&vio);
-     return 2;
-    }
-   break;
-#endif
-#ifdef ROAR_HAVE_ESD
-  case MT_ESD:
-    tmp = ESD_STREAM|ESD_PLAY;
-
-    switch (info.bits) {
-     case  8: tmp |= ESD_BITS8;  break;
-     case 16: tmp |= ESD_BITS16; break;
-     default:
-       fprintf(stderr, "Error: EsounD only supports 8 and 16 bit streams\n");
-       return 2;
-    }
-
-    switch (info.channels) {
-     case 1: tmp |= ESD_MONO;   break;
-     case 2: tmp |= ESD_STEREO; break;
-     default:
-       fprintf(stderr, "Error: EsounD only supports mono and stereo streams\n");
-       return 2;
-    }
-
-    // TODO: FIXME: this is only true if the esd runs on a LE system,...
-    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 ( info.bits == 16 && info.codec != ROAR_CODEC_DEFAULT ) {
-     fprintf(stderr, "Error: EsounD only supports signed PCM in 16 bit mode\n");
-     return 2;
-    }
-
-    switch (type & ST_MASK) {
-     case ST_FILTER:
-       rfh = esd_filter_stream(tmp, info.rate, remote, CLIENT_NAME);
-      break;
-     case ST_TRANSMIT:
-       rfh = esd_play_stream(tmp, info.rate, remote, CLIENT_NAME);
-       localdir = ROAR_DIR_MONITOR;
-      break;
-     case ST_RECEIVE:
-       rfh = esd_monitor_stream(tmp, info.rate, remote, CLIENT_NAME);
-       localdir = ROAR_DIR_PLAY;
-      break;
-     default:
-       fprintf(stderr, "Error: this type is not supported by EsounD\n");
-       return 2;
-      break;
-    }
-   break;
-#endif
-#ifdef _HAVE_RSOUND
-  case MT_RSOUND:
-    fmt = para2rsdfmt(info.bits, info.codec);
-
-    if ( fmt == 0 ) {
-     fprintf(stderr, "Error: Bits/Codec not supported by RSound\n");
-     return 2;
-    }
-
-    switch (type & ST_MASK) {
-     case ST_TRANSMIT:
-       localdir = ROAR_DIR_MONITOR;
-
-       rsd_init(&rd);
-       rsd_set_param(rd, RSD_HOST,       remote);
-       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
-       rsd_set_param(rd, RSD_IDENTITY,   CLIENT_NAME);
-#endif
-       rfh = rsd_exec(rd);
-       if ( rfh == -1 ) {
-        rsd_stop(rd);
-        rsd_free(rd);
-       }
-      break;
-     default:
-       fprintf(stderr, "Error: this type is not supported by RSound\n");
-       return 2;
-      break;
-    }
-   break;
-#endif
-  case MT_SIMPLE:
-    switch (type & ST_MASK) {
-     case ST_BIDIR:
-       tmp = -1;
-       localdir = ROAR_DIR_BIDIR;
-      break;
-     case ST_TRANSMIT:
-       tmp = SHUT_RD;
-       localdir = ROAR_DIR_MONITOR;
-      break;
-     case ST_RECEIVE:
-       tmp = SHUT_WR;
-       localdir = ROAR_DIR_PLAY;
-      break;
-     default:
-       fprintf(stderr, "Error: this type is not supported by PulseAudio\n");
-       return 2;
-    }
-    // we guess INET here...
-    if ( strstr(remote, "/") == NULL && (k = strstr(remote, ":")) != NULL ) {
-     *k = 0;
-     k++;
-     rport = atoi(k);
-    } else {
-     rport = ROAR_DEFAULT_PA_PORT;
-    }
-
-    if ( roar_vio_open_socket(&vio, remote, rport) == -1 ) {
-     fprintf(stderr, "Error: can not open socket for Simple stream: %s\n", roar_error2str(roar_error));
-     return 2;
-    }
-
-    roar_vio_shutdown(&vio, tmp);
-
-    if ( roar_vio_ctl(&vio, ROAR_VIO_CTL_GET_FH, &rfh) == -1 ) {
-     fprintf(stderr, "Error: can not get filehandle for Simple stream: %s\n", roar_error2str(roar_error));
-     roar_vio_close(&vio);
-     return 2;
-    }
-   break;
-  default:
-    fprintf(stderr, "Error: unknown/not supported server type\n");
-    return 2;
- }
-
- if ( rfh == -1 ) {
-  fprintf(stderr, "Error: can not connect to remote server\n");
-  return 10;
- }
-
- if ( roar_simple_connect(con, server, CLIENT_NAME) == -1 ) {
-  fprintf(stderr, "Can not connect to local server\n");
-  return 20;
- }
-
- if ( roar_stream_new_by_info(stream, &info) == -1 ) {
-  roar_disconnect(con);
-  return 21;
- }
-
- if ( roar_stream_connect(con, stream, localdir, -1) == -1 ) {
-  roar_disconnect(con);
-  return 22;
- }
-
- if ( roar_stream_passfh(con, stream, rfh) == -1 ) {
-  roar_disconnect(con);
-  return 23;
- }
-
- switch (type & MT_MASK) {
-  case MT_ESD:
-    close(rfh);
-   break;
-  case MT_RSOUND:
-    roar_vio_open_fh_socket(&vio, rfh);
-  case MT_ROAR:
-  case MT_OSS:
-  case MT_SIMPLE:
-    roar_vio_close(&vio);
-   break;
-  default:
-    close(rfh);
- }
-
- if ( roar_stream_attach_simple(con, stream, 0) == -1 ) {
-  fprintf(stderr, "Can not attach remote stream to local server\n");
- }
-
- roar_disconnect(con);
-
- ROAR_INFO("Stream ID: %i", 1, stream->id);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarlight.c
===================================================================
--- roarclients/roarlight.c	(revision 6074)
+++ 	(revision )
@@ -1,360 +1,0 @@
-//roarlight.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <libroarlight/libroarlight.h>
-#include <stdio.h>
-
-#define CONVAR struct roar_connection * con
-
-static struct roar_connection * g_connection;
-static struct roar_vio_calls  * g_stream;
-
-static int __run_argv(int argc, char * argv[]);
-static int __open_and_run_file(const char * file);
-
-void usage (void) {
- printf("roarlight [OPTIONS]... command [command...]\n");
-
- printf("\nOptions:\n\n");
-
- printf("  --server    SERVER    - Set server hostname\n"
-        "  --mixer     MIXERID   - ID of the light mixer to use\n"
-        "  --help                - Show this help\n"
-       );
-
- printf("\nCommands:\n\n");
- printf(
-        "  help                    - Show this help\n"
-        "  sleep TIME              - Sleeps for TIME seconds\n"
-        "  sset  chan=val          - Set a DMX Channel\n"
-        "  set   chan=val          - Same as sset\n"
-        "  event EVENT             - Send event EVENT\n"
-        "  @FILE                   - Read commands from FILE or stdin in case of @-\n"
-       );
-}
-
-static int cmd_sset (char * arg) {
- char * next = arg;
- char * k, * v;
- int32_t chan, val;
- struct roar_roardmx_message mes;
-
- roar_roardmx_message_new_sset(&mes);
-
- while (next != NULL) {
-  arg  = next;
-  next = strstr(next, ",");
-  if ( next != NULL ) {
-   *next = 0;
-    next++;
-  }
-
-  k = arg;
-  v = strstr(arg, "=");
-  if ( v == NULL )
-   return -1;
-
-  *v = 0;
-   v++;
-
-  chan = atoi(k);
-  val  = atoi(v);
-//  printf("k='%s'(%i), v='%s'(%i)\n", k, chan, v, val);
-  if ( roar_roardmx_message_add_chanval(&mes, chan, val) == -1 )
-   return -1;
- }
-
- if ( roar_roardmx_message_send(&mes, g_stream) == -1 ) {
-  return -1;
- }
-
- return 0;
-}
-
-static int cmd_rangeset (char * arg) {
- char * next = arg;
- char * k, * v;
- int32_t start, end, val;
- struct roar_roardmx_message mes;
-
- roar_roardmx_message_new_rangeset(&mes);
-
- while (next != NULL) {
-  arg  = next;
-  next = strstr(next, ",");
-  if ( next != NULL ) {
-   *next = 0;
-    next++;
-  }
-
-  k = arg;
-  v = strstr(arg, "=");
-  if ( v == NULL )
-   return -1;
-
-  *v = 0;
-   v++;
-
-  val  = atoi(v);
-
-  v = strstr(arg, "-");
-  if ( v == NULL ) {
-   start = end = atoi(k);
-  } else {
-  *v = 0;
-   v++;
-   start = atoi(k);
-   end = atoi(v);
-  }
-
-//  printf("k='%s'(%i), v='%s'(%i)\n", k, chan, v, val);
-  if ( roar_roardmx_message_add_rangeval(&mes, start, end, val) == -1 ) {
-   return -1;
-  }
- }
-
- if ( roar_roardmx_message_send(&mes, g_stream) == -1 ) {
-  return -1;
- }
-
- return 0;
-}
-
-static int cmd_event (char * arg) {
- struct roar_roardmx_message mes;
- int event;
- char * p;
-
- if ( roar_roardmx_message_new_event(&mes) == -1 )
-  return -1;
-
- while (arg != NULL) {
-  p = strstr(arg, ",");
-  if ( p != NULL ) {
-   *p = 0;
-    p++;
-  }
-
-  event = roar_roardmx_str2event(arg);
-  if ( event == -1 )
-   return -1;
-
-  roar_roardmx_message_add_event(&mes, event);
-
-  arg = p;
- }
-
- if ( roar_roardmx_message_send(&mes, g_stream) == -1 )
-  return -1;
-
- return 0;
-}
-
-static int __run_argv(int argc, char * argv[]) {
- char * k;
- int i;
-
- for (i = 0; i < argc; i++) {
-  k = argv[i];
-  // cmd is in k
-
-  printf("--- [ %s ] ---\n", k);
-
-  if ( !strcmp(k, "help") ) {
-   usage();
-
-  } else if ( !strcmp(k, "sleep") ) {
-   ROAR_CKHAVEARGS(1);
-   roar_sleep(atoi(argv[++i]));
-
-  } else if ( !strcmp(k, "sset") || !strcmp(k, "set") ) {
-   ROAR_CKHAVEARGS(1);
-   i++;
-   if ( cmd_sset(argv[i]) == -1 ) {
-    fprintf(stderr, "Error: can not set channels\n");
-   } else {
-    printf("channels changed\n");
-   }
-  } else if ( !strcmp(k, "rangeset") ) {
-   ROAR_CKHAVEARGS(1);
-   i++;
-   if ( cmd_rangeset(argv[i]) == -1 ) {
-    fprintf(stderr, "Error: can not set channels\n");
-   } else {
-    printf("channels changed\n");
-   }
-  } else if ( !strcmp(k, "event") ) {
-   ROAR_CKHAVEARGS(1);
-   i++;
-   if ( cmd_event(argv[i]) == -1 ) {
-    fprintf(stderr, "Error: can not send event\n");
-   } else {
-    printf("event sent\n");
-   }
-
-  } else if ( *k == '@' ) {
-   __open_and_run_file(k);
-  } else {
-   fprintf(stderr, "Error: invalid command: %s\n", k);
-   return 1;
-  }
- }
-
- return 0;
-}
-
-static inline void __strip_space(char ** str) {
- for (; **str == ' '; (*str)++);
-}
-
-static int __parse_line_and_run(char * line) {
-#define MAX_ARGS 16
- int argc = 0;
- char * argv[MAX_ARGS];
- char * p;
-
- while (line != NULL) {
-  if ( argc == MAX_ARGS ) {
-   fprintf(stderr, "Error: too many arguments.\n");
-   return 1;
-  }
-
-  p = strstr(line, " ");
-  if ( p != NULL ) {
-   *p = 0;
-    p++;
-   __strip_space(&p);
-  }
-
-  argv[argc++] = line;
-
-  line = p;
- }
-
- return __run_argv(argc, argv);
-}
-
-static int __run_file(FILE * file) {
- char buffer[1024];
- ssize_t len;
- int ret;
-
- while (fgets(buffer, sizeof(buffer), file) != NULL) {
-  len = roar_mm_strlen(buffer);
-  if ( len > 0 && buffer[len-1] == '\n' )
-   buffer[len-1] = 0;
-
-  if ( !len || buffer[0] == 0 )
-   continue;
-
-  ret = __parse_line_and_run(buffer);
-  if ( ret != 0 )
-   return ret;
- }
-
- return 0;
-}
-
-static int __open_and_run_file(const char * file) {
- FILE * input;
- int ret;
-
- if ( !strcmp(file, "@-") ) {
-  return __run_file(stdin);
- } else {
-  input = fopen(file+1, "r");
-  if ( input == NULL ) {
-   fprintf(stderr, "Error: can not open input file: %s\n", file+1);
-   return 1;
-  }
-  ret = __run_file(input);
-  fclose(input);
-  return ret;
- }
-}
-
-int main (int argc, char * argv[]) {
- struct roar_connection con;
- struct roar_vio_calls vio;
- int    mixer = -1; // -1 = Default
- const char * server   = NULL;
- const char * k;
- int    i;
- int    ret;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( !strcmp(k, "--mixer") ) {
-   ROAR_CKHAVEARGS(1);
-   mixer = atoi(argv[++i]);
-  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) {
-   usage();
-   return 0;
-  } else if ( *k == '-' ) {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  } else {
-   break;
-  }
- }
-
- if ( i == argc ) {
-  fprintf(stderr, "Error: No Commands given\n");
-  return 0; // this is not a fatal error...
- }
-
- if ( roar_simple_connect(&con, server, "roarlight") == -1 ) {
-  fprintf(stderr, "Error: Can not connect to server\n");
-  return 1;
- }
-
- if ( roar_vio_simple_new_stream_obj(&vio, &con, NULL,
-                                     ROAR_RATE_DEFAULT, ROAR_CHANNELS_DEFAULT, ROAR_BITS_DEFAULT,
-                                     ROAR_CODEC_ROARDMX, ROAR_DIR_LIGHT_IN, mixer) == -1 ) {
- }
-
- g_connection = &con;
- g_stream = &vio;
-
- ret = __run_argv(argc - i, argv + i);
-
- // try to flush all data:
-
- roar_vio_sync(&vio);
- roar_vio_close(&vio);
- roar_usleep(100);
-
- roar_disconnect(&con);
-
- return ret;
-}
-
-//ll
Index: roarclients/roarmon.c
===================================================================
--- roarclients/roarmon.c	(revision 6052)
+++ roarclients/roarmon.c	(revision 0)
@@ -1,26 +1,3 @@
-//roarmon.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
+//roarcat.c:
 
 #include <roaraudio.h>
@@ -29,25 +6,13 @@
 
 void usage (void) {
- printf("roarmon [OPTIONS]... [FILE]\n");
+ printf("roarcat [OPTIONS]...\n");
 
  printf("\nOptions:\n\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"
-        "  --record             - Run in record mode (Wave Audio only)\n"
-        "  --wave               - Output Wave Audio (PCM)\n"
-        "  --midi               - Output MIDI Audio\n"
-        "  --light              - Output light control\n"
-        "  --raw                - Output raw data\n"
-        "  --complex            - Output complex data\n"
-        "  --rdtcs              - Output Radio Data and Transmitter Control System data\n"
-        "  --thru               - Output copy of other stream\n"
-        "  --prethru            - Sets prethru flag on stream\n"
-        "  --rel-id ID          - Set ID of relative stream\n"
-        "  --help               - Show this help\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"
        );
 
@@ -55,94 +20,28 @@
 
 int main (int argc, char * argv[]) {
- 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;
- const char * server   = NULL;
- const char * k;
+ int    rate     = 44100;
+ int    bits     = 16;
+ int    channels = 2;
+ int    codec    = ROAR_CODEC_DEFAULT;
+ char * server   = NULL;
+ char * k;
+ int    fh;
  int    i;
- int    prethru  = 0;
- struct roar_connection    con;
- struct roar_stream        s;
- struct roar_vio_calls     file, * stream;
- struct roar_vio_defaults  def;
- int file_opened = 0;
-
- if ( roar_vio_open_fh(&file, ROAR_STDOUT) == -1 )
-  return 1;
-
- if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_CREAT|O_TRUNC|O_WRONLY, 0644) == -1 )
-  return 1;
+ char buf[BUFSIZE];
 
  for (i = 1; i < argc; i++) {
   k = argv[i];
 
- //         esdmon [-s server ][-b] [-m] [-r freq] < file
-
-  if ( !strcmp(k, "--server") || !strcmp(k, "-s") ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( !strcmp(k, "-b") ) {
-   info.bits = 8;
-  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( !strcmp(k, "-m") ) {
-   info.channels = 1;
-  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
-   ROAR_CKHAVEARGS(1);
-   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") ) {
-   ROAR_CKHAVEARGS(1);
-   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") ) {
-   dir   = ROAR_DIR_MONITOR;
-  } else if ( !strcmp(k, "--record") ) {
-   dir   = ROAR_DIR_RECORD;
-  } else if ( !strcmp(k, "--midi") ) {
-   dir      = ROAR_DIR_MIDI_OUT;
-  } else if ( !strcmp(k, "--light") ) {
-   dir   = ROAR_DIR_LIGHT_OUT;
-  } else if ( !strcmp(k, "--raw") ) {
-   dir   = ROAR_DIR_RAW_OUT;
-  } else if ( !strcmp(k, "--complex") ) {
-   dir   = ROAR_DIR_COMPLEX_OUT;
-  } else if ( !strcmp(k, "--rdtcs") ) {
-   dir   = ROAR_DIR_RDTCS_OUT;
-  } else if ( !strcmp(k, "--thru") ) {
-   dir   = ROAR_DIR_THRU;
-  } else if ( !strcmp(k, "--rel-id") ) {
-   ROAR_CKHAVEARGS(1);
-   rel_id = atoi(argv[++i]);
-
-  } else if ( !strcmp(k, "--prethru") ) {
-   prethru = 1;
-
-  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) {
+  if ( strcmp(k, "--server") == 0 ) {
+   server = k;
+  } else if ( strcmp(k, "--rate") == 0 ) {
+   rate = atoi(argv[++i]);
+  } else if ( strcmp(k, "--bits") == 0 ) {
+   bits = atoi(argv[++i]);
+  } else if ( strcmp(k, "--channels") == 0 ) {
+   channels = atoi(argv[++i]);
+  } else if ( strcmp(k, "--help") == 0 ) {
    usage();
    return 0;
-  } else if ( !file_opened ) {
-   file_opened = 1;
-   if ( roar_vio_open_dstr(&file, k, &def, 1) == -1 ) {
-    fprintf(stderr, "Error: can not open file: %s: %s\n", k, strerror(errno));
-    return 1;
-   }
   } else {
    fprintf(stderr, "Error: unknown argument: %s\n", k);
@@ -152,103 +51,14 @@
  }
 
- switch (dir) {
-  case ROAR_DIR_MONITOR:
-  case ROAR_DIR_RECORD:
-    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 ( 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 ( 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 ( 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 ( 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 ( 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;
+ if ( (fh = roar_simple_monitor(rate, channels, bits, codec, server, "roarmon")) == -1 ) {
+  fprintf(stderr, "Error: can not start playback\n");
+  return 1;
  }
 
- if ( roar_simple_connect(&con, server, "roarmon") == -1 ) {
-  fprintf(stderr, "Error: can not connect to server\n");
-  return 10;
- }
+ while((i = read(fh, buf, BUFSIZE)))
+  if (write(1, buf, i) != i)
+   break;
 
- if ( roar_stream_new_by_info(&s, &info) == -1 ) {
-  fprintf(stderr, "Error: can not create stream\n");
-  roar_disconnect(&con);
-  return 20;
- }
-
- if ( rel_id != -1 ) {
-  if ( roar_stream_set_rel_id(&s, rel_id) ) {
-   fprintf(stderr, "Error: can not set id or realative stream\n");
-   roar_disconnect(&con);
-   return 21;
-  }
- }
-
- if ( roar_stream_connect(&con, &s, dir, -1) == -1 ) {
-  fprintf(stderr, "Error: can not connect stream to server\n");
-  roar_disconnect(&con);
-  return 11;
- }
-
- if ( prethru ) {
-  if ( roar_stream_set_flags(&con, &s, ROAR_FLAG_PRETHRU, ROAR_SET_FLAG) == -1 ) {
-   fprintf(stderr, "Error: can not set prethru flag on stream\n");
-   roar_disconnect(&con);
-   return 14;
-  }
- }
-
- if ( roar_stream_exec(&con, &s) == -1 ) {
-  fprintf(stderr, "Error: can not exec stream\n");
-  roar_disconnect(&con);
-  return 12;
- }
-
- if ( (stream = roar_get_connection_vio2(&con)) == NULL ) {
-  fprintf(stderr, "Error: can not get stream vio\n");
-  roar_disconnect(&con);
-  return 13;
- }
-
-// TODO: FIXME:
-// ROAR_SHUTDOWN(fh, SHUT_WR); // we need to have something do do shutdowns here...
-
- if ( roar_vio_copy_data(&file, stream) == -1 ) {
-  fprintf(stderr, "Error: can not copy data from stream to destination\n");
-  roar_vio_close(stream);
-  roar_vio_close(&file);
-  return 14;
- }
-
- roar_vio_close(stream);
- roar_vio_close(&file);
+ roar_simple_close(fh);
 
  return 0;
Index: roarclients/roarmonhttp.c
===================================================================
--- roarclients/roarmonhttp.c	(revision 6052)
+++ 	(revision )
@@ -1,412 +1,0 @@
-//roarmonhttp.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-/* ckport options:
- * ckport: ignore-symbol: alarm of target win32
- *           checked by configure. Needed to clear timeout some small HTTPds implement
- *           to avoid problems with bad CGI scripts.
- */
-
-#include <roaraudio.h>
-
-#if defined(ROAR_HAVE_SETENV) || defined(ROAR_HAVE_PUTENV)
-#define _CAN_SET_ENV
-#endif
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarmonhttp [OPTIONS]...\n");
-
- printf("\nOptions:\n\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"
-        "  --rel-id ID           - Set ID of relative stream\n"
-        "  --inetd               - Start in inetd mode (STDIN and STDOUT connected to socket)\n"
-        "  --help                - Show this help\n"
-       );
-
-}
-
-void print_header (int codec, int rate, int channels) {
- const char * mime;
-
- mime = roar_codec2mime(codec);
-
- if ( mime == NULL )
-  mime = "application/octet-stream";
-
- printf("Content-type: %s\r\n", mime);
- printf("ice-audio-info: ice-samplerate=%i;ice-channels=%i\r\n", rate, channels);
- printf("icy-pub:0\r\n");
- printf("Server: RoarAudio (roarmonhttp $Revision$)\r\n");
- printf("\r\n");
-
- fflush(stdout);
-}
-
-int stream (struct roar_vio_calls * dest, struct roar_vio_calls * src) {
- struct roar_vio_select vios[2];
- struct roar_buffer *ring = NULL, *cur;
- ssize_t len;
- size_t  todo;
- int alive = 1;
- void * data;
- int ret;
-
- if ( roar_vio_nonblock(src,  ROAR_SOCKET_NONBLOCK) == -1 ) {
-  ROAR_WARN("stream(dest=%p, src=%p): Can not set source stream non-blocking: %s",
-            dest, src, roar_error2str(roar_error));
- }
- if ( roar_vio_nonblock(dest, ROAR_SOCKET_NONBLOCK) == -1 ) {
-  ROAR_WARN("stream(dest=%p, src=%p): Can not set destination stream non-blocking: %s",
-            dest, src, roar_error2str(roar_error));
- }
-
- ROAR_VIO_SELECT_SETVIO(&(vios[0]), src,  ROAR_VIO_SELECT_READ);
- ROAR_VIO_SELECT_SETVIO(&(vios[1]), dest, ROAR_VIO_SELECT_WRITE);
-
- while (alive) {
-  ret = roar_vio_select(vios, ring != NULL ? 2 : 1, NULL, NULL);
-  if ( ret == -1 ) {
-   alive = 0;
-  } else if ( ret == 0 ) {
-   // nothing happend.
-  } else {
-   if ( vios[0].eventsa & ROAR_VIO_SELECT_READ ) { // we can read!
-    if ( roar_buffer_new_data(&cur, BUFSIZE, &data) == -1 )
-     return -1;
-
-    len = roar_vio_read(src, data, BUFSIZE);
-
-    switch (len) {
-     case  0:
-     case -1:
-       roar_buffer_free(cur);
-       cur = NULL;
-
-       if ( ring != NULL )
-        roar_buffer_free(ring);
-
-       ring = NULL;
-
-       return -1;
-      break;
-    }
-
-    if ( cur != NULL ) {
-     if ( roar_buffer_set_len(cur, len) == -1 )
-      return -1;
-
-     if ( ring == NULL ) {
-      ring = cur;
-     } else {
-      if ( roar_buffer_moveinto(ring, &cur) == -1 ) {
-       ROAR_ERR("stream(dest=%p, src=%p): Can not append buffer to ring: %s",
-                dest, src, roar_error2str(roar_error));
-       roar_buffer_free(ring);
-       roar_buffer_free(cur);
-       return -1;
-      }
-     }
-    }
-   } else if ( (vios[1].eventsa & ROAR_VIO_SELECT_WRITE) && ring != NULL ) { // we can write!
-    if ( roar_buffer_get_data(ring, &data) == -1 )
-     return -1;
-
-    if ( roar_buffer_get_len(ring, &todo) == -1 )
-     return -1;
-
-    len = roar_vio_write(dest, data, todo);
-
-    if ( len < 1 ) {
-     if ( roar_error != ROAR_ERROR_AGAIN ) {
-      roar_buffer_free(ring);
-      return -1;
-     }
-    }
-
-    if ( (ssize_t)todo == len ) { // we wrote all of the pkg
-     if ( roar_buffer_next(&ring) == -1 )
-      return -1;
-    } else {
-     if ( roar_buffer_set_offset(ring, len) == -1 )
-      return -1;
-    }
-
-   }
-  }
- }
-
- return 0;
-}
-
-#ifdef _CAN_SET_ENV
-int parse_http (int * gopher) {
- struct roar_keyval kv;
- char buf[1024];
- char * qs = buf, *str;
- ssize_t len;
- int dir = ROAR_DIR_MONITOR;
-
- if ( (len = read(ROAR_STDIN, buf, 1023)) == -1 )
-  return -1;
-
- buf[len] = 0;
-
- if ( strncmp(buf, "GET /", 5) ) {
-  if ( strncmp(buf, "SOURCE /", 8) ) {
-   if ( buf[0] != '/' ) {
-    return -1;
-   } else {
-    *gopher = 1;
-   }
-  } else {
-   dir = ROAR_DIR_PLAY;
-   qs += 3; 
-  }
- }
-
- if ( !*gopher ) {
-  qs += 5;
-
-  if ( (str = strstr(qs, " ")) == NULL )
-   return -1;
-
-  *str = 0;
- } else {
-  if ( (str = strstr(qs, "\r")) != NULL )
-   *str = 0;
-  if ( (str = strstr(qs, "\n")) != NULL )
-   *str = 0;
- }
-
- for (; *qs != '?'; qs++)
-  if ( !*qs )
-   break;
-
- if ( *qs == '?' )
-  qs++;
-
- if ( !*gopher )
-  printf("HTTP/1.0 200 OK\r\n");
-// printf("QS: %s\r\n", qs);
-
- fflush(stdout);
-
- kv.key   = "QUERY_STRING";
- kv.value = qs;
-
- roar_env_set(&kv);
-
- return dir;
-}
-#endif
-
-int main (int argc, char * argv[]) {
- struct roar_audio_info info;
- int    rel_id   = -1;
- int    sflags   = ROAR_FLAG_NONE;
-// int    codec    = ROAR_CODEC_DEFAULT;
- const char * server   = NULL;
- int    i;
- const char * k, * v;
- const char * qs;
- char * qs_buf;
- char * c;
- char * sp0 = NULL, * sp1 = NULL;
- int dir = ROAR_DIR_MONITOR;
- int gopher = 0;
- struct roar_connection    con;
- struct roar_stream        s;
- struct roar_vio_calls   * vio;
-
-#ifdef ROAR_HAVE_ALARM
- alarm(0); // reset alarm timers from httpd 
-#endif
-
- if ( roar_profile2info(&info, "default") == -1 )
-  return 1;
-
- info.codec = ROAR_CODEC_OGG_VORBIS;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-  if ( !strcmp(k, "--inetd") ) {
-#ifdef _CAN_SET_ENV
-   if ( (dir = parse_http(&gopher)) == -1 )
-    return 1;
-#else
-   return 1;
-#endif
-  } else if ( !strcmp(k, "--server") ) {
-   ROAR_CKHAVEARGS(1);
-   roar_libroar_set_server(argv[++i]);
-  } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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") ) {
-   ROAR_CKHAVEARGS(1);
-   rel_id = atoi(argv[++i]);
-  } else if ( !strcmp(k, "--help") && !strcmp(k, "-h") ) {
-   usage();
-   return 0;
-  } else {
-   ROAR_ERR("Unknown parameter: %s", k);
-   usage();
-   return 1;
-  }
- }
-
- qs = roar_env_get("QUERY_STRING");
- if ( qs == NULL )
-  qs = "";
- c = qs_buf = roar_mm_strdup(qs);
- if ( c == NULL )
-  return 1;
-
- c = roar_mm_strtok_r(c, "&", &sp0);
-
- while (c != NULL) {
-  k = roar_mm_strtok_r(c,    "=", &sp1);
-  v = roar_mm_strtok_r(NULL, "=", &sp1);
-
-  if ( !strcmp(k, "codec") ) {
-   if ( (info.codec = roar_str2codec(v)) == ROAR_AUDIO_INFO_INVALID )
-    return 1;
-  } else if ( !strcmp(k, "channels") ) {
-   info.channels = roar_str2channels(v);
-  } else if ( !strcmp(k, "rate") ) {
-   info.rate = roar_str2rate(v);
-  } else if ( !strcmp(k, "bits") ) {
-   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);
-  } else if ( !strcmp(k, "set-flag") ) {
-   if ( !strcmp(v, "meta") ) {
-    sflags |= ROAR_FLAG_META;
-   } else if ( !strcmp(v, "cleanmeta") ) {
-    sflags |= ROAR_FLAG_CLEANMETA;
-   } else if ( !strcmp(v, "prethru") ) {
-    sflags |= ROAR_FLAG_PRETHRU;
-   } else {
-    return 1;
-   }
-  } else if ( !strcmp(k, "dir") ) {
-   if ( (dir = roar_str2dir(v)) == -1 )
-    return 1;
-  } else {
-   return 1;
-  }
-
-  c = roar_mm_strtok_r(NULL, "&", &sp0);
- }
-
- roar_mm_free(qs_buf);
-
- if ( roar_simple_connect(&con, server, "roarmonhttp") == -1 ) {
-  return 10;
- }
-
- if ( roar_stream_new_by_info(&s, &info) == -1 ) {
-  roar_disconnect(&con);
-  return 20;
- }
-
- if ( rel_id != -1 ) {
-  if ( roar_stream_set_rel_id(&s, rel_id) ) {
-   roar_disconnect(&con);
-   return 21;
-  }
- }
-
- if ( roar_stream_connect(&con, &s, dir, -1) == -1 ) {
-  roar_disconnect(&con);
-  return 11;
- }
-
- if ( sflags != ROAR_FLAG_NONE ) {
-  if ( roar_stream_set_flags(&con, &s, sflags, ROAR_SET_FLAG) == -1 ) {
-   roar_disconnect(&con);
-   return 14;
-  }
- }
-
- if ( roar_stream_exec(&con, &s) == -1 ) {
-  roar_disconnect(&con);
-  return 12;
- }
-
- if ( (vio = roar_get_connection_vio2(&con)) == NULL )
-  return 1;
-
- if ( !gopher )
-  print_header(info.codec, info.rate, info.channels);
-
-/*
- while((i = read(fh, buf, BUFSIZE)))
-  if (write(out, buf, i) != i)
-   break;
-*/
-
- switch (dir) {
-  case ROAR_DIR_PLAY:
-    stream(vio, roar_stdin);
-   break;
-  case ROAR_DIR_MONITOR:
-  case ROAR_DIR_THRU:
-    stream(roar_stdout, vio);
-   break;
- }
-
- roar_vio_close(vio);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarphone.c
===================================================================
--- roarclients/roarphone.c	(revision 6052)
+++ 	(revision )
@@ -1,696 +1,0 @@
-//roarphone.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <libroardsp/libroardsp.h>
-#include <libroareio/libroareio.h>
-
-#if defined(ROAR_HAVE_LIBSPEEX) && !defined(ROAR_HAVE_LIBSPEEXDSP)
-#define _SPEEX_API_OLD
-#elif defined(ROAR_HAVE_LIBSPEEX) && defined(ROAR_HAVE_LIBSPEEXDSP)
-#define _SPEEX_API_NEW
-#endif
-
-#ifdef _SPEEX_API_OLD
-#include <speex/speex_echo.h>
-#endif
-
-#define TIMEDIV  100
-
-#define DRIVER  "oss"
-
-// anti echo:
-#define AE_NONE      0
-#define AE_SIMPLE    1
-#define AE_SPEEX     2
-#define AE_ROARD     3
-
-#define DTX_F        25
-
-#define CON_NONE     0x00
-#define CON_CON      0x01
-#define CON_STREAM   0x02
-
-struct {
- int antiecho;
- int samples;
- int transcode;
- int64_t dtx_threshold;
- size_t jumbo_mtu;
- int    ioflush_interval;
- struct {
-  struct {
-   int downmix;
-   float lowp_freq;
-   int speex_prep;
-   int speex_prep_denoise;
-   int speex_prep_agc;
-   int speex_prep_vad;
-  } in;
- } filter;
-} g_conf;
-
-int dtx_counter = 0;
-
-struct {
- int state;
- struct roar_connection con;
- struct roar_stream     stream;
- struct roar_vio_calls * svio;
-} g_cons;
-
-struct roar_bixcoder transcoder[1];
-
-struct {
- struct roardsp_filterchain input;
- struct roardsp_filterchain output;
-} g_filterchains;
-
-struct {
- struct {
-  char key[ROAR_META_MAX_NAMELEN];
-  char value[LIBROAR_BUFFER_MSGDATA];
- } tmp;
- char * rn;
- char * nick;
- char * org;
- char * email;
- char * hp;
- char * loc;
- char * thumbnail;
-} g_meta;
-
-void usage (void) {
- printf("roarphone [OPTIONS]...\n");
-
- printf("\nServer Options:\n\n");
-
- printf("  --server    SERVER   - Set server hostname\n"
-        "  --jumbo-mtu MTU      - Sets the MTU for Jumbo Packets\n"
-        "  --io-flush  INTERVAL - Flushs output every INTERVAL packets\n"
-       );
-
- printf("\nAudio Options:\n\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"
-       );
-
- printf("\nAudio Filter Options:\n\n");
- printf("  --afi-downmix        - Enable input downmixing\n"
-        "  --afi-lowpass FREQ   - Enable input lowpass at FREQ (in Hz)\n"
-        "  --afi-speex-prep     - Enable speex preprocessor\n"
-        "  --afi-speex-denoise  - Enable speex denoiser\n"
-        "  --afi-speex-agc      - Enable speex AGC\n"
-        "  --afi-speex-vad      - Enable speex VAD\n"
-       );
-
- printf("\nCodec Options:\n\n");
- printf("  --codec -E CODEC     - Set the codec\n"
-        "  --transcode          - Use local transcodeing\n"
-       );
-
- printf("\nDriver Options:\n\n");
- printf("  --driver   DRIVER    - Set the driver\n"
-        "  --device   DEVICE    - Set the device\n"
-       );
-
- printf("\nGeneral Options:\n\n");
- printf("  --antiecho AEMODE    - Set the anti echo mode\n"
-        "  --threshold DTXTHRES - Set the DTX threshold, disabled by default\n"
-        "  --help               - Show this help\n"
-       );
-
- printf("\nMeta Data Options:\n\n");
- printf("  --m-rn    REALNAME   - Sets the real name\n"
-        "  --m-nick  NICK       - Sets the nick name\n"
-        "  --m-email EMAIL      - Sets the email address\n"
-        "  --m-hp    HOMEPAGE   - Sets the homepage URL\n"
-        "  --m-thumbn THUMBNAIL - Sets a URL to a thumbnail\n"
-        "  --m-loc   LOCATION   - Sets the location (room number)\n"
-        "  --m-org ORGANIZATION - Sets the organization/company name\n"
-       );
-}
-
-int open_stream (struct roar_vio_calls * vio, const char * server, struct roar_audio_info * info) {
- int fh;
-
- g_cons.svio = vio;
-
- if ( !(g_cons.state & CON_CON) )
-  if ( roar_simple_connect(&(g_cons.con), server, "roarphone") == -1 )
-   return -1;
-
- g_cons.state |= CON_CON;
-
- if ( (fh = roar_vio_simple_new_stream_obj(vio, &(g_cons.con), &(g_cons.stream),
-                                           info->rate, info->channels, info->bits, info->codec,
-                                           ROAR_DIR_BIDIR, -1
-                                          )) == -1 )
-  return -1;
-
- g_cons.state |= CON_STREAM;
-
- return 0;
-}
-
-#define _SET_META(ivar,itype) if ( (ivar) != NULL ) {  \
-                              meta.value = (ivar);     \
-                              meta.type  = (itype);    \
-                              roar_stream_meta_set(&(g_cons.con), &(g_cons.stream), ROAR_META_MODE_SET, &meta); \
-                              }
-int set_meta (void) {
- struct roar_meta   meta;
-
- meta.value  = g_meta.tmp.value;
- meta.key[0] = 0;
- meta.type   = ROAR_META_TYPE_NONE;
-
- roar_stream_meta_set(&(g_cons.con), &(g_cons.stream), ROAR_META_MODE_CLEAR, &meta);
-
- _SET_META(g_meta.thumbnail, ROAR_META_TYPE_THUMBNAIL);
- _SET_META(g_meta.loc,       ROAR_META_TYPE_LOCATION);
- _SET_META(g_meta.hp,        ROAR_META_TYPE_HOMEPAGE);
- _SET_META(g_meta.org,       ROAR_META_TYPE_ORGANIZATION);
-
- if ( g_meta.nick != NULL ) {
-  if ( g_meta.rn  != NULL ) {
-   snprintf(g_meta.tmp.value, LIBROAR_BUFFER_MSGDATA-1, "%s (%s)", g_meta.rn, g_meta.nick);
-   g_meta.tmp.value[LIBROAR_BUFFER_MSGDATA-1] = 0;
-   _SET_META(g_meta.tmp.value, ROAR_META_TYPE_AUTHOR);
-  } else {
-   _SET_META(g_meta.nick, ROAR_META_TYPE_AUTHOR);
-  }
- } else {
-  if ( g_meta.rn  != NULL ) {
-   _SET_META(g_meta.rn, ROAR_META_TYPE_AUTHOR);
-  }
- }
-
- // TODO: make this more nice...
- if ( g_meta.email != NULL ) {
-  if ( g_meta.nick != NULL ) {
-   if ( g_meta.rn != NULL ) {
-    snprintf(g_meta.tmp.value, LIBROAR_BUFFER_MSGDATA-1, "%s (%s) <%s>", g_meta.rn, g_meta.nick, g_meta.email);
-   } else {
-    snprintf(g_meta.tmp.value, LIBROAR_BUFFER_MSGDATA-1, "%s <%s>", g_meta.nick, g_meta.email);
-   }
-  } else {
-   if ( g_meta.rn != NULL ) {
-    snprintf(g_meta.tmp.value, LIBROAR_BUFFER_MSGDATA-1, "%s <%s>", g_meta.rn, g_meta.email);
-   } else {
-    snprintf(g_meta.tmp.value, LIBROAR_BUFFER_MSGDATA-1, "<%s>", g_meta.email);
-   }
-  }
-  g_meta.tmp.value[LIBROAR_BUFFER_MSGDATA-1] = 0;
-  _SET_META(g_meta.tmp.value, ROAR_META_TYPE_CONTACT);
- }
-
- return 0;
-}
-
-#ifdef _SPEEX_API_OLD
-int anti_echo_speex16(int16_t * buf, int16_t * aebuf, size_t len, struct roar_audio_info * info) {
- static SpeexEchoState * state = NULL;
- size_t samples = info->rate / TIMEDIV;
- static int16_t * obuf = NULL;
-
- if ( info->channels != 1 )
-  return -1;
-
- if (len != samples)
-  return -1;
-
- ROAR_DBG("anti_echo_speex16(*) = ?");
-
- if ( state == NULL ) {
-  if ( (state = speex_echo_state_init(samples, 100*samples)) == NULL )
-   return -1;
-
-  // todo: set sample rate.
- }
-
- ROAR_DBG("anti_echo_speex16(*) = ?");
-
- if ( obuf == NULL ) {
-  if ( (obuf = roar_mm_malloc(2*samples)) == NULL )
-   return -1;
- }
-
- ROAR_DBG("anti_echo_speex16(*) = ?");
-
-/*
- speex_echo_cancellation(state, buf, aebuf, obuf);
-*/
-
- speex_echo_cancel(state, buf, aebuf, obuf, NULL);
-
- memcpy(buf, obuf, 2*samples);
-
- ROAR_DBG("anti_echo_speex16(*) = 0");
-
- return 0;
-}
-#endif
-
-int anti_echo16(int16_t * buf, int16_t * aebuf, size_t len, struct roar_audio_info * info) {
- size_t i;
-
- (void)info;
-
- switch (g_conf.antiecho) {
-  case AE_NONE:
-    return 0;
-   break;
-  case AE_SIMPLE:
-    for (i = 0; i < len; i++)
-     buf[i] -= aebuf[i];
-    return 0;
-   break;
-#ifdef _SPEEX_API_OLD
-  case AE_SPEEX:
-    return anti_echo_speex16(buf, aebuf, len, info);
-   break;
-#endif
-  case AE_ROARD:
-    return 0;
-   break;
-  default:
-    return -1;
-   break;
- }
-
- return -1;
-}
-
-int zero_if_noise16 (int16_t * data, size_t samples) {
- int64_t rms = roar_rms2_1_16(data, samples);
-
- if ( rms < g_conf.dtx_threshold ) {
-  if ( dtx_counter ) {
-   dtx_counter--;
-  } else {
-   memset(data, 0, samples*2);
-  }
- } else {
-  dtx_counter = DTX_F;
- }
-
- return 0;
-}
-
-int run_stream (struct roar_vio_calls * s0, struct roar_vio_calls * s1, struct roar_audio_info * info) {
- size_t len;
- void * outbuf, * micbuf;
- ssize_t outlen, miclen;
- unsigned long int pkg_count = 0;
-
- ROAR_DBG("run_stream(*): g_conf.samples = %i, info->bits = %i", g_conf.samples, info->bits);
- len = g_conf.samples * info->bits / 8;
- ROAR_DBG("run_stream(*): len=%lu", (unsigned long) len);
-
- if ( (outbuf = roar_mm_malloc(2*len)) == NULL )
-  return -1;
-
- micbuf = outbuf + len;
-
- while (1) {
-  if ( (miclen = roar_vio_read(s0, micbuf, len)) <= 0 )
-   break;
-
-  if ( roardsp_fchain_num(&(g_filterchains.input)) ) {
-   if ( roardsp_fchain_calc(&(g_filterchains.input), micbuf, len) == -1 )
-    break;
-  }
-
-  if ( g_conf.dtx_threshold > 0 )
-   if ( info->bits == 16 )
-    zero_if_noise16(micbuf, miclen/2);
-
-  if ( g_conf.transcode ) {
-   if ( roar_bixcoder_write_packet(transcoder, micbuf, miclen) == -1 )
-    break;
-  } else {
-   if ( roar_vio_write(s1, micbuf, miclen) != miclen )
-    break;
-  }
-
-  if ( g_conf.ioflush_interval != -1 ) {
-   if ( !(pkg_count % g_conf.ioflush_interval) )
-    roar_vio_sync(s1);
-  }
-
-  if ( g_conf.transcode ) {
-   ROAR_DBG("run_stream(*): outbuf=%p, len=%lu", outbuf, (unsigned long) len);
-   if ( roar_bixcoder_read_packet(transcoder, outbuf, len) == -1 )
-    break;
-
-   outlen = len;
-  } else {
-   if ( (outlen = roar_vio_read(s1, outbuf, len)) <= 0 )
-    break;
-  }
-
-  if ( g_conf.antiecho != AE_NONE && info->bits == 16 )
-   anti_echo16(outbuf, micbuf, ROAR_MIN(miclen, outlen)/2, info);
-
-  if ( roardsp_fchain_num(&(g_filterchains.output)) ) {
-   if ( roardsp_fchain_calc(&(g_filterchains.output), outbuf, outlen) == -1 )
-    break;
-  }
-
-  if ( roar_vio_write(s0, outbuf, outlen) != outlen )
-   break;
-
-  pkg_count++;
- }
-
- roar_mm_free(outbuf);
-
- return 0;
-}
-
-int main (int argc, char * argv[]) {
- struct roar_audio_info info = {.rate     = ROAR_RATE_DEFAULT,
-                                .bits     = ROAR_BITS_DEFAULT,
-                                .channels = ROAR_CHANNELS_DEFAULT,
-                                .codec    = ROAR_CODEC_DEFAULT
-                               };
- struct roar_audio_info dinfo;
- struct roar_vio_calls dvio, svio, svio_jumbo, svio_real;
- struct roar_vio_calls * svio_p;
- struct roardsp_filter * filter;
- const char * driver   = DRIVER;
- const char * device   = NULL;
- const char * server   = NULL;
- const char * k;
- int    i;
- union {
-  int32_t i32;
-  size_t  size;
- } tmp;
-
- memset(&g_conf, 0, sizeof(g_conf));
-
- g_conf.antiecho         = AE_ROARD;
- g_conf.dtx_threshold    = -1;
- g_conf.ioflush_interval = -1;
-
- memset(&g_cons, 0, sizeof(g_cons));
- g_cons.state = CON_NONE;
-
- memset(&g_meta, 0, sizeof(g_meta));
-
- roardsp_fchain_init(&(g_filterchains.input));
- roardsp_fchain_init(&(g_filterchains.output));
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--jumbo-mtu") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_conf.jumbo_mtu = atoi(argv[++i]);
-  } else if ( strcmp(k, "--io-flush") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_conf.ioflush_interval = atoi(argv[++i]);
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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 ) {
-   g_conf.filter.in.downmix = 1;
-  } else if ( strcmp(k, "--afi-lowpass") == 0 ) {
-   g_conf.filter.in.lowp_freq = atof(argv[++i]);
-  } else if ( strcmp(k, "--afi-speex-prep") == 0 ) {
-   g_conf.filter.in.speex_prep = 1;
-  } else if ( strcmp(k, "--afi-speex-denoise") == 0 ) {
-   g_conf.filter.in.speex_prep = 1;
-   g_conf.filter.in.speex_prep_denoise = 1;
-  } else if ( strcmp(k, "--afi-speex-agc") == 0 ) {
-   g_conf.filter.in.speex_prep = 1;
-   g_conf.filter.in.speex_prep_agc = 1;
-  } else if ( strcmp(k, "--afi-speex-vad") == 0 ) {
-   g_conf.filter.in.speex_prep = 1;
-   g_conf.filter.in.speex_prep_vad = 1;
-
-  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-
-  } else if ( strcmp(k, "--driver") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   driver = argv[++i];
-  } else if ( strcmp(k, "--device") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   device = argv[++i];
-  } else if ( strcmp(k, "--antiecho") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   k = argv[++i];
-   if ( !strcmp(k, "none") ) {
-    g_conf.antiecho = AE_NONE;
-   } else if ( !strcmp(k, "simple") ) {
-    g_conf.antiecho = AE_SIMPLE;
-   } else if ( !strcmp(k, "speex") ) {
-    g_conf.antiecho = AE_SPEEX;
-   } else if ( !strcmp(k, "roard") ) {
-    g_conf.antiecho = AE_ROARD;
-   } else {
-    fprintf(stderr, "Error: unknown mode: %s\n", k);
-    return 1;
-   }
-  } else if ( strcmp(k, "--threshold") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_conf.dtx_threshold = atol(argv[++i]);
-
-   // use threshold^2 or threshold < 0 for not using DTX
-   if ( g_conf.dtx_threshold > 0 )
-    g_conf.dtx_threshold *= g_conf.dtx_threshold;
-  } else if ( strcmp(k, "--transcode") == 0 ) {
-   g_conf.transcode = 1;
-
-  // META DATA:
-  } else if ( strcmp(k, "--m-rn") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.rn = argv[++i];
-  } else if ( strcmp(k, "--m-nick") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.nick = argv[++i];
-  } else if ( strcmp(k, "--m-email") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.email = argv[++i];
-  } else if ( strcmp(k, "--m-hp") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.hp = argv[++i];
-  } else if ( strcmp(k, "--m-thumbn") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.thumbnail = argv[++i];
-  } else if ( strcmp(k, "--m-loc") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.loc = argv[++i];
-  } else if ( strcmp(k, "--m-org") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   g_meta.org = argv[++i];
-
-
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- // ignore errors, maybe it will work even if this fails
- // (btw. it will never fail without crashing the rest of the app ;)
- roar_libroar_set_server(server);
-
- if ( g_conf.antiecho == AE_SPEEX ) {
-  ROAR_WARN("Speex Antiecho is obsolete and may be removed in future versions. Use --antiecho roard");
- }
-
- g_conf.samples = info.channels * info.rate / TIMEDIV;
-
- memcpy(&dinfo, &info, sizeof(dinfo));
-
- if ( g_conf.transcode ) {
-  dinfo.bits  = 16;
-  dinfo.codec = ROAR_CODEC_DEFAULT;
-
-  switch (info.codec) {
-   case ROAR_CODEC_ALAW:
-   case ROAR_CODEC_MULAW:
-     info.bits = 8;
-    break;
-   case ROAR_CODEC_ROAR_CELT:
-     info.bits = 16;
-    break;
-   case ROAR_CODEC_ROAR_SPEEX:
-     info.bits = 16;
-    break;
-  }
- }
-
- if ( roar_cdriver_open(&dvio, driver, device, &dinfo, ROAR_DIR_RECPLAY) == -1 ) {
-  ROAR_ERR("Can not open sound card.");
-  return 1;
- }
-
- ROAR_DBG("main(*): CALL open_stream(&svio, server, &info)");
- if ( open_stream(&svio_real, server, &info) == -1 ) {
-  ROAR_ERR("Can not open connection to server.");
-  roar_vio_close(&dvio);
-  return 2;
- }
- ROAR_DBG("main(*): RET");
-
- if ( roar_vio_open_re(&svio, &svio_real) == -1 ) {
-  ROAR_ERR("Can not open connection to server (RE VIO).");
-  roar_vio_close(&dvio);
-  return 2;
- }
-
- if ( g_conf.jumbo_mtu ) {
-  if ( roar_vio_open_jumbo(&svio_jumbo, &svio, g_conf.jumbo_mtu) == -1 ) {
-   roar_vio_close(&dvio);
-   roar_vio_close(&svio);
-   return 2;
-  }
-  svio_p = &svio_jumbo;
- } else {
-  svio_p = &svio;
- }
-
- set_meta();
-
- if ( g_conf.transcode ) {
-  dinfo.codec = info.codec;
-
-  if ( roar_bixcoder_init(transcoder, &dinfo, svio_p) == -1 ) {
-   roar_vio_close(&svio);
-   roar_vio_close(&dvio);
-   return 10;
-  }
-
-  // ignore errors as it may also work if this fails
-  roar_bixcoder_write_header(transcoder);
-  roar_bixcoder_read_header(transcoder);
-
-  g_conf.samples = 8 * roar_bixcoder_packet_size(transcoder, -1) / dinfo.bits;
- }
-
-#define _err(x) roar_vio_close(&dvio); roar_vio_close(&svio); return (x)
-
- if ( g_conf.filter.in.downmix ) {
-  if ( roardsp_filter_new(&filter, &(g_cons.stream), ROARDSP_FILTER_DOWNMIX) == -1 ) {
-   _err(2);
-  }
-
-  if ( roardsp_fchain_add(&(g_filterchains.input), filter) == -1 ) {
-   _err(2);
-  }
- }
-
- if ( g_conf.filter.in.lowp_freq > 1 ) {
-  if ( roardsp_filter_new(&filter, &(g_cons.stream), ROARDSP_FILTER_LOWP) == -1 ) {
-   _err(2);
-  }
-
-  if ( roardsp_filter_ctl(filter, ROARDSP_FCTL_FREQ, &(g_conf.filter.in.lowp_freq)) == -1 ) {
-   _err(2);
-  }
-
-  if ( roardsp_fchain_add(&(g_filterchains.input), filter) == -1 ) {
-   _err(2);
-  }
- }
-
- if ( g_conf.filter.in.speex_prep ) {
-  if ( roardsp_filter_new(&filter, &(g_cons.stream), ROARDSP_FILTER_SPEEX_PREP) == -1 ) {
-   _err(2);
-  }
-
-  tmp.size = g_conf.samples;
-  if ( roardsp_filter_ctl(filter, ROARDSP_FCTL_PACKET_SIZE, &tmp) == -1 ) {
-   _err(2);
-  }
-
-  tmp.i32 = 0;
-
-  if ( g_conf.filter.in.speex_prep_denoise )
-   tmp.i32 |= ROARDSP_SPEEX_PREP_DENOISE_ON;
-
-  if ( g_conf.filter.in.speex_prep_agc )
-   tmp.i32 |= ROARDSP_SPEEX_PREP_AGC_ON;
-
-  if ( g_conf.filter.in.speex_prep_vad )
-   tmp.i32 |= ROARDSP_SPEEX_PREP_VAD_ON;
-
-  if ( roardsp_filter_ctl(filter, ROARDSP_FCTL_MODE, &tmp) == -1 ) {
-   _err(2);
-  }
-
-  if ( roardsp_fchain_add(&(g_filterchains.input), filter) == -1 ) {
-   _err(2);
-  }
- }
-
-#undef _err
-
- ROAR_DBG("main(*): CALL run_stream(&dvio, &svio, &info);");
- run_stream(&dvio, svio_p, &info);
- ROAR_DBG("main(*): RET");
-
- roar_bixcoder_close(transcoder);
-
- roar_vio_close(svio_p);
- roar_vio_close(&dvio);
-
- roardsp_fchain_uninit(&(g_filterchains.input));
- roardsp_fchain_uninit(&(g_filterchains.output));
-
- roar_disconnect(&(g_cons.con));
-
- return 0;
-}
-
-//ll
Index: roarclients/roarpluginapplication.sht
===================================================================
--- roarclients/roarpluginapplication.sht	(revision 5484)
+++ 	(revision )
@@ -1,13 +1,0 @@
-#!/bin/sh
-
-_plugin=`basename "$0"`
-
-if [ "$_plugin" = 'roarpluginapplication' ]
-then
- echo "$0: This script should not be run like this, see $_plugin(1) for details."
- exit 1
-fi
-
-exec roarpluginrunner --run-as-application "$_plugin" "$@"
-
-#ll
Index: roarclients/roarpluginrunner.c
===================================================================
--- roarclients/roarpluginrunner.c	(revision 6052)
+++ 	(revision )
@@ -1,719 +1,0 @@
-//roarpluginrunner.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-int g_verbose = 0;
-#define ROAR_DBG_INFOVAR g_verbose
-
-#include <roaraudio.h>
-
-enum action {
- RUN,
- RUN_AS_APPLICATION,
- EXPLAIN
-};
-
-#define OPTION_NONE        0x0000
-#define OPTION_TOUCH       0x0001
-#define OPTION_ABOUT       0x0100
-#define OPTION_HELP        0x0200
-#define OPTION_PREFERENCES 0x0400
-
-static struct roar_dl_librarypara * g_para  = NULL;
-static struct roar_scheduler      * g_sched = NULL;
-static struct roar_scheduler_source g_s_service   = {.type = ROAR_SCHEDULER_CPI_SERVICE};
-
-static void usage (const char * progname) {
- fprintf(stderr, "Usage: %s [OPTIONS]... PLUGIN\n", progname);
-
- fprintf(stderr, "\nOptions:\n\n");
-
- fprintf(stderr, " -h --help               - This help.\n"
-                 " -v --verbose            - Be verbose. Can be used multiple times.\n"
-                 "    --server SERVER      - Set default server to SERVER.\n"
-                 "    --run                - Run plugin.\n"
-                 "    --run-as-application - Same as --run except all tailing arguments are\n"
-                 "                           passed to the plugin.\n"
-                 "    --explain            - Explain plugin.\n"
-                 "    --appname NAME       - Sets the appname.\n"
-                 "    --abiversion ABI     - Set the ABI version.\n"
-                 "    --args ARGS          - Set plugin arguments.\n"
-        );
-
- fprintf(stderr, "\nRunner Options:\n\n");
- fprintf(stderr, "    --option-touch       - Do not keep the plugin running:\n"
-                 "                           Do a single UPDATE cycle.\n"
-                 "    --option-no-touch    - Disable touch option.\n"
-                 "    --option-about       - Show an about dialog after startup.\n"
-                 "    --option-no-about    - Disable about option.\n"
-                 "    --option-help        - Show onlion help after startup.\n"
-                 "    --option-no-help     - Disable help option.\n"
-                 "    --option-preferences - Show preferences dialog after startup.\n"
-                 "    --option-no-preferences\n"
-                 "                         - Disable preferences option.\n"
-        );
-
- fprintf(stderr, "\nCPI Options:\n\n");
- fprintf(stderr, " -t --tcp                - Use TCP listen socket\n"
-                 " -u --unix               - Use UNIX Domain listen socket (default)\n"
-                 " -n --decnet             - use DECnet listen socket\n"
-                 "    --port PORT          - TCP Port to bind to\n"
-                 "    --bind ADDR          - Node/Hostname/Path to bind to\n"
-                 "    --proto PROTO        - Use PROTO as protocol on Socket\n"
-                 "    --new-sock           - Parameters for new socket follow\n"
-                 "    --client-fh FH       - Comunicate with a client over this handle\n"
-                 "\n"
-        );
-}
-
-static int do_run(const char * name, int options) {
- struct roar_scheduler_source s_container;
- struct roar_plugincontainer * cont = roar_plugincontainer_new(g_para);
- int err;
-
- if ( cont == NULL )
-  return -1;
-
- memset(&s_container, 0, sizeof(s_container));
- s_container.type = ROAR_SCHEDULER_PLUGINCONTAINER;
- s_container.handle.container = cont;
- roar_scheduler_source_add(g_sched, &s_container);
-
- if ( roar_plugincontainer_load(cont, name, NULL) == -1 ) {
-  err = roar_error;
-  roar_scheduler_source_del(g_sched, &s_container);
-  roar_plugincontainer_unref(cont);
-  roar_error = err;
-  return -1;
- }
-
- roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_INIT);
-
- if ( options & OPTION_ABOUT ) {
-  if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_ABOUT) == -1 ) {
-   ROAR_WARN("Can not call ABOUT trigger: %s", roar_errorstring);
-  }
- }
-
- if ( options & OPTION_HELP ) {
-  if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_HELP) == -1 ) {
-   ROAR_WARN("Can not call HELP trigger: %s", roar_errorstring);
-  }
- }
-
- if ( options & OPTION_PREFERENCES ) {
-  if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_PREFERENCES) == -1 ) {
-   ROAR_WARN("Can not call PREFERENCES trigger: %s", roar_errorstring);
-  }
- }
-
-
- if ( !(options & OPTION_TOUCH) )
-  roar_scheduler_run(g_sched);
-
- roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_UPDATE);
- roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_FREE);
-
- roar_scheduler_source_del(g_sched, &s_container);
- roar_plugincontainer_unref(cont);
- return 0;
-}
-
-static const char * _ptr2str(const void * p) {
-#if defined(ROAR_HAVE_H_DLFCN) && defined(ROAR_HAVE_DLADDR)
- static char buf[80];
- Dl_info info;
-#else
- static char buf[24];
-#endif
-
- if ( p == NULL )
-  return "<not set>";
-
-#if defined(ROAR_HAVE_H_DLFCN) && defined(ROAR_HAVE_DLADDR)
- if ( dladdr(p, &info) != 0 ) {
-  if ( p == info.dli_saddr ) {
-   snprintf(buf, sizeof(buf), "%p <%s in \"%s\">", p, info.dli_sname, info.dli_fname);
-   return buf;
-  }
- }
-#endif
-
- snprintf(buf, sizeof(buf), "%p", p);
-
- return buf;
-}
-
-static const char * _ptrrange2str(const void * p, size_t len) {
- static char buf[80];
-
- if ( p == NULL )
-  return "<not set>";
-
- if ( len == 0 )
-  return _ptr2str(p);
-
- snprintf(buf, sizeof(buf), "%p-%p", p, p + len);
-
- return buf;
-}
-
-static int do_explain(const char * name) {
- struct roar_dl_lhandle * lhandle = roar_dl_open(name, ROAR_DL_FLAG_LAZY|ROAR_DL_FLAG_PLUGINPATH, 0, g_para);
- struct roar_dl_libraryinst * (*func)(struct roar_dl_librarypara * para);
- struct roar_dl_libraryinst * lib;
- int libok = 0, libnameok = 0, libdepok = 0;
- int tmp;
- int i;
- size_t iter;
- char c;
-
- if ( lhandle == NULL )
-  return -1;
-
- func = roar_dl_getsym(lhandle, "_roaraudio_library_init", -1);
- if ( func == NULL ) {
-  fprintf(stderr, "Warning: Not a RA lib: %s\n", name);
-  roar_dl_unref(lhandle);
-  return 0;
- }
-
- lib = func(g_para);
- if ( lib == NULL ) {
-  fprintf(stderr, "Warning: Can not RA init: %s: %s\n", name, roar_error2str(roar_error));
-  roar_dl_unref(lhandle);
-  return 0;
- }
-
- if ( lib->version == ROAR_DL_LIBINST_VERSION && lib->len == sizeof(*lib) ) {
-  libok = 1;
- }
-
- printf("lib                     = %s\n", _ptr2str(lib));
- if ( g_verbose || !libok ) {
-  printf("|-> version             = %i (%smatch)\n", lib->version, lib->version == ROAR_DL_LIBINST_VERSION ? "" : "no ");
-  printf("%c-> len                 = %zu (%smatch)\n", libok ? '|' : '\\', lib->len, lib->len == sizeof(*lib) ? "" : "no ");
- }
-
- if ( libok ) {
-  if ( g_verbose || lib->unload != NULL )
-   printf("|-> unload              = %s\n", _ptr2str(lib->unload));
-  printf("|-> func                = {");
-  i = 0;
-  while (i < ROAR_DL_FN_MAX) {
-   for (tmp = 0; i < ROAR_DL_FN_MAX; i++) {
-    if ( lib->func[i] != NULL ) {
-     break;
-    }
-    tmp++;
-   }
-   if (tmp)
-    printf("%i x <not set>%s", tmp, i < (ROAR_DL_FN_MAX-1) ? ", " : "");
-
-   if ( i < ROAR_DL_FN_MAX ) {
-    printf("[%i] = %s%s", i, _ptr2str(lib->func[i]), i < (ROAR_DL_FN_MAX-1) ? ", " : "");
-    i++;
-   }
-  }
-
-  printf("}\n");
-  printf("|-> libname             = %s\n", _ptr2str(lib->libname));
-  if ( lib->libname != NULL ) {
-   if ( lib->libname->version == ROAR_DL_LIBNAME_VERSION && lib->libname->len == sizeof(*(lib->libname)) ) {
-    libnameok = 1;
-   }
-   if ( g_verbose || !libnameok ) {
-    printf("|   |-> version         = %i (%smatch)\n", lib->libname->version,
-                                                       lib->libname->version == ROAR_DL_LIBNAME_VERSION ? "" : "no ");
-    printf("|   %c-> len             = %zu (%smatch)\n", libnameok ? '|' : '\\', lib->libname->len,
-                                                         lib->libname->len == sizeof(*(lib->libname)) ? "" : "no ");
-   }
-
-   if ( libnameok ) {
-#define _ps(k,name) \
-    tmp = (lib->libname->name) != NULL; \
-    if ( tmp || g_verbose || (k) == '\\' ) \
-    printf("|   %c-> %-15s = %s%s%s\n", (k), #name, tmp ? "\"" : "", \
-                                    tmp ? (lib->libname->name) : "<not set>", tmp ? "\"" : "");
-
-    _ps('|', name);
-    _ps('|', libname);
-    _ps('|', libversion);
-    _ps('|', abiversion);
-    _ps('|', description);
-    _ps('|', contact);
-    _ps('|', authors);
-    _ps('\\', license);
-#undef _ps
-   }
-  }
-  if ( g_verbose || lib->global_data_pointer != NULL )
-   printf("|-> global_data_len     = %zu\n", lib->global_data_len);
-  if ( g_verbose || lib->global_data_init != NULL )
-   printf("|-> global_data_init    = %s\n", _ptrrange2str(lib->global_data_init, lib->global_data_len));
-  if ( g_verbose || lib->global_data_pointer != NULL )
-   printf("|-> global_data_pointer = %s\n", _ptr2str(lib->global_data_pointer));
-
-  if ( lib->libdep != NULL && lib->libdep_len ) {
-   printf("|-> libdep              = %s\n", _ptr2str(lib->libdep));
-   for (iter = 0; iter < lib->libdep_len; iter++) {
-    printf("|   %c-> Table entry %zu   = %p\n", iter == (lib->libdep_len-1) ? '\\' : '|', iter, &(lib->libdep[iter]));
-    c = iter == (lib->libdep_len-1) ? ' ' : '|';
-    if ( lib->libdep[iter].version == ROAR_DL_LIBDEP_VERSION &&
-         lib->libdep[iter].len     == sizeof(struct roar_dl_librarydep) ) {
-     libdepok = 1;
-    } else {
-     libdepok = 0;
-    }
-    if ( g_verbose || !libdepok ) {
-     printf("|   %c   |-> version     = %i (%smatch)\n", c, lib->libdep[iter].version,
-                                                         lib->libdep[iter].version == ROAR_DL_LIBDEP_VERSION ? "" : "no ");
-     printf("|   %c   %c-> len         = %zu (%smatch)\n", c, libdepok ? '|' : '\\',
-                                                        lib->libdep[iter].len,
-                                                        lib->libdep[iter].len == sizeof(struct roar_dl_librarydep) ?
-                                                        "" : "no ");
-    }
-
-    if ( libdepok ) {
-     printf("|   %c   |-> flags       = 0x%.8lX\n", c, (unsigned long int)lib->libdep[iter].flags);
-#define _ps(k,name) \
-    tmp = (lib->libdep[iter].name) != NULL; \
-    if ( tmp || g_verbose || (k) == '\\' ) \
-    printf("|   %c   %c-> %-11s = %s%s%s\n", c, (k), #name, tmp ? "\"" : "", \
-                                    tmp ? (lib->libdep[iter].name) : "<not set>", tmp ? "\"" : "");
-     _ps('|', name);
-     _ps('|', libname);
-     _ps('\\', abiversion);
-#undef _ps
-    }
-   }
-   printf("|-> libdep_len          = %zu\n", lib->libdep_len);
-  } else if ( (lib->libdep == NULL && lib->libdep_len) || (lib->libdep != NULL && !lib->libdep_len) ) {
-   printf("|-> libdep              = %s (invalid)\n", _ptr2str(lib->libdep));
-   printf("|-> libdep_len          = %zu (invalid)\n", lib->libdep_len);
-  }
-  if ( g_verbose || lib->appsched != NULL ) {
-   printf("|-> appsched            = %s\n", _ptr2str(lib->appsched));
-   if ( lib->appsched != NULL ) {
-    if ( g_verbose || lib->appsched->init != NULL )
-     printf("|   |-> init            = %s\n", _ptr2str(lib->appsched->init));
-    if ( g_verbose || lib->appsched->free != NULL )
-     printf("|   |-> free            = %s\n", _ptr2str(lib->appsched->free));
-    if ( g_verbose || lib->appsched->update != NULL )
-     printf("|   |-> update          = %s\n", _ptr2str(lib->appsched->update));
-    if ( g_verbose || lib->appsched->tick != NULL )
-     printf("|   |-> tick            = %s\n", _ptr2str(lib->appsched->tick));
-    printf("|   \\-> wait            = %s\n", _ptr2str(lib->appsched->wait));
-   }
-  }
-#define _ps(k,name) \
-    tmp = (lib->name) != NULL; \
-    if ( tmp || g_verbose || (k) == '\\' ) \
-    printf("%c-> %-19s = %s%s%s\n", (k), #name, tmp ? "\"" : "", \
-                                    tmp ? (lib->name) : "<not set>", tmp ? "\"" : "");
-  _ps('|', host_appname);
-  _ps('\\', host_abiversion);
-#undef _ps
- }
-
- roar_dl_unref(lhandle);
- return 0;
-}
-
-static int do_plugin(enum action action, const char * name, int options) {
- switch (action) {
-  case EXPLAIN:
-    return do_explain(name);
-   break;
-  case RUN:
-  case RUN_AS_APPLICATION:
-    return do_run(name, options);
-   break;
-  default:
-    roar_err_set(ROAR_ERROR_BADRQC);
-    return -1;
-   break;
- }
-}
-
-static inline void _clear_para(void) {
- if ( g_para == NULL )
-  return;
-
- roar_dl_para_unref(g_para);
- g_para = NULL;
-}
-
-static inline int _add_para(struct roar_dl_librarypara * para, const char * pluginargs, size_t argc, char * argv[]) {
- struct roar_keyval * kv;
- ssize_t argslen, argvlen;
- ssize_t arglen;
- ssize_t pluginargc;
- size_t argv_phys = argc;
- size_t i;
- int error;
- char * sp, * c;
- int after_parser_end;
-
- if ( pluginargs == NULL )
-  pluginargs = "";
-
- argslen = roar_mm_strlen(pluginargs) + 1 /* tailing '\0' */;
-
- after_parser_end = 0;
- argvlen = 0;
- for (i = 0; i < argv_phys; i++) {
-  arglen   = roar_mm_strlen(argv[i]);
-  argvlen += arglen;
-  if ( !after_parser_end ) {
-   if ( !strcmp(argv[i], "--") ) {
-    after_parser_end = 1;
-    argc--;
-   } else if ( arglen > 1 && argv[i][0] == '-' && !(arglen > 2 && argv[i][1] == '-') ) {
-    argc += arglen - 2;
-   }
-  }
- }
- argvlen += argc; // the '\0's.
-
- para->args_store = roar_mm_malloc(argslen+argvlen);
- if ( para == NULL )
-  return -1;
-
- memcpy(para->args_store, pluginargs, argslen);
-
- pluginargc = roar_keyval_split(&kv, para->args_store, NULL, NULL, 1);
- if ( pluginargc == -1 ) {
-  error = roar_error;
-  roar_mm_free(para->args_store);
-  para->args_store = NULL;
-  roar_error = error;
-  return -1;
- }
-
- para->argv = roar_mm_malloc((pluginargc+argc)*sizeof(struct roar_keyval));
- if ( para->argv == NULL ) {
-  error = roar_error;
-  roar_mm_free(kv);
-  roar_mm_free(para->args_store);
-  para->args_store = NULL;
-  roar_error = error;
-  return -1;
- }
-
- para->argc = pluginargc + argc;
-
- memcpy(para->argv, kv, pluginargc*sizeof(struct roar_keyval));
- roar_mm_free(kv);
-
- sp = para->args_store + argslen;
- kv = para->argv + pluginargc;
-
- after_parser_end = 0;
- for (i = 0; i < argv_phys; i++) {
-  arglen = roar_mm_strlen(argv[i]) + 1;
-  if ( after_parser_end || !(arglen > 2 && argv[i][0] == '-' && !(arglen > 3 && argv[i][1] == '-')) )
-   memcpy(sp, argv[i], arglen);
-
-  if ( !after_parser_end && !strcmp(argv[i], "--") ) {
-   after_parser_end = 1;
-   continue;
-  } else if ( !after_parser_end && arglen > 3 && sp[0] == '-' && sp[1] == '-' ) {
-   kv->key = sp + 2;
-   kv->value = NULL;
-   for (c = sp + 2; *c; c++) {
-    if (*c == '=') {
-     *c = 0;
-     c++;
-     kv->value = c;
-     break;
-    }
-   }
-  } else if ( !after_parser_end && arglen > 2 && argv[i][0] == '-' ) {
-   for (c = argv[i] + 1; *c; c++) {
-    sp[0] = *c;
-    sp[1] = 0;
-    kv->key = sp;
-    kv->value = NULL;
-    sp += 2;
-    kv++;
-   }
-   continue;
-  } else {
-   kv->key = NULL;
-   kv->value = sp;
-  }
-
-  sp += arglen;
-  kv++;
- }
-
- return 0;
-}
-
-static struct roar_scheduler_source * add_cpi_common(int proto) {
- struct roar_scheduler_source * source;
- int err;
-
- if ( proto == -1 ) {
-  roar_err_set(ROAR_ERROR_INVAL);
-  return NULL;
- }
-
- source = roar_mm_malloc(sizeof(struct roar_scheduler_source));
- if ( source == NULL )
-  return NULL;
-
- memset(source, 0, sizeof(struct roar_scheduler_source));
-
- source->vio   = roar_mm_malloc(sizeof(struct roar_vio_calls));
- if ( source->vio == NULL ) {
-  err = roar_error;
-  roar_mm_free(source);
-  roar_error = err;
-  return NULL;
- }
-
- source->flags = ROAR_SCHEDULER_FLAG_FREE;
- source->handle.cpi.proto = proto;
-
- return source;
-}
-
-static int add_cpi_listen(int proto, int type, const char * host, int port) {
- struct roar_scheduler_source * source = add_cpi_common(proto);
- int err;
-
- if ( source == NULL )
-  return -1;
-
- if ( roar_vio_open_socket_listen(source->vio, type, host, port) == -1 ) {
-  err = roar_error;
-  roar_mm_free(source->vio);
-  roar_mm_free(source);
-  roar_error = err;
-  return -1;
- }
-
- source->type  = ROAR_SCHEDULER_CPI_LISTEN;
-
- source->vio->flags |= ROAR_VIO_FLAGS_FREESELF;
-
- if ( roar_scheduler_source_add(g_sched, source) == -1 ) {
-  err = roar_error;
-  roar_vio_close(source->vio);
-  roar_mm_free(source);
-  roar_error = err;
-  return -1;
- }
-
- return 0;
-}
-
-static int add_cpi_client(int proto, int fh) {
- struct roar_scheduler_source * source = add_cpi_common(proto);
- struct roar_dl_librarypara * para;
- int err;
-
- if ( source == NULL )
-  return -1;
-
- if ( roar_vio_open_fh(source->vio, fh) == -1 ) {
-  err = roar_error;
-  roar_mm_free(source->vio);
-  roar_mm_free(source);
-  roar_error = err;
-  return -1;
- }
-
- source->type  = ROAR_SCHEDULER_CPI_CLIENT;
-
- source->vio->flags |= ROAR_VIO_FLAGS_FREESELF;
-
- if ( roar_scheduler_source_add(g_sched, source) == -1 ) {
-  err = roar_error;
-  roar_vio_close(source->vio);
-  roar_mm_free(source);
-  roar_error = err;
-  return -1;
- }
-
- if ( source->flags & ROAR_SCHEDULER_FLAG_STUB ) {
-  ROAR_ERR("Can not handle proto STUB clients. Try to use --client-fh as last argument.");
-
-  roar_scheduler_source_del(g_sched, source);
-
-  return -1;
- }
-
- if ( source->handle.cpi.impl->set_proto != NULL ) {
-  para = roar_dl_getpara(source->lhandle);
-
-  if ( source->lhandle != NULL )
-   roar_dl_context_restore(source->lhandle);
-  source->handle.cpi.impl->set_proto(source->handle.cpi.client, source->vio, &(source->handle.cpi.obuffer), &(source->handle.cpi.userdata), source->handle.cpi.protopara, source->handle.cpi.protoparalen, para);
-  if ( source->lhandle != NULL )
-   roar_dl_context_store(source->lhandle);
-
-  if ( para != NULL )
-   roar_dl_para_unref(para);
- }
-
- return 0;
-}
-
-int main (int argc, char * argv[]) {
- const char * appname    = "roarpluginrunner " ROAR_VSTR_ROARAUDIO;
- const char * abiversion = "1.0beta0";
- const char * pluginargs = NULL;
- enum action action = RUN;
- int ret = 0;
- int i;
- const char * k;
- int cpi_type = ROAR_SOCKET_TYPE_UNKNOWN;
- int cpi_proto = -1;
- int cpi_port = 0;
- int cpi_touched = 0;
- const char * cpi_host = NULL;
- int options = OPTION_NONE;
-
- g_sched = roar_scheduler_new(ROAR_SCHEDULER_FLAG_NONE, ROAR_SCHEDULER_STRATEGY_DEFAULT);
- if ( g_sched == NULL ) {
-  fprintf(stderr, "Error creating scheduler object: %s\n", roar_error2str(roar_error));
-  return 1;
- }
-
- roar_scheduler_source_add(g_sched, &g_s_service);
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( !strcmp(k, "-h") || !strcmp(k, "--help") ) {
-   usage(argv[0]);
-   roar_scheduler_unref(g_sched);
-   return 0;
-  } else if ( !strcmp(k, "--run") ) {
-   action = RUN;
-  } else if ( !strcmp(k, "--run-as-application") ) {
-   action = RUN_AS_APPLICATION;
-  } else if ( !strcmp(k, "--explain") ) {
-   action = EXPLAIN;
-  } else if ( !strcmp(k, "-v") || !strcmp(k, "--verbose") ) {
-   g_verbose++;
-  } else if ( !strcmp(k, "--server") ) {
-   ROAR_CKHAVEARGS(1);
-   roar_libroar_set_server(argv[++i]);
-
-  } else if ( !strcmp(k, "--tcp") || !strcmp(k, "-t") ) {
-   cpi_type = ROAR_SOCKET_TYPE_TCP;
-   cpi_touched++;
-  } else if ( !strcmp(k, "--unix") || !strcmp(k, "-u") ) {
-   cpi_type = ROAR_SOCKET_TYPE_UNIX;
-   cpi_touched++;
-  } else if ( !strcmp(k, "--decnet") || !strcmp(k, "-n") ) {
-   cpi_type = ROAR_SOCKET_TYPE_DECNET;
-   cpi_touched++;
-  } else if ( !strcmp(k, "--port") ) {
-   ROAR_CKHAVEARGS(1);
-   cpi_port = atoi(argv[++i]);
-   cpi_touched++;
-  } else if ( !strcmp(k, "--bind") ) {
-   ROAR_CKHAVEARGS(1);
-   cpi_host = argv[++i];
-   cpi_touched++;
-  } else if ( !strcmp(k, "--proto") ) {
-   ROAR_CKHAVEARGS(1);
-   cpi_proto = roar_str2proto(argv[++i]);
-   if ( cpi_proto == -1 ) {
-    fprintf(stderr, "Unknown protocol: %s: %s\n", argv[i], roar_error2str(roar_error));
-    return 1;
-   }
-  } else if ( !strcmp(k, "--new-sock") ) {
-   if ( cpi_touched && add_cpi_listen(cpi_proto, cpi_type, cpi_host, cpi_port) == -1 ) {
-    fprintf(stderr, "Can not open socket for CPI: %s\n", roar_error2str(roar_error));
-    return 1;
-   }
-   cpi_touched = 0;
-  } else if ( !strcmp(k, "--client-fh") ) {
-   ROAR_CKHAVEARGS(1);
-   if ( add_cpi_client(cpi_proto, atoi(argv[++i])) == -1 ) {
-    fprintf(stderr, "Can not add CPI client: %s\n", roar_error2str(roar_error));
-    return 1;
-   }
-
-#define _option(name) \
-  } else if ( !strcasecmp(k, "--option-" #name) ) { \
-   options |= OPTION_ ## name; \
-  } else if ( !strcasecmp(k, "--option-no-" #name) ) { \
-   options |= OPTION_ ## name; \
-   options -= OPTION_ ## name;
-#define __fix_vim_syntax_highlight }
-  _option(TOUCH)
-  _option(ABOUT)
-  _option(HELP)
-  _option(PREFERENCES)
-
-  } else if ( !strcmp(k, "--appname") ) {
-   ROAR_CKHAVEARGS(1);
-   appname = argv[++i];
-   _clear_para();
-  } else if ( !strcmp(k, "--abiversion") ) {
-   ROAR_CKHAVEARGS(1);
-   abiversion = argv[++i];
-   _clear_para();
-  } else if ( !strcmp(k, "--args") ) {
-   ROAR_CKHAVEARGS(1);
-   pluginargs = argv[++i];
-   _clear_para();
-  } else {
-   if ( cpi_touched && add_cpi_listen(cpi_proto, cpi_type, cpi_host, cpi_port) == -1 ) {
-    fprintf(stderr, "Can not open socket for CPI: %s\n", roar_error2str(roar_error));
-    return 1;
-   }
-   cpi_touched = 0;
-
-   if ( g_para == NULL )
-    g_para = roar_dl_para_new(action == RUN_AS_APPLICATION ? NULL : pluginargs, NULL, appname, abiversion);
-   if ( action == RUN_AS_APPLICATION && _add_para(g_para, pluginargs, argc - i - 1, &(argv[i+1])) == -1 ) {
-    fprintf(stderr, "Error parsing plugin arguments: %s\n", roar_error2str(roar_error));
-   } else {
-    roar_err_set(ROAR_ERROR_NONE);
-    if ( do_plugin(action, k, options) == -1 ) {
-     fprintf(stderr, "Error loading plugin: %s\n",
-                     roar_error != ROAR_ERROR_NONE ? roar_error2str(roar_error) : roar_dl_errstr(NULL));
-     ret = 1;
-    }
-   }
-   if ( action == RUN_AS_APPLICATION )
-    break; // end looping over arguments
-  }
- }
-
- _clear_para();
-
- roar_scheduler_unref(g_sched);
- return ret;
-}
-
-//ll
Index: roarclients/roarradio.c
===================================================================
--- roarclients/roarradio.c	(revision 6052)
+++ 	(revision )
@@ -1,248 +1,0 @@
-//roarradio.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define P_UNKNOWN 0
-#define P_HTTP    1
-#define P_GOPHER  2
-
-void usage (void) {
- printf("roarradio [OPTIONS]... [FILE|URL]\n");
-
- printf("\nOptions:\n\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"
-       );
-
-}
-
-static void die(const char * msg) {
- fprintf(stderr, "Fatal error: %s\n", msg);
- abort();
-}
-
-int main (int argc, char * argv[]) {
- struct roar_audio_info info;
- const char * server   = NULL;
- const char * k;
- int    i;
- int    in = -1;
- char * file = NULL;
- char * host;
- int    port;
- FILE * http;
- struct roar_connection con[1];
- struct roar_stream     stream[1];
- char buf0[80], buf1[80];
- int proto = P_UNKNOWN;
- 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];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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();
-   return 0;
-  } else if ( file == NULL ) {
-   file = argv[i];
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( file == NULL ) {
-  file = "/dev/stdin";
-  in   = ROAR_STDIN;
- } else {
-  if ( strncmp(file, "http://", 7) == 0 ) {
-   proto = P_HTTP;
-   host  = file+7;
-   port  = 80;
-  } else if ( strncmp(file, "gopher://", 9) == 0 ) {
-   proto = P_GOPHER;
-   host  = file+9;
-   port  = 70;
-  } else {
-   fprintf(stderr, "Error: unknown protocol: %s\n", file);
-   return 20;
-  }
-
-  if ( proto == P_HTTP || proto == P_GOPHER ) {
-   for (i = 0; host[i] != 0; i++) {
-    if ( host[i] == ':' ) {
-     port    = atoi(host+i+1); // atoi() ignores the rest after '/'
-     host[i] = 0;
-    } else if ( host[i] == '/' ) {
-     file    = host+i;
-     break;
-    }
-   }
-
-   if ( !*file ) {
-    file = "/";
-
-    if ( (in = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) {
-     ROAR_ERR("can not connect to remote server %s (port %i): %s", host, port, strerror(errno));
-     return 0;
-    }
-   } else {
-    *file = 0;
-
-    if ( (in = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) {
-     ROAR_ERR("can not connect to remote server %s (port %i): %s", host, port, strerror(errno));
-     return 0;
-    }
-
-    *file = '/';
-   }
-
-   switch (proto) {
-    case P_HTTP:
-      if ( (http = fdopen(in, "r+")) == NULL ) {
-       ROAR_ERR("can not create FILE* object: %s", strerror(errno));
-       return 0;
-      }
-
-      fprintf(http, "GET %s HTTP/1.1\r\n", file);
-      fprintf(http, "Host: %s\r\n", host);
-      fprintf(http, "User-Agent: roarradio $Revision$\r\n");
-      fprintf(http, "Connection: close\r\n");
-      fprintf(http, "\r\n");
-      fflush(http);
-
-      if ( fscanf(http, "%79s %i %79s\n", buf0, &port, buf1) != 3 ) {
-       ROAR_ERR("HTTP protocol error!, no initial HTTP/1.x-line!");
-       return 1;
-      }
-      if ( port != 200 ) { // 200 = HTTP OK
-       ROAR_ERR("HTTP Error: %i - %s", port, buf1);
-       return 1;
-      }
-
-      *buf0 = 0;
-
-      while (*buf0 != '\r' && *buf0 != '\n') {
-       if ( fgets(buf0, 80, http) == NULL )
-        die("Can not read header lion");
-      }
-
-      fflush(http);
-     break;
-    case P_GOPHER:
-      if ( file[0] == 0 ) {
-       file[0] = '/';
-       file[1] = 0;
-      } else if ( file[0] == '/' && file[1] != 0 && file[2] == '/' ) { // strip the type prefix
-       file += 2;
-      }
-      // TODO: do some error checks here
-      slen = strlen(file);
-      if ( write(in, file, slen) != slen )
-       die("Can not write selector");
-      if ( write(in, "\r\n", 2) != 2 )
-       die("Can not write selector terminator");
-      ROAR_SHUTDOWN(in, SHUT_WR);
-     break;
-   }
-  } else {
-   if ( (in = open(file, O_RDONLY, 0644)) == -1 ) {
-    ROAR_ERR("can not open file: %s: %s", file, strerror(errno));
-    return 1;
-   }
-  }
- }
-
- if ( in == -1 ) {
-  ROAR_ERR("No open file, bad. This should not happen");
-  return 1;
- }
-
- if ( roar_simple_connect(con, server, "roarradio") == -1 ) {
-  ROAR_ERR("Can not connect to server");
-  return 1;
- }
-
- if ( roar_stream_new_by_info(stream, &info) == -1 ) {
-  roar_disconnect(con);
-  return 1;
- }
-
- if ( roar_stream_connect(con, stream, ROAR_DIR_PLAY, -1) == -1 ) {
-  roar_disconnect(con);
-  return 1;
- }
-
- if ( roar_stream_passfh(con, stream, in) == -1 ) {
-  roar_disconnect(con);
-  return 1;
- }
-
- close(in);
-
- if ( roar_stream_attach_simple(con, stream, 0) == -1 ) {
-  ROAR_ERR("Can not attach stream to server");
- }
-
- roar_disconnect(con);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarshout.c
===================================================================
--- roarclients/roarshout.c	(revision 6052)
+++ 	(revision )
@@ -1,312 +1,0 @@
-//roarshout.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#ifdef ROAR_HAVE_LIBSHOUT
-#include <shout/shout.h>
-
-#define BUFSIZE 2048
-
-void usage (void) {
- printf("roarshout [OPTIONS]... [address [port [password [mountpoint]]]\n");
-
- printf("\nRoarAudio Options:\n\n");
-
- printf("    --server SERVER    - Set server hostname\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"
-        "    --pw-ask           - Ask user for password interactively.\n"
-        "    --pw-dstr          - Read password from file. Filename is supplied\n"
-        "                         as normal password argument.\n"
-       );
-
- printf("\nlibshout Options:\n\n");
-
- printf(" -p --public           - Allow listing in stream directory\n"
-        " -d          DESC      - Set stream description\n"
-        " -g          GENRE     - Set stream genre\n"
-        " -n          NAME      - Set stream name\n"
-        " -u          URL       - Set stream URL/homepage\n"
-       );
-
-}
-
-char * read_pw_from_file(char * filename, char * buffer, size_t bufferlen) {
- struct roar_vio_defaults def;
- struct roar_vio_calls file;
- ssize_t len;
-
- if (filename == NULL || buffer == NULL)
-  return NULL;
-
- if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 )
-  return NULL;
-
- if ( roar_vio_open_dstr(&file, filename, &def, 1) == -1 )
-  return NULL;
-
- len = roar_vio_read(&file, buffer, bufferlen - 1);
-
- if ( len == -1 )
-  return NULL;
-
- // strip newlions.
- for (; buffer[len-1] == '\r' || buffer[len-1] == '\n'; len--);
-
- buffer[len] = 0;
-
- roar_vio_close(&file);
-
- return buffer;
-}
-
-int main (int argc, char * argv[]) {
- enum { ARG, ASK, DSTR } pw_source = ARG;
- struct roar_audio_info info;
- const char * server   = NULL;
- const char * k;
- const char * s_server = NULL;
- const char * s_mount  = NULL;
- char * s_pw     = NULL;
- int    s_port   = -1;
- const char * s_desc   = NULL;
- const char * s_genre  = NULL;
- const char * s_name   = NULL;
- const char * s_url    = NULL;
- int    s_public = 0;
- roar_vs_t * vss;
- int    err;
- ssize_t ret;
- int    i;
- char buf[BUFSIZE];
- shout_t * shout;
- 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];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.codec = roar_str2codec(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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;
-  } else if ( strcmp(k, "--pw-ask") == 0 ) {
-   pw_source = ASK;
-  } else if ( strcmp(k, "--pw-dstr") == 0 ) {
-   pw_source = DSTR;
-  } else if ( strcmp(k, "-p") == 0 || strcmp(k, "--public") == 0 ) {
-   s_public = 1;
-  } else if ( strcmp(k, "-d") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   s_desc   = argv[++i];
-  } else if ( strcmp(k, "-g") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   s_genre  = argv[++i];
-  } else if ( strcmp(k, "-n") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   s_name   = argv[++i];
-  } else if ( strcmp(k, "-u") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   s_url    = argv[++i];
-  } else if ( strcmp(k, "-h") == 0 || strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else if ( s_server == NULL ) {
-   ROAR_CKHAVEARGS(1);
-   s_server = k;
-  } else if ( s_port   == -1 ) {
-   ROAR_CKHAVEARGS(1);
-   s_port   = atoi(k);
-  } else if ( s_pw     == NULL ) {
-   ROAR_CKHAVEARGS(1);
-   s_pw     = argv[i]; // do not use k here so k can be const.
-  } else if ( s_mount  == NULL ) {
-   ROAR_CKHAVEARGS(1);
-   s_mount  = k;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- switch (pw_source) {
-  case ARG:
-    // nothing to do
-   break;
-  case ASK:
-    if ( roar_passwd_simple_ask_pw(&s_pw, "Password for icecast server?", NULL) == -1 ) {
-     fprintf(stderr, "Error: unabled to read password from user.\n");
-     return 1;
-    }
-    strncpy(password_buf, s_pw, sizeof(password_buf)-1);
-    roar_mm_free(s_pw);
-    password_buf[sizeof(password_buf)-2] = 0;
-    s_pw = password_buf;
-   break;
-  case DSTR:
-    if ( (s_pw = read_pw_from_file(s_pw, password_buf, sizeof(password_buf))) == NULL ) {
-     fprintf(stderr, "Error: unabled to read password from file.\n");
-     return 1;
-    }
-   break;
- }
-
- if ( s_server == NULL )
-  s_server = "localhost";
-
- if ( s_mount == NULL )
-  s_mount  = "/roar.ogg";
-
- if ( s_pw == NULL )
-  s_pw     = "hackme";
-
- if ( s_port == -1 )
-  s_port   = 8000;
-
- if ( !strcasecmp(s_pw, "hackme") ) {
-  fprintf(stderr, "Warning: Your password is very weak. Change it!\n");
- }
-
- shout_init();
-
- if (!(shout = shout_new())) {
-  ROAR_ERR("Can not create shout object");
-  return 1;
- }
-
- if (shout_set_host(shout, s_server) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting hostname: %s", shout_get_error(shout));
-  return 1;
- }
-
- if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting protocol: %s", shout_get_error(shout));
-  return 1;
- }
-
- if (shout_set_port(shout, s_port) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting port: %s", shout_get_error(shout));
-  return 1;
- }
-
- if (shout_set_password(shout, s_pw) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting password: %s", shout_get_error(shout));
-  return 1;
- }
-
- if (shout_set_mount(shout, s_mount) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting mount: %s", shout_get_error(shout));
-  return 1;
- }
-
- if (shout_set_user(shout, "source") != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting user: %s", shout_get_error(shout));
-  return 1;
- }
-
- if (shout_set_format(shout, SHOUT_FORMAT_OGG) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Error setting format: %s", shout_get_error(shout));
-  return 1;
- }
-
- shout_set_public(shout, s_public);
-
- if (s_desc  != NULL)
-  shout_set_description(shout, s_desc);
-
- if (s_genre != NULL)
-  shout_set_genre(shout, s_genre);
-
- if (s_name  != NULL)
-  shout_set_name(shout, s_name);
-
- if (s_url   != NULL)
-  shout_set_url(shout, s_url);
-
- 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;
- }
-
- if (shout_open(shout) != SHOUTERR_SUCCESS) {
-  ROAR_ERR("Can not open connection via libshout!");
-  return -1;
- }
-
- while((ret = roar_vs_read(vss, buf, BUFSIZE, NULL)))
-  if (shout_send(shout, (unsigned char*)buf, i) != SHOUTERR_SUCCESS)
-   break;
-
- roar_vs_close(vss, ROAR_VS_TRUE, NULL);
-
- shout_sync(shout);
-
- shout_close(shout);
-
- shout_shutdown();
-
- return 0;
-}
-
-#else
-int main (void) {
- fprintf(stderr, "No libshout support compiled in!\n");
- return 1;
-}
-#endif
-//ll
Index: roarclients/roarsin.c
===================================================================
--- roarclients/roarsin.c	(revision 6052)
+++ 	(revision )
@@ -1,191 +1,0 @@
-//roarsin.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>  /* libroar */
-
-#ifdef ROAR_HAVE_LIBM
-
-#include <math.h>       /* sin() */
-#include <stdio.h>      /* *printf*() */
-
-double rect (double x) {
- x /= 2*M_PI;
- x -= (int)x;
-
- if ( x < 0.5 )
-  return  1;
- else
-  return -1;
-}
-
-double saw (double x) {
- x /= 2*M_PI;
- x -= (int)x;
-
- return 2*x - 1;
-}
-
-double tri (double x) {
- x /= 2*M_PI;
- x -= (int)x;
-
- if ( x < 0.5 )
-  return   4* x      - 1;
- else
-  return  -4*(x-0.5) + 1;
-}
-
-double trap (double x) {
- x /= 2*M_PI;
- x -= (int)x;
-
- if ( x < 0.125 || x > 0.875 ) {
-  return -1;
- } else if ( x < 0.625 && x > 0.375 ) {
-  return  1;
- } else if ( x < 0.5 ) {
-  return  8*(x-0.375) + 1;
- } else {
-  return -8*(x-0.625) + 1;
- }
-}
-
-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"
-         "  --volume VOL            - Set volume\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 * k;
- const char * server = NULL;
- int rate     = ROAR_RATE_DEFAULT;
- float freq   = 523.2;            /* middle C */
- float t      = 0; /* current time */
- float tcalc  = 0; /* current time for calculation */
- float length = 5; /* 5 sec */
- float step;       /* how much time per sample we have to encode ... */
- roar_vs_t * vss;
- int err;
- int i;
- int16_t out[1024];
- double (*func)(double x) = sin;
- double volume = 1;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-  if ( !strcmp(k, "--freq") ) {
-   ROAR_CKHAVEARGS(1);
-   freq   = atof(argv[++i]);
-  } else if ( !strcmp(k, "--time") ) {
-   ROAR_CKHAVEARGS(1);
-   length = atof(argv[++i]);
-  } else if ( !strcmp(k, "--server") ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-R") ) {
-   ROAR_CKHAVEARGS(1);
-   rate = roar_str2rate(argv[++i]);
-  } else if ( !strcmp(k, "--volume") ) {
-   ROAR_CKHAVEARGS(1);
-   volume = atof(argv[++i]);
-  } else if ( !strcmp(k, "--sin") ) {
-   func   = sin;
-  } else if ( !strcmp(k, "--rect") ) {
-   func   = rect;
-  } else if ( !strcmp(k, "--saw") ) {
-   func   = saw;
-  } else if ( !strcmp(k, "--tri") ) {
-   func   = tri;
-  } else if ( !strcmp(k, "--trap") ) {
-   func   = trap;
-  } else if ( !strcmp(k, "--help") ) {
-   usage(argv[0]);
-   return 0;
-  } else {
-   usage(argv[0]);
-   return 2;
-  }
- }
-
- step   = M_PI*2*freq/rate;
-
- if ( (vss = roar_vs_new_playback(server, "sine gen", rate, 1, ROAR_CODEC_DEFAULT, 16, &err)) == NULL ) {
-  fprintf(stderr, "Error: can not open playback: %s\n", roar_vs_strerr(err));
-  exit(1);
- }
-
- if ( roar_vs_volume_mono(vss, volume, NULL) == 0 ) {
-  // If setting server volume successed set local volume to one.
-  volume = 1;
- }
-
- while (t < 2*M_PI*freq*length) {
-  for (i = 0; i < 1024; i++) {
-   out[i] = 32767.*volume*func(tcalc);
-   t     += step;
-   tcalc += step;
-  }
-  if ( roar_vs_write(vss, out, 2048, &err) != (ssize_t)2048 ) {
-   fprintf(stderr, "Error: can not write data: %s\n", roar_vs_strerr(err));
-   break;
-  }
-
-  // this code enables us to generate the same signal for a long periode of time
-  // without loosing accuracy of the float type.
-  while (tcalc > 2*M_PI)
-   tcalc -= 2*M_PI;
- }
-
- roar_vs_close(vss, ROAR_VS_FALSE, NULL);
-
- return 0;
-}
-
-#else
-int main (void) {
- fprintf(stderr, "Error: No Math library support compiled in.\n");
- return 1;
-}
-#endif
-
-//ll
Index: roarclients/roarsockconnect.c
===================================================================
--- roarclients/roarsockconnect.c	(revision 6052)
+++ 	(revision )
@@ -1,63 +1,0 @@
-//roarsockconnect.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <string.h>
-#include <stdio.h>
-
-void usage (void) {
- fprintf(stderr, "Usage: roarsockconnect HOST PORT\n");
-
- exit(1);
-}
-
-int main (int argc, char * argv[]) {
- char buf[1024];
- int fh;
- int port;
- int len;
-
- roar_debug_bin_obsolete(argv[0], NULL, NULL);
-
- if ( argc != 3 )
-  usage();
-
- port     = atoi(argv[2]);
-
- if ( (fh = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, argv[1], port)) == -1 ) {
-  ROAR_ERR("Error: can not connect!");
-  return 1;
- }
-
- while ((len = read(ROAR_STDIN, buf, 1024)))
-  write(fh, buf, len);
-
- while ((len = read(fh, buf, 1024)))
-  write(ROAR_STDOUT, buf, len);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarsocktypes.c
===================================================================
--- roarclients/roarsocktypes.c	(revision 6052)
+++ 	(revision )
@@ -1,64 +1,0 @@
-//roarsocktypes.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-static const struct {
- const char * name;
- int (*func)(void);
-} tests[] = {
- {"TCPv4"           , roar_socket_new_tcp },
- {"UDPv4"           , roar_socket_new_udp },
- {"TCPv6"           , roar_socket_new_tcp6},
- {"UDPv6"           , roar_socket_new_udp6},
- {"UNIX"            , roar_socket_new_unix},
- {"DECnet seqpacket", roar_socket_new_decnet_seqpacket},
- {"DECnet stream"   , roar_socket_new_decnet_stream},
- {"IPX"             , roar_socket_new_ipx},
- {"IPX/SPX"         , roar_socket_new_ipxspx},
- {NULL, NULL}
-};
-
-int main (int argc, char * argv[]) {
- int i, fh;
-
- roar_debug_bin_obsolete(argv[0], NULL, NULL);
-
- for (i = 0; tests[i].func; i++) {
-  printf("Type %-16s ", tests[i].name);
-  errno = 0;
-  fh = tests[i].func();
-  if ( fh == -1 ) {
-   printf("not working: %s\n", strerror(errno));
-  } else {
-   close(fh);
-   printf("working\n");
-  }
- }
-
- return 0;
-}
-
-//ll
Index: roarclients/roartypes.c
===================================================================
--- roarclients/roartypes.c	(revision 6052)
+++ 	(revision )
@@ -1,68 +1,0 @@
-//roartypes.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#undef ROAR_DBG_PREFIX
-#include "../roard/include/roard.h"
-#undef ROAR_DBG_PREFIX
-#define ROAR_DBG_PREFIX "roartypes"
-
-int main (int argc, char * argv[]) {
- struct { const char * name; int len; } types[] = {
-//  { "roar_buffer",         sizeof(struct roar_buffer)         },
-  { "roar_stack",          sizeof(struct roar_stack)          },
-  { "roar_message",        sizeof(struct roar_message)        },
-  { "roar_stream",         sizeof(struct roar_stream)         },
-  { "roar_stream_server",  sizeof(struct roar_stream_server)  },
-  { "roar_mixer_settings", sizeof(struct roar_mixer_settings) },
-  { "roar_sample",         sizeof(struct roar_sample)         },
-  { "roar_client",         sizeof(struct roar_client)         },
-  { "roar_client_server",  sizeof(struct roar_client_server)  },
-  { "roard_config",        sizeof(struct roard_config)        },
-  { "roar_connection",     sizeof(struct roar_connection)     },
-  { "roar_audio_info",     sizeof(struct roar_audio_info)     },
-  { "roar_meta",           sizeof(struct roar_meta)           },
-  { "roar_vio_calls",      sizeof(struct roar_vio_calls)      },
-  { "roar_stack",          sizeof(struct roar_stack)          },
-  { "roar_vio_defaults",   sizeof(struct roar_vio_defaults)   },
-  { "roar_vio_dstr_chain", sizeof(struct roar_vio_dstr_chain) },
-#ifndef ROAR_WITHOUT_DCOMP_MIDI
-  { "midi_message",        sizeof(struct midi_message)        },
-#endif
-  { "roar_note_octave",    sizeof(struct roar_note_octave)    },
-  { "roar_libroar_config", sizeof(struct roar_libroar_config) },
-  { NULL, 0 }
- }, * c = types - 1;
-
- (void)argc;
- roar_debug_bin_obsolete(argv[0], NULL, NULL);
-
- while ((++c)->name != NULL)
-  printf("%-20s = %5i Bytes = %6i Bits\n", c->name, c->len, c->len * 8);
-
- return 0;
-}
-
-//ll
Index: roarclients/roarvio.c
===================================================================
--- roarclients/roarvio.c	(revision 6052)
+++ 	(revision )
@@ -1,275 +1,0 @@
-//roarvio.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-int g_verbose = 0;
-#define ROAR_DBG_INFOVAR g_verbose
-
-#include <roaraudio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-enum action {
- READ,
- WRITE,
- PASS,
- EXPLAIN
-};
-
-
-void usage (const char * progname) {
- fprintf(stderr, "Usage: %s [OPTIONS]... FILE [FILE]\n", progname);
-
- fprintf(stderr, "\nOptions:\n\n");
-
- fprintf(stderr, " -h --help         - This help.\n"
-                 "    --verbose      - Be verbose. Can be used multiple times.\n"
-                 "    --read         - Reading mode (like 'cat file').\n"
-                 "    --write        - Writing mode (like 'cat > file').\n"
-                 "    --pass         - Passing mode (like 'cat infile > outfile').\n"
-                 "    --explain      - Explain VIO object.\n");
-}
-
-ssize_t do_explain (struct roar_vio_calls * cur) {
- struct roar_sockname sockname;
- int                  have_sockname;
- int need_space, need_space2;
- int level = 0;
- int fh;
- const char * name;
- const char * codec;
- const char * content_type;
-
- while (cur != NULL) {
-  if ( roar_vio_ctl(cur, ROAR_VIO_CTL_GET_NAME, &name) == -1 )
-   name = "UNKNOWN";
-
-  if ( g_verbose ) {
-   if ( roar_vio_ctl(cur, ROAR_VIO_CTL_GET_MIMETYPE, &content_type) == -1 )
-    content_type = "UNKNOWN";
-
-   codec = roar_codec2str(roar_mime2codec(content_type));
-
-   if ( roar_vio_ctl(cur, ROAR_VIO_CTL_GET_FH, &fh) == -1 )
-    fh = -1;
-
-   if ( g_verbose > 1 ) {
-    if ( roar_vio_ctl(cur, ROAR_VIO_CTL_GET_PEERNAME, &sockname) == -1 ) {
-     have_sockname = 0;
-    } else {
-     have_sockname = 1;
-    }
-   } else {
-    have_sockname = 0;
-   }
-  } else {
-   content_type  = "UNKNOWN";
-   codec         = "UNKNOWN";
-   fh            = -1;
-   have_sockname = 0;
-  }
-
-  printf("%i: %s", level, name);
-  if ( fh != -1 || !!strcasecmp(codec, "UNKNOWN") || !!strcasecmp(content_type, "UNKNOWN") || have_sockname ) {
-   need_space = 0;
-   printf(" (");
-   if ( fh != -1 ) {
-    printf("fh=%i", fh);
-    need_space = 1;
-   }
-
-   if ( have_sockname ) {
-    need_space2 = 0;
-    printf("%ssocket={", need_space ? ", " : "");
-
-    need_space2 = 1;
-    switch (sockname.type) {
-     case ROAR_SOCKET_TYPE_UNIX:   printf("af=UNIX");   break;
-     case ROAR_SOCKET_TYPE_DECNET: printf("af=DECnet"); break;
-     case ROAR_SOCKET_TYPE_INET:   printf("af=INET");   break;
-     case ROAR_SOCKET_TYPE_INET6:  printf("af=INET6");  break;
-     default:
-       need_space2 = 0;
-      break;
-    }
-
-    if ( sockname.addr != NULL ) {
-     printf("%saddr=\"%s\"", need_space2 ? ", " : "", sockname.addr);
-     need_space2 = 1;
-    }
-
-    if ( sockname.port ) {
-     printf("%sport=%i", need_space2 ? ", " : "", sockname.port);
-     need_space2 = 1;
-    }
-
-    printf("}");
-    need_space = 1;
-   }
-
-   if ( !!strcasecmp(codec, "UNKNOWN") ) {
-    printf("%scodec=%s", need_space ? ", " : "", codec);
-    need_space = 1;
-   }
-
-   if ( !!strcmp(content_type, "UNKNOWN") ) {
-    printf("%scontent-type=\"%s\"", need_space ? ", " : "", content_type);
-    need_space = 1;
-   }
-   printf(")");
-  }
-  printf("\n");
-
-  level++;
-
-  if ( have_sockname )
-   if ( sockname.addr != NULL )
-    roar_mm_free(sockname.addr);
-
-  if ( roar_vio_ctl(cur, ROAR_VIO_CTL_GET_NEXT, &cur) == -1 )
-   cur = NULL;
- }
-
- roar_error = ROAR_ERROR_NONE;
- return 0;
-}
-
-int main (int argc, char * argv[]) {
- struct roar_vio_defaults def;
- struct roar_vio_calls vio0, vio1;
- enum action action = READ;
- ssize_t written = -1;
- int i;
- const char * k;
- const char * file0 = NULL;
- const char * file1 = NULL;
- int o_flags = -1;
- int ret = 0;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( !strcmp(k, "-h") || !strcmp(k, "--help") ) {
-   usage(argv[0]);
-   return 0;
-  } else if ( !strcmp(k, "--read") ) {
-   action = READ;
-  } else if ( !strcmp(k, "--write") ) {
-   action = WRITE;
-  } else if ( !strcmp(k, "--pass") ) {
-   action = PASS;
-  } else if ( !strcmp(k, "--explain") ) {
-   action = EXPLAIN;
-  } else if ( !strcmp(k, "--verbose") ) {
-   g_verbose++;
-  } else if ( file0 == NULL ) {
-   file0 = k;
-  } else if ( file1 == NULL ) {
-   file1 = k;
-  } else {
-   ROAR_ERR("Too many parameters or unknown parameter: %s", k);
-   usage(argv[0]);
-   return 1;
-  }
- }
-
- if ( file0 == NULL ) {
-  usage(argv[0]);
-  return 1;
- }
-
- if ( (file1 != NULL && action != PASS) || (action == PASS && file1 == NULL) ) {
-  usage(argv[0]);
-  return 1;
- }
-
- switch (action) {
-  case READ:
-  case PASS:
-  case EXPLAIN:
-    o_flags = O_RDONLY;
-   break;
-  case WRITE:
-    o_flags = O_WRONLY|O_CREAT|O_TRUNC;
-   break;
- }
-
- if ( o_flags == -1 ) {
-  ROAR_ERR("o_flags unset, very bad. This should never happen.");
-  return 1;
- }
-
- if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, o_flags, 0644) == -1 ) {
-  ROAR_ERR("Can not init DSTR defaults. Bad.");
-  return 1;
- }
-
- if ( roar_vio_open_dstr(&vio0, file0, &def, 1) == -1 ) {
-  ROAR_ERR("Can not open file: %s: %s", file0, roar_error2str(roar_error));
-  return 1;
- }
-
- if ( action == PASS ) {
-  if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY|O_CREAT|O_TRUNC, 0644) == -1 ) {
-   ROAR_ERR("Can not init DSTR defaults. Bad.");
-   roar_vio_close(&vio0);
-   return 1;
-  }
-
-  if ( roar_vio_open_dstr(&vio1, file1, &def, 1) == -1 ) {
-   ROAR_ERR("Can not open file: %s: %s", file1, roar_error2str(roar_error));
-   roar_vio_close(&vio0);
-   return 1;
-  }
- }
-
- switch (action) {
-  case READ:
-    written = roar_vio_copy_data(roar_stdout, &vio0);
-   break;
-  case WRITE:
-    written = roar_vio_copy_data(&vio0, roar_stdin);
-   break;
-  case PASS:
-    written = roar_vio_copy_data(&vio1, &vio0);
-   break;
-  case EXPLAIN:
-    if ( (written = do_explain(&vio0)) == -1 )
-     ret = 4;
-   break;
- }
-
- if ( written == -1 ) {
-  ROAR_ERR("Can not push data: %s", roar_error2str(roar_error));
- }
-
- roar_vio_close(&vio0);
- if ( file1 != NULL )
-  roar_vio_close(&vio1);
-
- return ret;
-}
-
-//ll
Index: roarclients/roarvorbis.c
===================================================================
--- roarclients/roarvorbis.c	(revision 6052)
+++ 	(revision )
@@ -1,422 +1,0 @@
-//roarvorbis.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#ifdef ROAR_HAVE_LIBVORBISFILE
-#include <vorbis/codec.h>
-#include <vorbis/vorbisfile.h>
-#endif
-
-#ifdef _WIN32
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-#define BUFSIZE 1024
-
-void usage (void) {
- printf("roarvorbis [OPTIONS]... FILE\n");
-
- printf("\nOptions:\n\n");
-
- printf("  --server SERVER    - Set server hostname\n"
-        "  --help             - Show this help\n"
-        "  --vclt-out FILE    - Writes VCLT file\n"
-       );
-
-}
-
-
-#ifdef ROAR_HAVE_LIBVORBISFILE
-int _g_cf_vorbis_vfvio_return_err (void) {
- return -1;
-}
-
-size_t cf_vorbis_vfvio_read (void *ptr, size_t size, size_t nmemb, void *datasource) {
- ssize_t r;
-
- r = roar_vio_read(datasource, ptr, size*nmemb);
-
- ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p): r=%i", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, r);
-
- if ( r == -1 )
-  return 0;
-
- if ( r > 0 )
-  errno = 0;
-
- r /= size;
-
- ROAR_DBG("cf_vorbis_vfvio_read(ptr=%p, size=%lu, nmemb=%lu, datasource=%p) = %i", ptr, (unsigned long int)size, (unsigned long int)nmemb, datasource, r);
- return r;
-}
-
-int cf_vorbis_vfvio_seek  (void *datasource, ogg_int64_t offset, int whence) {
- return roar_vio_lseek(datasource, offset, whence);
-}
-
-long cf_vorbis_vfvio_tell (void *datasource) {
- return roar_vio_lseek(datasource, 0, SEEK_CUR);
-}
-
-ov_callbacks _g_cf_vorbis_vfvio = {
-  .read_func  = cf_vorbis_vfvio_read,
-  .seek_func  = cf_vorbis_vfvio_seek,
-  .close_func = (int    (*)(void *                        )) _g_cf_vorbis_vfvio_return_err,
-  .tell_func  = cf_vorbis_vfvio_tell
-};
-
-
-int update_stream (struct roar_connection *  con,
-                   roar_vs_t              ** vss,
-                   OggVorbis_File         *  vf,
-                   const char             *  file,
-                   struct roar_audio_info *  info,
-                   struct roar_vio_calls  *  vclt) {
- struct roar_stream     * s;
- vorbis_info *vi = ov_info(vf, -1);
- int    bits     = 16;
- int    codec    = ROAR_CODEC_PCM_S_LE;
- char **ptr = ov_comment(vf, -1)->user_comments;
- char key[ROAR_META_MAX_NAMELEN], value[LIBROAR_BUFFER_MSGDATA] = {0};
- int j, h = 0;
- struct roar_meta   meta;
- static int need_new_stream = 1;
- int need_close = 0;
- int meta_ok;
-
- fprintf(stderr, "\n");
-
- if ( vclt != NULL ) {
-  roar_vio_printf(vclt, "AUDIOINFO=rate:%liHz, channels:%li\n", (long int)vi->rate, (long int)vi->channels);
- }
-
- if ( !need_new_stream ) {
-  if ( info->rate != (uint16_t)vi->rate || info->channels != (uint16_t)vi->channels ) {
-   need_close      = 1;
-   need_new_stream = 1;
-  }
- }
-
- if ( need_new_stream ) {
-  if ( need_close ) {
-   roar_vs_sync(*vss, ROAR_VS_WAIT, NULL);
-   roar_vs_close(*vss, ROAR_VS_FALSE, NULL);
-  }
-
-  fprintf(stderr, "Audio: %i channel, %liHz\n\n", vi->channels, vi->rate);
-
-  info->rate     = vi->rate;
-  info->channels = vi->channels;
-  info->bits     = bits;
-  info->codec    = codec;
-
-  *vss = roar_vs_new_from_con(con, NULL);
-  if ( *vss == NULL ) {
-   roar_disconnect(con);
-   return -1;
-  }
-
-  if ( roar_vs_stream(*vss, info, ROAR_DIR_PLAY, NULL) == -1 ) {
-   roar_vs_close(*vss, ROAR_VS_TRUE, NULL);
-   roar_disconnect(con);
-   return -1;
-  }
-
-  need_new_stream = 0;
- }
-
- s = roar_vs_stream_obj(*vss, NULL);
-
- meta.value = value;
- meta.key[0] = 0;
- meta.type = ROAR_META_TYPE_NONE;
-
- roar_stream_meta_set(con, s, ROAR_META_MODE_CLEAR, &meta);
-
- if ( strncmp(file, "http:", 5) == 0 )
-  meta.type = ROAR_META_TYPE_FILEURL;
- else
-  meta.type = ROAR_META_TYPE_FILENAME;
-
-
- strncpy(value, file, LIBROAR_BUFFER_MSGDATA-1);
- value[LIBROAR_BUFFER_MSGDATA-1] = 0;
- roar_stream_meta_set(con, s, ROAR_META_MODE_SET, &meta);
-
- while(*ptr){
-  meta_ok = 1;
-
-   for (j = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) {
-    if ( j == ROAR_META_MAX_NAMELEN ) {
-     ROAR_ERR("update_stream(*): invalid meta data: meta data key too long");
-     meta_ok = 0;
-     j = 0;
-     break;
-    }
-    key[j] = (*ptr)[j];
-   }
-   key[j] = 0;
-
-   if ( meta_ok ) {
-    for (j++, h = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) {
-     if ( h == LIBROAR_BUFFER_MSGDATA ) {
-      ROAR_ERR("update_stream(*): invalid meta data: meta data value for key '%s' too long", key);
-      meta_ok = 0;
-      h = 0;
-      break;
-     }
-     value[h++] = (*ptr)[j];
-    }
-    value[h]   = 0;
-   }
-
-   if ( meta_ok ) {
-    fprintf(stderr, "Meta %-16s: %s\n", key, value);
-
-    if ( vclt != NULL ) {
-     roar_vio_printf(vclt, "%s=%s\n", key, value);
-    }
-
-    meta.type = roar_meta_inttype(key);
-    if ( meta.type != -1 )
-     roar_stream_meta_set(con, s, ROAR_META_MODE_SET, &meta);
-   }
-
-   ptr++;
- }
-
- fprintf(stderr, "\n");
-
- *value      = 0;
- meta.key[0] = 0;
- meta.type   = ROAR_META_TYPE_NONE;
- roar_stream_meta_set(con, s, ROAR_META_MODE_FINALIZE, &meta);
-
- if ( vclt != NULL ) {
-  roar_vio_printf(vclt, "==\n");
- }
-
- return 0;
-}
-
-
-const char * time2str(double t, char * buf, size_t len) {
- int h, m;
-
- if ( t < 0 ) {
-//  strncpy(buf, "unknown", len);
-//  return buf;
-  *buf++ = '-';
-  t *= -1;
- }
-
- h  = t / 3600;
- t -= h * 3600;
- m  = t / 60;
- t -= m * 60;
-
- snprintf(buf, len, "%.2i:%.2i:%.2i", h, m, (int)t);
-
- return buf;
-}
-
-void print_time (OggVorbis_File * vf, roar_vs_t * vss, double time_total, struct roar_audio_info * info) {
- ssize_t pos;
- double time_cur;
- long bitrate_cur = ov_bitrate_instant(vf);
- float bitrate = bitrate_cur / 1000.0;
- char time_buf[3][10];
-
- pos = roar_vs_position(vss, ROAR_VS_BACKEND_DEFAULT, NULL);
-
- if ( pos == -1 ) {
-  time_cur = ov_time_tell(vf);
- } else {
-  time_cur = (double)pos/(double)(info->channels*info->rate);
- }
-
- time2str(time_cur, time_buf[0], sizeof(time_buf[0]));
-
- if ( time_total > 0 ) {
-  time2str(time_total-time_cur, time_buf[1], sizeof(time_buf[1]));
-  time2str(time_total, time_buf[2], sizeof(time_buf[2]));
-
-  //Time: 00:02.53 [03:26.20] of 03:28.73  (122.7 kbps)  Output Buffer  43.8%
-  fprintf(stderr, "\rTime: %s [%s] of %s  (%.1f kbps)            ", time_buf[0], time_buf[1], time_buf[2], bitrate);
- } else {
-  fprintf(stderr, "\rTime: %s  (%.1f kbps)                       ", time_buf[0], bitrate);
- }
-
- fflush(stderr);
-}
-
-#endif
-
-int main (int argc, char * argv[]) {
-#ifndef ROAR_HAVE_LIBVORBISFILE
- (void)argc, (void)argv;
- fprintf(stderr, "Error: no Vorbis support!\n");
- return 1;
-#else
- struct roar_vio_calls vclt, in;
- struct roar_vio_defaults def;
- const char * file     = NULL;
- const char * vcltfile = NULL;
- const char * k;
- int    i;
- struct roar_connection con;
- roar_vs_t * vss = NULL;
- OggVorbis_File vf;
- int eof=0;
- int current_section = -1;
- int last_section = -1;
- struct roar_audio_info info;
- char pcmout[4096];
- double time_total;
- ssize_t bits_per_sec = -1;
- ssize_t bits_written = -1;
-
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   roar_libroar_set_server(argv[++i]);
-  } else if ( strcmp(k, "--vclt-out") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   vcltfile = argv[++i];
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else if ( file == NULL ) {
-   file = k;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( file == NULL ) {
-  ROAR_ERR("No filename given.");
-  return 1;
- }
-
- if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_RDONLY, 0644) == -1 )
-  return 1;
-
- if ( roar_vio_open_dstr(&in, file, &def, 1) == -1 ) {
-  fprintf(stderr, "Error: can not open file: %s: %s\n", file, strerror(errno));
-  return 1;
- }
-
- if ( roar_simple_connect(&con, NULL, "roarvorbis") == -1 ) {
-  ROAR_DBG("roar_simple_play(*): roar_simple_connect() faild!");
-  roar_vio_close(&in);
-  return 1;
- }
-
- if ( ov_open_callbacks((void*)&in, &vf, NULL, 0, _g_cf_vorbis_vfvio) < 0 ) {
-// if( ov_open(in, &vf, NULL, 0) < 0 ) {
-  fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
-  roar_disconnect(&con);
-  roar_vio_close(&in);
-  return 1;
- }
-
- time_total = ov_time_total(&vf, -1);
-
- if ( vcltfile != NULL ) {
-  if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY|O_CREAT|O_APPEND, 0644) == -1 )
-   return 1;
-  if ( roar_vio_open_dstr(&vclt, vcltfile, &def, 1) == -1 ) {
-   fprintf(stderr, "Error: can not open file: %s: %s\n", vcltfile, strerror(errno));
-   roar_disconnect(&con);
-   roar_vio_close(&in);
-   return 1;
-  }
- }
-
-// if ( update_stream(&con, &s, &out, &vf, file) == -1 )
-//  return 1;
-
- while (!eof) {
-  long ret = ov_read(&vf, pcmout, sizeof(pcmout), 0, 2, 1, &current_section);
-
-  if ( last_section != current_section )
-   if ( update_stream(&con, &vss, &vf, file, &info, vcltfile == NULL ? NULL : &vclt) == -1 ) {
-    roar_vio_close(&in);
-    if ( vcltfile != NULL )
-     roar_vio_close(&vclt);
-    return 1;
-   }
-   bits_per_sec = roar_info2bitspersec(&info);
-
-  last_section = current_section;
-
-  if (ret == 0) {
-   /* EOF */
-   eof = 1;
-  } else if (ret < 0) {
-   /* error in the stream.  Not a problem, just reporting it in
-      case we (the app) cares.  In this case, we don't. */
-  } else {
-   if ( roar_vs_write(vss, pcmout, ret, NULL) != (ssize_t)ret ) {
-    fprintf(stderr, "\nError: Can not write to server.\n");
-    eof = 1;
-    continue;
-   }
-   bits_written += ret * 8;
-   if ( bits_written > bits_per_sec ) {
-    bits_written = 0;
-    print_time(&vf, vss, time_total, &info);
-   }
-  }
- }
-
- fprintf(stderr, "\n"); // end the lion of print_time().
-
- ov_clear(&vf);
-
-// fclose(in);
- roar_vs_close(vss, ROAR_VS_FALSE, NULL);
- roar_disconnect(&con);
-
- if ( vcltfile != NULL )
-  roar_vio_close(&vclt);
-
- roar_vio_close(&in);
-
- return 0;
-#endif
-}
-
-//ll
Index: roarclients/roarvumeter.c
===================================================================
--- roarclients/roarvumeter.c	(revision 6052)
+++ 	(revision )
@@ -1,299 +1,0 @@
-//roarvumeter.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-#include <libroardsp/libroardsp.h>
-
-#ifdef ROAR_HAVE_LIBM
-
-#include <math.h>
-
-#define BUFSIZE 1024
-
-#define LOWPASS_ORDER  6
-
-#define MODE_NONE  0x00
-#define MODE_PC    0x01
-#define MODE_DB    0x02
-#define MODE_BEAT  0x04
-
-void usage (void) {
- printf("roarvumeter [OPTIONS]...\n");
-
- printf("\nOptions:\n\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
-       );
-
-}
-
-int vumeter16bit2ch (struct roar_vio_calls * vio, int samples, int16_t * buf, int mode, struct roardsp_filterchain * fc) {
- struct roar_stream    beat_stream[1];
- struct roardsp_filter beat_lp[1];
- float                 beat_lpfreq = 1;
- int i;
- int samples_half = samples/2;
- int64_t suml, sumr;
- double  rmsl, rmsr;
- int run_filters    = roardsp_fchain_num(fc);
- int beat_detection = mode & MODE_BEAT;
- char * beat[2]     = {"     ", "Beat!"};
- char * dbeat       = beat[0];
- int     have_beat  = 0;
- int16_t beat_val, beat_old;
-
- if ( beat_detection ) {
-  mode -= MODE_BEAT;
-
-  roar_stream_new(beat_stream, 10, 1, 16, ROAR_CODEC_PCM);
-  roardsp_filter_init(beat_lp, beat_stream, ROARDSP_FILTER_LOWP);
-  roardsp_filter_ctl(beat_lp, ROARDSP_FCTL_FREQ, &beat_lpfreq);
- }
-
- printf("\e[s");
- fflush(stdout);
-
- while (roar_vio_read(vio, buf, samples * 2) > 0) {
-  suml = sumr = 0;
-
-  if ( run_filters ) {
-   roardsp_fchain_calc(fc, buf, samples * 2);
-  }
-
-  for (i = 0; i < samples; i += 2) {
-   suml += (int64_t) buf[i  ] * (int64_t) buf[i  ];
-   sumr += (int64_t) buf[i+1] * (int64_t) buf[i+1];
-  }
-
-  rmsl = sqrt((double)suml/(double)samples_half);
-  rmsr = sqrt((double)sumr/(double)samples_half);
-
-  if ( beat_detection ) {
-   beat_old = beat_val = (rmsl + rmsr) / 2;
-   roardsp_filter_calc(beat_lp, &beat_val, 2);
-   if ( (float)beat_old > (float)beat_val*1.1f ) {
-    dbeat = beat[1];
-    have_beat = 1;
-   } else {
-    dbeat = beat[0];
-    have_beat = 0;
-   }
-  }
-
-  switch (mode) {
-   case MODE_NONE: // beat only
-     if ( have_beat )
-      printf("%s\n", dbeat);
-    break;
-   case MODE_PC:
-     printf("L: %3i%% R: %3i%% %s          \e[u", (int)(rmsl/327.68), (int)(rmsr/327.68), dbeat);
-    break;
-   case MODE_DB:
-     printf("L: %6.2fdB R: %6.2fdB %s          \e[u", 20*log10(rmsl/32768.), 20*log10(rmsr/32768.), dbeat);
-    break;
-  }
-
-  fflush(stdout);
- }
-
- if ( beat_detection ) {
-  roardsp_filter_uninit(beat_lp);
- }
-
- return 0;
-}
-
-int vumeter (struct roar_vio_calls * vio, int samples, int bits, int channels, int mode, struct roardsp_filterchain * fc) {
- void * buf = roar_mm_malloc((samples*bits*channels)/8);
-
- if ( buf == NULL )
-  return -1;
-
- if ( bits == 16 ) {
-  if ( channels == 2 ) {
-   vumeter16bit2ch(vio, samples, (int16_t *) buf, mode, fc);
-   roar_mm_free(buf);
-   return 0;
-  } else {
-   roar_mm_free(buf);
-   return -1;
-  }
- } else {
-  roar_mm_free(buf);
-  return -1;
- }
-}
-
-int main (int argc, char * argv[]) {
- struct roar_connection       con;
- struct roar_stream           s;
- struct roardsp_filterchain   fchain;
- struct roardsp_filter      * filter;
- float  lowpass_freq = 0;
- struct roar_audio_info info;
- int    samples  = -1;
- const char * server   = NULL;
- const char * k;
- struct roar_vio_calls stream, re;
- int    i;
- int    mode = 0;
-
- if ( roar_profile2info(&info, "default") == -1 )
-  return 1;
-
- for (i = 1; i < argc; i++) {
-  k = argv[i];
-
-  if ( strcmp(k, "--server") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   server = argv[++i];
-  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.rate = roar_str2rate(argv[++i]);
-  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.bits = roar_str2bits(argv[++i]);
-  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   info.channels = roar_str2channels(argv[++i]);
-  } else if ( !strcmp(k, "--aiprofile") ) {
-   ROAR_CKHAVEARGS(1);
-   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 ) {
-   ROAR_CKHAVEARGS(1);
-   samples = atoi(argv[++i]);
-  } else if ( strcmp(k, "--db") == 0 ) {
-   mode |= MODE_PC;
-   mode -= MODE_PC;
-   mode |= MODE_DB;
-  } else if ( strcmp(k, "--pc") == 0 ) {
-   mode |= MODE_DB;
-   mode -= MODE_DB;
-   mode |= MODE_PC;
-  } else if ( strcmp(k, "--beat") == 0 ) {
-   mode |= MODE_BEAT;
-  } else if ( strcmp(k, "--lowpass") == 0 ) {
-   ROAR_CKHAVEARGS(1);
-   lowpass_freq = atof(argv[++i]);
-  } else if ( strcmp(k, "--help") == 0 ) {
-   usage();
-   return 0;
-  } else {
-   fprintf(stderr, "Error: unknown argument: %s\n", k);
-   usage();
-   return 1;
-  }
- }
-
- if ( !mode )
-  mode = MODE_PC;
-
- if ( samples == -1 )
-  samples = info.rate/10;
-
- if ( roar_simple_connect(&con, server, "roarvumeter") == -1 ) {
-  fprintf(stderr, "Error: can not connect to server!\n");
-  return 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;
- }
-
- if ( roar_vio_open_re(&re, &stream) == -1 ) {
-  roar_vio_close(&stream);
-  fprintf(stderr, "Error: can not open RE VIO layer\n");
-  return 1;
- }
-
- if ( roardsp_fchain_init(&fchain) == -1 ) {
-  roar_vio_close(&re);
-  fprintf(stderr, "Error: can not init filterchain\n");
-  return 1;
- }
-
- if ( lowpass_freq > 1 ) {
-  for (i = 0; i < LOWPASS_ORDER; i++) {
-   if ( roardsp_filter_new(&filter, &s, ROARDSP_FILTER_LOWP) == -1 ) {
-    fprintf(stderr, "Error: can not open lowpass\n");
-    roar_vio_close(&re);
-    roardsp_fchain_uninit(&fchain);
-    return 1;
-   }
-
-   if ( roardsp_filter_ctl(filter, ROARDSP_FCTL_FREQ, &lowpass_freq) == -1 ) {
-    fprintf(stderr, "Error: can not set filter frequency\n");
-    roar_vio_close(&re);
-    roardsp_fchain_uninit(&fchain);
-    return 1;
-   }
-
-   if ( roardsp_fchain_add(&fchain, filter) == -1 ) {
-    fprintf(stderr, "Error: can not set filter frequency\n");
-    roar_vio_close(&re);
-    roardsp_fchain_uninit(&fchain);
-    return 1;
-   }
-  }
- }
-
- 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
-
- roar_vio_close(&re);
-
- roar_disconnect(&con);
-
- roardsp_fchain_uninit(&fchain);
-
- return 0;
-}
-
-#else
-int main (void) {
- fprintf(stderr, "Error: No Math library support compiled in.\n");
- return 1;
-}
-#endif
-
-//ll
Index: roarclients/zcattest.c
===================================================================
--- roarclients/zcattest.c	(revision 6052)
+++ 	(revision )
@@ -1,53 +1,0 @@
-//zcattest.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of roarclients a part of RoarAudio,
- *  a cross-platform sound system for both, home and professional use.
- *  See README for details.
- *
- *  This file is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3
- *  as published by the Free Software Foundation.
- *
- *  RoarAudio is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this software; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include <roaraudio.h>
-
-#define BUF_MAX 1024
-
-int main (void) {
- char buf[BUF_MAX];
- size_t len;
- struct roar_vio_calls file, zcat;
-
- if ( roar_vio_open_fh(&file, ROAR_STDIN) == -1 ) {
-  ROAR_ERR("roar_vio_open_fh(&file, ROAR_STDIN) = -1");
-  return 1;
- }
-
- if ( roar_vio_open_gzip(&zcat, &file, -1) == -1 ) {
-  ROAR_ERR("roar_vio_open_gzip(&zcat, &file, -1) = -1");
-  return 1;
- }
-
- while ((len = roar_vio_read(&zcat, buf, BUF_MAX)))
-  write(ROAR_STDOUT, buf, len);
-
- roar_vio_close(&zcat);
-
- return 0;
-}
-
-//ll
