Index: plugins/.release-helper
===================================================================
--- plugins/.release-helper	(revision 4849)
+++ 	(revision )
@@ -1,5 +1,0 @@
-#!RELEASE-HELPER:0.0beta0
-@RMDIR ao
-@RMDIR audacious
-@RMDIR xine
-#!END
Index: plugins/Makefile
===================================================================
--- plugins/Makefile	(revision 1591)
+++ 	(revision )
@@ -1,7 +1,0 @@
-include ../Makefile.conf
-
-all:
-	for i in */; do cd $$i; $(MAKE) all; cd ..; done
-clean:
-	for i in */; do cd $$i; $(MAKE) clean; cd ..; done
-new: clean all
Index: plugins/alsa/Makefile
===================================================================
--- plugins/alsa/Makefile	(revision 5851)
+++ 	(revision )
@@ -1,30 +1,0 @@
-BASENAME=libasound_module_pcm_roar
-SLIB=$(BASENAME)$(SHARED_SUFFIX)
-TARGET=$(SLIB)
-INSTALL_DIR=$(PREFIX_LIB)/alsa-lib/
-OBJS=pcm_roar.o roar.o thread.o
-
-include ../../Makefile.conf
-include ../../Makefile.inc
-#include Makefile.conf
-
-#DEBUG=-DDEBUG -DXXX
-DEFINES=-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"alsa-plugins\" -DVERSION=\"1.0.13\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DSTDC_HEADERS=1 -DHAVE_LIBASOUND=1 -D_REENTRANT -DPIC
-CFLAGS += $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) -I../../include $(DEFINES) $(DEBUG) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC) -I/usr/include/alsa -D_GNU_SOURCE $(pthread)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(SHARED) $(LDPATH) -L../../lib $(pthread)
-LIBS    = $(LIBROAR) $(lib_m) $(lib_dl) -lrt $(lib_asound)
-
-all: ${TARGET}
-clean:
-	rm -f ${TARGET} *.o tests tests.c
-new: clean all
-
-install: ${TARGET}
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	cp ${TARGET} ${DESTDIR}${INSTALL_DIR}
-semi-install: ${TARGET}
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	ln -fs `pwd`/$(SLIB) ${DESTDIR}${INSTALL_DIR}
-
-$(SLIB): $(OBJS)
-	$(CC) $(LDFLAGS) -Wl,-soname -Wl,$(SLIB) -o $(SLIB) $(OBJS) $(LIBS)
Index: plugins/alsa/mixer.c
===================================================================
--- plugins/alsa/mixer.c	(revision 6052)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//mixer.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- */
-
-#include "roar.h"
-
-//ll
Index: plugins/alsa/pcm.c
===================================================================
--- plugins/alsa/pcm.c	(revision 6052)
+++ 	(revision )
@@ -1,419 +1,0 @@
-//pcm.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- */
-
-#include "roar.h"
-
-// Equvivalent to prepare(). Starts a stream. Also needs to reset the writec since pointer() will do funny
-// things without it. Will be called several times during a program!
-static int roar_pcm_start (snd_pcm_ioplug_t * io) {
- struct roar_alsa_pcm * self = io->private_data;
- int                    fh;
-
- ROAR_DBG("roar_pcm_start(*) = ?");
-
- // If start is called several times in a row, just ignore it.
- if (self->stream_opened)
-  return 0;
-
- if ( roar_vio_simple_new_stream_obj(&(self->stream_vio), &(self->roar.con), &(self->stream),
-                                     self->info.rate, self->info.channels, self->info.bits, self->info.codec,
-                                     io->stream == SND_PCM_STREAM_PLAYBACK ? ROAR_DIR_PLAY : ROAR_DIR_MONITOR
-                                    ) == -1 ) {
-  return -EINVAL;
- }
-
- if ( roar_vio_ctl(&(self->stream_vio), io->stream == SND_PCM_STREAM_PLAYBACK ?
-                                        ROAR_VIO_CTL_GET_SELECT_WRITE_FH : ROAR_VIO_CTL_GET_SELECT_READ_FH,
-                   &fh) != -1 ) {
-
-  io->poll_fd     = fh;
-  io->poll_events = io->stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
-
-  snd_pcm_ioplug_reinit_status(io);
- }
-
- // Stream is now active, yay.
- self->stream_opened = 1;
- self->writec = 0;
-
- return 0;
-}
-
-// Simply stopping the stream. Will need to be restarted to play more.
-// Will be called several times together with roar_pcm_start()
-static int roar_pcm_stop (snd_pcm_ioplug_t *io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- ROAR_DBG("roar_pcm_stop(*) = ?");
-
- // If this is called several times in a row, just ignore.
- if ( !self->stream_opened )
-  return 0;
-
- roar_vio_close(&(self->stream_vio));
- self->stream_opened = 0;
-
- ROAR_DBG("roar_pcm_stop(*) = 0");
-
- return 0;
-}
-
-static int roar_hw_constraint(struct roar_alsa_pcm * self) {
- snd_pcm_ioplug_t *io = &(self->io);
- static const snd_pcm_access_t access_list[] = {
-  SND_PCM_ACCESS_RW_INTERLEAVED
- };
- static const unsigned int formats[] = {
-  SND_PCM_FORMAT_S8,
-  SND_PCM_FORMAT_U8,
-  SND_PCM_FORMAT_A_LAW,
-  SND_PCM_FORMAT_MU_LAW,
-  SND_PCM_FORMAT_S16_LE,
-  SND_PCM_FORMAT_S16_BE,
-  SND_PCM_FORMAT_U16_LE,
-  SND_PCM_FORMAT_U16_BE,
-  SND_PCM_FORMAT_S32_LE,
-  SND_PCM_FORMAT_S32_BE,
-  SND_PCM_FORMAT_U32_LE,
-  SND_PCM_FORMAT_U32_BE,
-  SND_PCM_FORMAT_S24_3LE,
-  SND_PCM_FORMAT_S24_3BE,
-  SND_PCM_FORMAT_U24_3LE,
-  SND_PCM_FORMAT_U24_3BE,
- };
- int ret;
-
- ROAR_DBG("roar_hw_constraint(*) = ?");
-
- if ( (ret = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_ACCESS,
-        _as(access_list), access_list)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_FORMAT,
-        _as(formats), formats)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_CHANNELS,
-        1, ROAR_MAX_CHANNELS)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_RATE, 8000, 192000)) < 0 )
-  return ret;
-
-#if 0
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES, 1, 4294967295U)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS, 1, 4294967295U)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_BUFFER_BYTES, 1, 4294967295U)) < 0 )
-  return ret;
-#else
- // We shouldn't let ALSA use extremely low or high values, it will kill a kitty most likely. :v
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES, 1 << 6, 1 << 18)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS, 1, 1024)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_BUFFER_BYTES, 1 << 13, 1 << 24)) < 0 )
-  return ret;
-#endif
-
- ROAR_DBG("roar_hw_constraint(*) = 0");
-
- return 0;
-}
-
-
-///////////////////////////////
-/// TODO: Needs to be implemented
-///////////////////////////////
-// This hacky hack should not be used, since apparently, using this, ALSA will think the audio buffer is always empty (?),
-// leading to completely broken blocking audio which will only work with audio players.
-// Will need a method to determine how much buffer data is available to write to the roar buffer without blocking.
-// We therefore also need to know the buffersize that ALSA uses.
-
-// Referring to alsa-lib/src/pcm/pcm_ioplug.c : snd_pcm_ioplug_hw_ptr_update
-static snd_pcm_sframes_t roar_pcm_pointer(snd_pcm_ioplug_t *io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- ROAR_DBG("roar_pcm_pointer(*) = ?");
-
- return snd_pcm_bytes_to_frames(io->pcm, self->writec);
-}
-
-// TODO: FIXME: add support for reading data!
-static snd_pcm_sframes_t roar_pcm_transfer(snd_pcm_ioplug_t *io,
-                                        const snd_pcm_channel_area_t *areas,
-                                        snd_pcm_uframes_t offset,
-                                        snd_pcm_uframes_t size) {
- struct roar_alsa_pcm * self = io->private_data;
- char * buf;
- size_t len = size * self->info.channels * self->info.bits / 8;
- ssize_t ret;
-
- ROAR_DBG("roar_pcm_transfer(*) = ?");
- ROAR_DBG("roar_pcm_transfer(*): len=%lu", (long unsigned int) len);
-
- // Weird ALSA stuff.
- buf = (char *)areas->addr + (areas->first + areas->step * offset) / 8;
-
- ret = roar_vio_write(&(self->stream_vio), buf, len);
-
- if ( ret != -1 ) {
-  // We increment the written counter so that subsequent calls to pointer() will not cause
-  // the library to hang due to several quirks that ALSA uses to determine available size.
-  // This approach is bad, but is needed until pointer() is implemented correctly.
-  self->writec += ret;
- } else {
-  return -EIO;
- }
-
- ROAR_DBG("roar_pcm_transfer(*) = %lli", (long long int)size);
- return size;
-}
-
-
-///////////////////////////////
-/// TODO: Needs to be implemented
-///////////////////////////////
-static int roar_pcm_delay(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp) {
- (void)io;
-
- ROAR_DBG("roar_pcm_delay(*) = ?");
-
- // TODO: We need to set *delayp the latency in frames.
- *delayp = 0;
-
- return 0;
-}
-
-static int roar_pcm_prepare(snd_pcm_ioplug_t *io) {
- ROAR_DBG("roar_pcm_prepare(*) = ?");
-
- return roar_pcm_start(io);
-}
-
-static int roar_pcm_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params) {
- struct roar_alsa_pcm * self = io->private_data;
-
- (void) params;
-
- ROAR_DBG("roar_pcm_hw_params(*) = ?");
-
- self->info.channels = io->channels;
- self->info.rate     = io->rate;
-
- switch (io->format) {
-  case SND_PCM_FORMAT_S8:
-    self->info.codec = ROAR_CODEC_PCM_U_LE;
-    self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_U8:
-    self->info.codec = ROAR_CODEC_PCM_U_LE;
-    self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_A_LAW:
-    self->info.codec = ROAR_CODEC_ALAW;
-    self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_MU_LAW:
-    self->info.codec = ROAR_CODEC_MULAW;
-    self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_S16_LE:
-    self->info.codec = ROAR_CODEC_PCM_S_LE;
-    self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_S16_BE:
-    self->info.codec = ROAR_CODEC_PCM_S_BE;
-    self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_U16_LE:
-    self->info.codec = ROAR_CODEC_PCM_U_LE;
-    self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_U16_BE:
-    self->info.codec = ROAR_CODEC_PCM_U_BE;
-    self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_S32_LE:
-    self->info.codec = ROAR_CODEC_PCM_S_LE;
-    self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_S32_BE:
-    self->info.codec = ROAR_CODEC_PCM_S_BE;
-    self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_U32_LE:
-    self->info.codec = ROAR_CODEC_PCM_U_LE;
-    self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_U32_BE:
-    self->info.codec = ROAR_CODEC_PCM_U_BE;
-    self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_S24_3LE:
-    self->info.codec = ROAR_CODEC_PCM_S_LE;
-    self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_S24_3BE:
-    self->info.codec = ROAR_CODEC_PCM_S_BE;
-    self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_U24_3LE:
-    self->info.codec = ROAR_CODEC_PCM_U_LE;
-    self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_U24_3BE:
-    self->info.codec = ROAR_CODEC_PCM_U_BE;
-    self->info.bits  = 24;
-   break;
-  default:
-    return-EINVAL;
- }
-
- ROAR_DBG("roar_pcm_hw_params(*) = 0");
- return 0;
-}
-
-static int roar_pcm_close (snd_pcm_ioplug_t * io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- ROAR_DBG("roar_pcm_close(*) = ?");
-
- roar_disconnect(&(self->roar.con));
-
- roar_mm_free(self);
-
- return 0;
-}
-
-static snd_pcm_ioplug_callback_t roar_pcm_callback = {
-    .start                  = roar_pcm_start,
-    .stop                   = roar_pcm_stop,
-    .drain                  = NULL,
-    .pointer                = roar_pcm_pointer,
-    .transfer               = roar_pcm_transfer,
-    .delay                  = roar_pcm_delay,
-    .poll_descriptors_count = NULL,
-    .poll_descriptors       = NULL,
-    .poll_revents           = NULL,
-    .prepare                = roar_pcm_prepare,
-    .hw_params              = roar_pcm_hw_params,
-    .hw_free                = NULL,
-    .sw_params              = NULL,
-    .pause                  = NULL,
-    .resume                 = NULL,
-    .dump                   = NULL,
-    .close                  = roar_pcm_close,
-};
-
-SND_PCM_PLUGIN_DEFINE_FUNC(roar) {
- struct roar_alsa_pcm * self;
- snd_config_iterator_t i, next;
- snd_config_t * n;
- const char   * para;
- const char   * server = NULL;
- int            ret;
-
- (void)root;
-
- ROAR_DBG("SND_PCM_PLUGIN_DEFINE_FUNC(roar) = ?");
-
- snd_config_for_each(i, next, conf) {
-  n = snd_config_iterator_entry(i);
-  if ( snd_config_get_id(n, &para) < 0 )
-   continue;
-
-  if ( !strcmp(para, "type") || !strcmp(para, "comment") )
-   continue;
-
-  if ( !strcmp(para, "server") ) {
-   if (snd_config_get_string(n, &server) < 0) {
-    return -EINVAL;
-   }
-  } else {
-   return -EINVAL;
-  }
- }
-
- errno = ENOSYS;
-
- if ( (self = roar_mm_malloc(sizeof(struct roar_alsa_pcm))) == NULL )
-  return -errno;
-
- memset(self, 0, sizeof(struct roar_alsa_pcm));
-
- errno = ENOSYS;
- if ( roar_simple_connect(&(self->roar.con), (char*)server, "ALSA Plugin") == -1 ) {
-  roar_mm_free(self);
-  return -errno;
- }
-
- self->io.version      = SND_PCM_IOPLUG_VERSION;
- self->io.name         = "RoarAudio Plugin";
- self->io.poll_fd      = -1;
- self->io.poll_events  =  0;
- self->io.mmap_rw      =  0;
- self->io.callback     = &roar_pcm_callback;
- self->io.private_data =  self;
-
- if ( (ret = snd_pcm_ioplug_create(&(self->io), name, stream, mode)) < 0 ) {
-  roar_disconnect(&(self->roar.con));
-  roar_mm_free(self);
-  return ret;
- }
-
- if ( (ret = roar_hw_constraint(self)) < 0 ) {
-  snd_pcm_ioplug_delete(&(self->io));
-  roar_disconnect(&(self->roar.con));
-  roar_mm_free(self);
-  return ret;
- }
-
- *pcmp = self->io.pcm;
-
- ROAR_DBG("SND_PCM_PLUGIN_DEFINE_FUNC(roar) = 0");
-
- return 0;
-}
-
-SND_PCM_PLUGIN_SYMBOL(roar);
-
-int __snd_pcm_roar_open_dlsym_pcm_001 (void) {
- ROAR_DBG("__snd_pcm_roar_open_dlsym_pcm_001(void) = 0");
- return 0;
-}
-
-//ll
Index: plugins/alsa/pcm_roar.c
===================================================================
--- plugins/alsa/pcm_roar.c	(revision 6052)
+++ 	(revision )
@@ -1,522 +1,0 @@
-//pcm_roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-//#define DEBUG
-#include "roar.h"
-
-// Equvivalent to prepare(). Starts a stream. Might/will be called several times during a program!
-/////////////////////////////////////////////////
-// Status: Should be mostly complete. 
-// Condition for invalid fh is not solved here.
-////////////////////////////////////////////////
-static int roar_pcm_start (snd_pcm_ioplug_t * io) {
- struct roar_alsa_pcm * self = io->private_data;
- int fh;
-#if 0
-#if defined(SOL_SOCKET) && defined(SO_SNDBUF)
- struct roar_vio_sysio_sockopt sockopt;
- int val;
-#endif
-#endif
-
- ROAR_DBG("roar_pcm_start(*) = ?");
-
- // If start is called several times in a row, just ignore it.
- if (self->stream_opened)
-  return 0;
-
- if ( roar_vio_simple_new_stream_obj(&(self->stream_vio), &(self->roar.con), &(self->stream),
-    self->info.rate, self->info.channels, self->info.bits, self->info.codec,
-    io->stream == SND_PCM_STREAM_PLAYBACK ? ROAR_DIR_PLAY : ROAR_DIR_MONITOR
-    ) == -1 ) {
-  return -EINVAL;
- }
-
- if ( self->stream_role != ROAR_ROLE_UNKNOWN ) {
-  if ( roar_stream_set_role(&(self->roar.con), &(self->stream), self->stream_role) == -1 ) {
-   ROAR_WARN("roar_pcm_start(*): Can not set stream role: %i: %s", self->stream_role, roar_error2str(roar_error));
-  }
- }
-
- if ( roar_vio_ctl(&(self->stream_vio), 
-    io->stream == SND_PCM_STREAM_PLAYBACK ? ROAR_VIO_CTL_GET_SELECT_WRITE_FH :
-    ROAR_VIO_CTL_GET_SELECT_READ_FH, &fh) != 1 ) {
-  io->poll_fd = fh;
-  io->poll_events = io->stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
-
-#if 0
-#if defined(SOL_SOCKET) && defined(SO_SNDBUF)
-  val             = self->bufsize > 4096 ? 4096 : self->bufsize;
-  sockopt.level   = SOL_SOCKET;
-  sockopt.optname = SO_SNDBUF;
-  sockopt.optval  = &val;
-  sockopt.optlen  = sizeof(val);
-  roar_vio_ctl(&(self->stream_vio), ROAR_VIO_CTL_GET_SYSIO_SOCKOPT, &sockopt);
-#endif
-#endif
- }
-
- // Oh, no, what should we do here if roar_vio_ctl() fails to grab a valid fh to poll?
- // In any case, ALSA will error out the next time it tries to poll() if we don't give it a valid fh.
-
- snd_pcm_ioplug_reinit_status(io);
-
- // Stream is now active, yay.
- self->stream_opened = 1;
-
- self->bufptr = 0;
- self->thread_active = 1; // We have to activate the thread before starting it, because the thread lives on that thread_active is 1.
- if ( pthread_create(&(self->thread), NULL, roar_plugin_thread, self) < 0 ) {
-  self->thread_active = 0;
-  return -1;
- }
-
- return 0;
-}
-
-void roar_plugin_reset(struct roar_alsa_pcm *self) {
- if ( !self->stream_opened )
-  return;
-
- roar_vio_close(&(self->stream_vio));
- self->stream_opened = 0;
- self->thread_active = 0;
- self->bufptr = 0;
- self->last_ptr = 0;
- self->total_written = 0;
- self->has_written = 0;
-}
-
-
-
-// Simply stopping the stream. Will need to be restarted to play more.
-// Will be called several times together with roar_pcm_start()
-///////////////////////////////////////////////////
-// Status: Still needs some error checking for the pthread calls, but
-// should work.
-//////////////////////////////////////////////////
-static int roar_pcm_stop (snd_pcm_ioplug_t *io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- // If this is called several times in a row, just ignore.
-
- ROAR_DBG("roar_pcm_stop(*) = 0");
-
-
- if ( self->thread_active ) {
-  self->thread_active = 0;
-  pthread_cond_signal(&(self->cond));
-  pthread_join(self->thread, NULL);
- }
-
- roar_plugin_reset(self);
-
- return 0;
-}
-
-///////////////////////////////
-// Status: Should be complete.
-///////////////////////////////
-static int roar_hw_constraint(struct roar_alsa_pcm * self) {
- snd_pcm_ioplug_t *io = &(self->io);
- static const snd_pcm_access_t access_list[] = {
-  SND_PCM_ACCESS_RW_INTERLEAVED
- };
- static const unsigned int formats[] = {
-  SND_PCM_FORMAT_S8,
-  SND_PCM_FORMAT_U8,
-  SND_PCM_FORMAT_A_LAW,
-  SND_PCM_FORMAT_MU_LAW,
-  SND_PCM_FORMAT_S16_LE,
-  SND_PCM_FORMAT_S16_BE,
-  SND_PCM_FORMAT_U16_LE,
-  SND_PCM_FORMAT_U16_BE,
-  SND_PCM_FORMAT_S32_LE,
-  SND_PCM_FORMAT_S32_BE,
-  SND_PCM_FORMAT_U32_LE,
-  SND_PCM_FORMAT_U32_BE,
-  SND_PCM_FORMAT_S24_3LE,
-  SND_PCM_FORMAT_S24_3BE,
-  SND_PCM_FORMAT_U24_3LE,
-  SND_PCM_FORMAT_U24_3BE,
- };
- int ret;
-
- ROAR_DBG("roar_hw_constraint(*) = ?");
-
- if ( (ret = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_ACCESS,
-     _as(access_list), access_list)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_FORMAT,
-     _as(formats), formats)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_CHANNELS,
-     1, ROAR_MAX_CHANNELS)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_RATE, 8000, 192000)) < 0 )
-  return ret;
-
- // We shouldn't let ALSA use extremely low or high values, it will kill a kitty most likely. :v
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES, 1 << 6, 1 << 18)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS, 1, 1024)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_BUFFER_BYTES, 1 << 13, 1 << 24)) < 0 )
-  return ret;
-
- ROAR_DBG("roar_hw_constraint(*) = 0");
-
- return 0;
-}
-
-// Referring to alsa-lib/src/pcm/pcm_ioplug.c : snd_pcm_ioplug_hw_ptr_update
-///////////////////////////////////////////////////////////
-// Status: Mostly complete, but uses a really nasty hack!
-///////////////////////////////////////////////////////////
-static snd_pcm_sframes_t roar_pcm_pointer(snd_pcm_ioplug_t *io) {
- struct roar_alsa_pcm * self = io->private_data;
- int ptr;
-
- ROAR_DBG("roar_pcm_pointer(*) = ?");
- // Did ALSA just call snd_pcm_reset() or something like that without calling the plugin? 
- // We should restart our stream as well.
- if ( io->appl_ptr < self->last_ptr ) {
-  roar_pcm_stop(io);
-  roar_pcm_start(io);
- }
-
- // ALSA has a weird way of calculating how much data can be written to the audio buffer.
- // It uses the formula:
- // avail = bufsize + ptr - io->appl_ptr; (??!?)
- // We really want this:
- // avail = bufsize - ptr;
- // This is the obvious way, so we have to manipulate ptr like this:
- // ptr = io->appl_ptr - ptr;
-
- pthread_mutex_lock(&(self->lock));
- ptr = snd_pcm_bytes_to_frames(io->pcm, self->bufptr);
- pthread_mutex_unlock(&(self->lock));
-
- ptr = io->appl_ptr - ptr;
- self->last_ptr = io->appl_ptr;
-
- ROAR_DBG("roar_pcm_pointer(*) appl_ptr: %i, ptr: %i, calculated avail frames: %i", (int)io->appl_ptr, (int)ptr, (int)(io->appl_ptr - ptr));
- ROAR_DBG("roar_pcm_pointer(*) = %i", ptr);
- return ptr;
-}
-
-// TODO: FIXME: add support for reading data!
-//////////////////////////////////////////////////
-// Status: For writing, this should be complete.
-//////////////////////////////////////////////////
-static snd_pcm_sframes_t roar_pcm_transfer(snd_pcm_ioplug_t *io,
-  const snd_pcm_channel_area_t *areas,
-  snd_pcm_uframes_t offset,
-  snd_pcm_uframes_t size) {
- struct roar_alsa_pcm * self = io->private_data;
- char * buf;
- size_t len = size * self->info.channels * self->info.bits / 8;
- ssize_t ret;
-
- ROAR_DBG("roar_pcm_transfer(*) = ?");
- ROAR_DBG("roar_pcm_transfer(*): len=%lu", (long unsigned int) len);
-
- // Weird ALSA stuff.
- buf = (char *)areas->addr + (areas->first + areas->step * offset) / 8;
-
- ret = roar_plugin_write(self, buf, len);
-
- if ( ret == -1 )
-  return -EIO;
-
- ROAR_DBG("roar_pcm_transfer(*) = %lli", (long long int)size);
- return size;
-}
-
-///////////////////////////////////////////////////////////////////
-// Status: Still missing proper delay measurements from the roar server. 
-// Only uses a blind timer now. In ideal conditions, this will work well.
-///////////////////////////////////////////////////////////////////
-static int roar_pcm_delay(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp) {
- struct roar_alsa_pcm * self = io->private_data;
-
- ROAR_DBG("roar_pcm_delay(*) = ?");
-
- // TODO: We need to set *delayp the latency in frames.
- pthread_mutex_lock(&(self->lock));
- roar_plugin_drain(self);
- *delayp = snd_pcm_bytes_to_frames(io->pcm, self->bytes_in_buffer);
- pthread_mutex_unlock(&(self->lock));
-
- return 0;
-}
-
-////////////////////
-// Status: Complete
-////////////////////
-static int roar_pcm_prepare(snd_pcm_ioplug_t *io) {
- ROAR_DBG("roar_pcm_prepare(*) = ?");
-
- return roar_pcm_start(io);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Status: This should be mostly complete.
-// I'm not sure if hw_params can be called several times during one stream without stop() start() in between. 
-// This will mean a memory leak, and possibly breakage should the buffer size change itself.
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static int roar_pcm_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params) {
- struct roar_alsa_pcm * self = io->private_data;
- snd_pcm_uframes_t buffersize;
- int err;
-
- ROAR_DBG("roar_pcm_hw_params(*) = ?");
-
- self->info.channels = io->channels;
- self->info.rate     = io->rate;
-
- switch (io->format) {
-  case SND_PCM_FORMAT_S8:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_U8:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_A_LAW:
-   self->info.codec = ROAR_CODEC_ALAW;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_MU_LAW:
-   self->info.codec = ROAR_CODEC_MULAW;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_S16_LE:
-   self->info.codec = ROAR_CODEC_PCM_S_LE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_S16_BE:
-   self->info.codec = ROAR_CODEC_PCM_S_BE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_U16_LE:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_U16_BE:
-   self->info.codec = ROAR_CODEC_PCM_U_BE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_S32_LE:
-   self->info.codec = ROAR_CODEC_PCM_S_LE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_S32_BE:
-   self->info.codec = ROAR_CODEC_PCM_S_BE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_U32_LE:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_U32_BE:
-   self->info.codec = ROAR_CODEC_PCM_U_BE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_S24_3LE:
-   self->info.codec = ROAR_CODEC_PCM_S_LE;
-   self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_S24_3BE:
-   self->info.codec = ROAR_CODEC_PCM_S_BE;
-   self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_U24_3LE:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_U24_3BE:
-   self->info.codec = ROAR_CODEC_PCM_U_BE;
-   self->info.bits  = 24;
-   break;
-  default:
-   return -EINVAL;
- }
-
- if ((err = snd_pcm_hw_params_get_buffer_size(params, &buffersize) < 0))
-  return err;
-
- ROAR_DBG("roar_pcm_hw_params(*) buffersize (bytes): %i", (int)buffersize);
-
- //self->bufsize = snd_pcm_frames_to_bytes(io->pcm, buffersize);
- self->bufsize = self->info.bits * self->info.channels * buffersize / 8;
- self->buffer = malloc(self->bufsize);
- if (self->buffer == NULL)
-  return -1;
- self->bufptr = 0;
-
- ROAR_DBG("roar_pcm_hw_params(*) Setting buffersize (bytes): %i", (int)self->bufsize);
- ROAR_DBG("roar_pcm_hw_params(*) = 0");
- return 0;
-}
-
-///////////////////////////////////
-// Status: This should be complete. 
-// This is the last cleanup function to be called by ALSA.
-///////////////////////////////////
-static int roar_pcm_close (snd_pcm_ioplug_t * io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- ROAR_DBG("roar_pcm_close(*) = ?");
-
- roar_disconnect(&(self->roar.con));
-
- pthread_mutex_destroy(&(self->lock));
- pthread_mutex_destroy(&(self->cond_lock));
- pthread_cond_destroy(&(self->cond));
-
- free(self->buffer);
- free(self);
-
- return 0;
-}
-
-static snd_pcm_ioplug_callback_t roar_pcm_callback = {
- .start                  = roar_pcm_start,
- .stop                   = roar_pcm_stop,
- .pointer                = roar_pcm_pointer,
- .transfer               = roar_pcm_transfer,
- .delay                  = roar_pcm_delay,
- .prepare                = roar_pcm_prepare,
- .hw_params              = roar_pcm_hw_params,
- .close                  = roar_pcm_close,
-};
-
-SND_PCM_PLUGIN_DEFINE_FUNC(roar) {
- struct roar_alsa_pcm * self;
- snd_config_iterator_t i, next;
- snd_config_t * n;
- const char   * para;
- const char   * server = NULL;
- const char   * tmp;
- int            role = ROAR_ROLE_UNKNOWN;
- int            ret;
-
- (void)root;
-
- ROAR_DBG("SND_PCM_PLUGIN_DEFINE_FUNC(roar) = ?");
-
- snd_config_for_each(i, next, conf) {
-  n = snd_config_iterator_entry(i);
-  if ( snd_config_get_id(n, &para) < 0 )
-   continue;
-
-  if ( !strcmp(para, "type") || !strcmp(para, "comment") || !strcmp(para, "hint") )
-   continue;
-
-  if ( !strcmp(para, "server") ) {
-   if (snd_config_get_string(n, &server) < 0) {
-    return -EINVAL;
-   }
-  } else if ( !strcmp(para, "role") ) {
-   if (snd_config_get_string(n, &tmp) < 0) {
-    return -EINVAL;
-   }
-   if ( (role = roar_str2role(tmp)) == -1 ) {
-    return -EINVAL;
-   }
-  } else {
-   return -EINVAL;
-  }
- }
-
- errno = ENOSYS;
-
- if ( (self = malloc(sizeof(struct roar_alsa_pcm))) == NULL )
-  return -errno;
-
- memset(self, 0, sizeof(struct roar_alsa_pcm));
-
- self->stream_role = role;
-
- errno = ENOSYS;
- if ( roar_simple_connect(&(self->roar.con), (char*)server, "ALSA Plugin") == -1 ) {
-  free(self);
-  return -errno;
- }
-
- self->io.version      = SND_PCM_IOPLUG_VERSION;
- self->io.name         = "RoarAudio Plugin";
- self->io.poll_fd      =  -1;
- self->io.poll_events  =  POLLOUT;
- self->io.mmap_rw      =  0;
- self->io.callback     = &roar_pcm_callback;
- self->io.private_data =  self;
-
- if ( (ret = snd_pcm_ioplug_create(&(self->io), name, stream, mode)) < 0 ) {
-  roar_disconnect(&(self->roar.con));
-  free(self);
-  return ret;
- }
-
- pthread_mutex_init(&(self->lock), NULL);
- pthread_mutex_init(&(self->cond_lock), NULL);
- pthread_cond_init(&(self->cond), NULL);
-
-
- if ( (ret = roar_hw_constraint(self)) < 0 ) {
-  snd_pcm_ioplug_delete(&(self->io));
-  roar_disconnect(&(self->roar.con));
-  free(self);
-  return ret;
- }
-
- *pcmp = self->io.pcm;
-
- ROAR_DBG("SND_PCM_PLUGIN_DEFINE_FUNC(roar) = 0");
-
- return 0;
-}
-
-SND_PCM_PLUGIN_SYMBOL(roar);
-
-//ll
Index: plugins/alsa/roar.c
===================================================================
--- plugins/alsa/roar.c	(revision 6052)
+++ 	(revision )
@@ -1,35 +1,0 @@
-//roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- */
-
-#include "roar.h"
-
-struct snd_dlsym_link *snd_dlsym_start;
-
-//ll
Index: plugins/alsa/roar.h
===================================================================
--- plugins/alsa/roar.h	(revision 6052)
+++ 	(revision )
@@ -1,86 +1,0 @@
-//roar.h:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-#ifndef _ROARAUDIO_PLUGINS_ALSA_ROAR_H_
-#define _ROARAUDIO_PLUGINS_ALSA_ROAR_H_
-
-#include <roaraudio.h>
-#include <errno.h>
-#include <alsa/asoundlib.h>
-#include <alsa/global.h>
-#include <alsa/pcm_external.h>
-#include <alsa/control_external.h>
-#include <pthread.h>
-#include <time.h>
-
-#define _as(x) (sizeof((x))/sizeof(*(x)))
-
-struct roar_alsa {
- struct roar_connection con;
-};
-
-struct roar_alsa_pcm {
- snd_pcm_ioplug_t       io;
- struct roar_alsa       roar;
- struct roar_audio_info info;
- struct roar_stream     stream;
- struct roar_vio_calls  stream_vio;
- int                    stream_role;
- int                    stream_opened;
- size_t                 writec;
- size_t                 last_ptr;
- char*                  buffer;
- size_t                 bufsize;
- volatile size_t        bufptr;
- pthread_t              thread;
- pthread_mutex_t        lock;
- pthread_mutex_t        cond_lock;
- pthread_cond_t         cond;
- volatile int           thread_active;
- int                    bytes_in_buffer;
- volatile int64_t       total_written;
- int                    has_written;
- struct timespec        start_tv;
-};
-
-void roar_plugin_reset(struct roar_alsa_pcm * self);
-void* roar_plugin_thread (void * thread_data);
-size_t roar_plugin_write(struct roar_alsa_pcm * self, const char * buf, size_t size);
-void roar_plugin_drain(struct roar_alsa_pcm * self);
-
-#endif
-
-//ll
Index: plugins/alsa/thread.c
===================================================================
--- plugins/alsa/thread.c	(revision 6052)
+++ 	(revision )
@@ -1,192 +1,0 @@
-//thread.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-//#define DEBUG
-
-#include "roar.h"
-#define CHUNK_SIZE 2048
-//#define CHUNK_SIZE 256
-
-
-// Writes to the FIFO buffer. Waits until there is room to write.
-size_t roar_plugin_write(struct roar_alsa_pcm *self, const char *buf, size_t size) {
- ROAR_DBG("roar_plugin_write(self=%p, buf=%p, size=%llu) = ?", self, buf, (long long unsigned int)size);
-
- /* Wait until we have a ready buffer */
- while (1) {
-  /* Should the thread be shut down while we're running, return with error */
-  if ( !self->thread_active )
-   return 0;
-
-  //fprintf(stderr, "%d + %d : %d\n", (int)self->bufptr, (int)size, (int)self->bufsize);
-  pthread_mutex_lock(&(self->lock));
-  if (self->bufptr + size <= self->bufsize) {
-   pthread_mutex_unlock(&(self->lock));
-   break;
-  }
-  pthread_mutex_unlock(&(self->lock));
-
-  pthread_cond_signal(&(self->cond));
-  /* Sleeps until we can write to the FIFO. */
-  pthread_mutex_lock(&(self->cond_lock));
-  pthread_cond_wait(&(self->cond), &(self->cond_lock));
-  pthread_mutex_unlock(&(self->cond_lock));
- }
-
- pthread_mutex_lock(&(self->lock));
- memcpy(self->buffer + self->bufptr, buf, size);
- self->bufptr += (int)size;
- pthread_mutex_unlock(&(self->lock));
-
- /* Send signal to thread that buffer has been updated */
- pthread_cond_signal(&(self->cond));
-
- return size;
-}
-
-#define _TEST_CANCEL() do { \
- if ( !self->thread_active ) \
-  goto test_quit; \
-} while(0)
-
-// Attemps to drain the buffer at all times and write to libroar.
-// If there is no data, it will wait for roar_plugin_write() to fill up more data.
-void * roar_plugin_thread (void * thread_data) {
- /* We share data between thread and callable functions */
- struct roar_alsa_pcm *self = thread_data;
- int rc;
-
- /* Plays back data as long as there is data in the buffer. Else, sleep until it can. */
- /* Two loops! :3 Beware! */
- while(1) {
-  ROAR_DBG("roar_plugin_thread(thread_data=%p): got woken up.", thread_data);
-  while(1) {
-   _TEST_CANCEL();
-   // We ask the server to send its latest backend data. Do not really care about errors atm.
-   // We only bother to check after 1 sec of audio has been played, as it might be quite inaccurate in the start of the stream.
-
-   /* If the buffer is empty or we've stopped the stream. Jump out of this for loop */
-   pthread_mutex_lock(&(self->lock));
-   if ( self->bufptr < CHUNK_SIZE ) {
-    pthread_mutex_unlock(&(self->lock));
-    break;
-   }
-   pthread_mutex_unlock(&(self->lock));
-
-   ROAR_DBG("roar_plugin_thread(thread_data=%p): Start writing.", thread_data);
-   rc = roar_vio_write(&(self->stream_vio), self->buffer, CHUNK_SIZE);
-   ROAR_DBG("roar_plugin_thread(thread_data=%p): wrote %lli bytes.", thread_data, (long long int)rc);
-
-   /* If this happens, we should make sure that subsequent and current calls to rsd_write() will fail. */
-   if ( rc < 0 ) {
-    _TEST_CANCEL();
-    roar_plugin_reset(self);
-
-    /* Wakes up a potentially sleeping fill_buffer() */
-    pthread_cond_signal(&(self->cond));
-
-    /* This thread will not be joined, so detach. */
-    pthread_detach(pthread_self());
-    pthread_exit(NULL);
-   }
-
-   if ( !self->has_written ) {
-    pthread_mutex_lock(&(self->lock));
-    clock_gettime(CLOCK_MONOTONIC, &(self->start_tv));
-    self->has_written = 1;
-    pthread_mutex_unlock(&(self->lock));
-   }
-
-   pthread_mutex_lock(&(self->lock));
-   self->total_written += rc;
-   pthread_mutex_unlock(&(self->lock));
-
-   /* "Drains" the buffer. This operation looks kinda expensive with large buffers, but hey. D: */
-   pthread_mutex_lock(&(self->lock));
-   memmove(self->buffer, self->buffer + rc, self->bufsize - rc);
-   self->bufptr -= rc;
-   pthread_mutex_unlock(&(self->lock));
-   ROAR_DBG("roar_plugin_thread(*): Wrote data to vio. New bufptr: %i", (int)self->bufptr);
-
-   /* Buffer has decreased, signal fill_buffer() */
-   pthread_cond_signal(&(self->cond));
-
-  }
-
-  /* If we're still good to go, sleep. We are waiting for fill_buffer() to fill up some data. */
-test_quit:
-  if ( self->thread_active ) {
-   pthread_cond_signal(&(self->cond));
-   pthread_mutex_lock(&(self->cond_lock));
-   pthread_cond_wait(&(self->cond), &(self->cond_lock));
-   pthread_mutex_unlock(&(self->cond_lock));
-  } else {
-   /* Abandon the ship, chap. */
-   pthread_cond_signal(&(self->cond));
-   pthread_exit(NULL);
-  }
-
- }
-}
-
-void roar_plugin_drain(struct roar_alsa_pcm *self) {
- struct timespec now_tv;
- int64_t temp, temp2;
-
- /* If the audio playback has started on the server we need to use timers. */
- if ( self->has_written ) {
-
-  /* Falls back to gettimeofday() when CLOCK_MONOTONIC is not supported */
-
-  /* Calculates the amount of bytes that the server has consumed. */
-  clock_gettime(CLOCK_MONOTONIC, &now_tv);
-
-  temp   = (int64_t)now_tv.tv_sec - (int64_t)self->start_tv.tv_sec;
-
-  temp  *= self->info.rate * self->info.channels * self->info.bits / 8;
-
-  temp2  = (int64_t)now_tv.tv_nsec - (int64_t)self->start_tv.tv_nsec;
-  temp2 *= self->info.rate * self->info.channels * self->info.bits / 8;
-  temp2 /= 1000000000LL;
-  temp  += temp2;
-  /* Calculates the amount of data we have in our virtual buffer. Only used to calculate delay. */
-  self->bytes_in_buffer = (int)((int64_t)self->total_written + (int64_t)self->bufptr - temp);
- } else {
-  self->bytes_in_buffer = self->bufptr;
- }
-}
-
-//ll
Index: plugins/alsavs/.release-helper
===================================================================
--- plugins/alsavs/.release-helper	(revision 5196)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!RELEASE-HELPER:0.0beta0
-@RM thread.c
-#!END
Index: plugins/alsavs/Makefile
===================================================================
--- plugins/alsavs/Makefile	(revision 5851)
+++ 	(revision )
@@ -1,36 +1,0 @@
-BASENAME0=libasound_module_pcm_roar
-BASENAME1=libasound_module_ctl_roar
-SLIB0=$(BASENAME0)$(SHARED_SUFFIX)
-SLIB1=$(BASENAME1)$(SHARED_SUFFIX)
-TARGET=$(SLIB0) $(SLIB1)
-INSTALL_DIR=$(PREFIX_LIB)/alsa-lib/
-OBJS0=pcm_roar.o roar.o
-OBJS1=ctl_roar.o roar.o
-
-include ../../Makefile.conf
-include ../../Makefile.inc
-#include Makefile.conf
-
-#DEBUG=-DDEBUG -DXXX
-DEFINES=-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"alsa-plugins\" -DVERSION=\"1.0.13\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DSTDC_HEADERS=1 -DHAVE_LIBASOUND=1 -D_REENTRANT -DPIC
-CFLAGS += $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) -I../../include $(DEFINES) $(DEBUG) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC) -I/usr/include/alsa -D_GNU_SOURCE $(pthread)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(SHARED) $(LDPATH) -L../../lib $(pthread)
-LIBS    = $(LIBROAR) $(lib_m) $(lib_dl) -lrt $(lib_asound)
-
-all: ${TARGET}
-clean:
-	rm -f ${TARGET} *.o tests tests.c
-new: clean all
-
-install: ${TARGET}
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	cp ${TARGET} ${DESTDIR}${INSTALL_DIR}
-semi-install: ${TARGET}
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	ln -fs `pwd`/$(SLIB0) ${DESTDIR}${INSTALL_DIR}
-	ln -fs `pwd`/$(SLIB1) ${DESTDIR}${INSTALL_DIR}
-
-$(SLIB0): $(OBJS0)
-	$(CC) $(LDFLAGS) -Wl,-soname -Wl,$(SLIB0) -o $(SLIB0) $(OBJS0) $(LIBS)
-$(SLIB1): $(OBJS1)
-	$(CC) $(LDFLAGS) -Wl,-soname -Wl,$(SLIB1) -o $(SLIB1) $(OBJS1) $(LIBS)
Index: plugins/alsavs/ctl_roar.c
===================================================================
--- plugins/alsavs/ctl_roar.c	(revision 6052)
+++ 	(revision )
@@ -1,328 +1,0 @@
-//ctl_roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-//#define DEBUG
-#include "roar.h"
-#include <string.h>
-
-#ifdef DEBUG
-static struct roar_vio_calls DEBUG_FH;
-#endif
-
-static void roar_plugin_close(snd_ctl_ext_t * ext) {
- struct roar_alsa_ctl * self = ext->private_data;
-
- roar_disconnect(&(self->roar.con));
- free(self);
-}
-
-static int roar_plugin_elem_count(snd_ctl_ext_t *ext) {
- struct roar_alsa_ctl * self = ext->private_data;
- int ret = 0;
-
- for (; self->streams[ret].id != -1; ret++);
-
- return ret;
-}
-
-static int roar_plugin_elem_list(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id) {
- struct roar_alsa_ctl * self = ext->private_data;
-
- snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_id_set_name(id, self->streams[offset].name);
-
- return 0; 
-}
-
-// ALSA is strange here, this function makes keys (stream ID) from non-unique stream names...
-static snd_ctl_ext_key_t roar_plugin_find_elem(snd_ctl_ext_t *ext,
-                                               const snd_ctl_elem_id_t *id) {
- struct roar_alsa_ctl * self = ext->private_data;
-// int numid = snd_ctl_elem_id_get_numid(id);
- const char * name;
- int i;
-
-// ROAR_DBG("roar_plugin_find_elem(ext=%p, id=%p): numid=%i", ext, id, numid);
-
-// return self->streams[numid].id;
-
- name = snd_ctl_elem_id_get_name(id);
-
- for (i = 0; i < MAX_STREAMS; i++) {
-  if ( !strcmp(self->streams[i].name, name) ) {
-   return self->streams[i].id;
-  }
- }
-
- return SND_CTL_EXT_KEY_NOT_FOUND;
-}
-
-static int roar_plugin_get_attribute(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
-                                     int *type, unsigned int *acc, unsigned int *count) {
- struct roar_alsa_ctl * self = ext->private_data;
- int i;
-
- *type = SND_CTL_ELEM_TYPE_INTEGER;
- *acc = SND_CTL_EXT_ACCESS_READWRITE;
-
- for (i = 0; i < MAX_STREAMS && self->streams[i].id != (int)key; i++)
-
- if ( i == MAX_STREAMS )
-  return -EIO;
-
- *count = self->streams[i].channels;
-
- return 0;
-}
-
-static int roar_plugin_get_integer_info(snd_ctl_ext_t *ext ATTRIBUTE_UNUSED,
-                                        snd_ctl_ext_key_t key ATTRIBUTE_UNUSED,
-                                        long *imin, long *imax, long *istep) {
- *istep = 0;
- *imin  = 0;
- *imax  = 65535;
- return 0;
-}
-
-static int roar_plugin_read_integer(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value) {
- struct roar_alsa_ctl * self = ext->private_data;
- struct roar_mixer_settings mixer;
- int channels;
- int i;
-
- for (i = 0; i < MAX_STREAMS && self->streams[i].id != (int)key; i++)
-
- if ( i == MAX_STREAMS )
-  return -EIO;
-
- roar_err_clear_all();
- if ( roar_get_vol(&(self->roar.con), key, &mixer, &channels) == -1 ) {
-  roar_err_update();
-  return -errno;
- }
-
- if ( channels != (int)self->streams[i].channels )
-  return -EIO;
-
- for (i = 0; i < channels; i++)
-  value[i] = ((unsigned long int)mixer.mixer[i] * 65535LU) / mixer.scale;
-
- return 0;
-}
-
-static int roar_plugin_write_integer(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value) {
- struct roar_alsa_ctl * self = ext->private_data;
- struct roar_mixer_settings mixer;
- int sid;
- int i;
-
- ROAR_DBG("roar_plugin_write_integer(ext=%p, key=%i, value=%p) = ?", ext, (int)key, value);
-
- for (sid = 0; sid < MAX_STREAMS && self->streams[sid].id != (int)key; sid++)
-
- if ( sid == MAX_STREAMS )
-  return -EIO;
-
- mixer.scale = 65535;
- mixer.rpg_mul = 1;
- mixer.rpg_div = 1;
-
- for (i = 0; i < (int)self->streams[i].channels; i++)
-  mixer.mixer[i] = value[i];
-
- roar_err_clear_all();
- if ( roar_set_vol(&(self->roar.con), key, &mixer, self->streams[sid].channels, ROAR_SET_VOL_ALL) == -1 ) {
-  roar_err_update();
-  return -errno;
- }
-
- return 0;
-}
-
-static int roar_plugin_read_event(snd_ctl_ext_t *ext ATTRIBUTE_UNUSED,
-                                  snd_ctl_elem_id_t *id ATTRIBUTE_UNUSED,
-                                  unsigned int *event_mask ATTRIBUTE_UNUSED) {
- return -EAGAIN;
-}
-
-static void roar_plugin__handle_stream(struct roar_alsa_ctl * self, int id) {
- struct roar_mixerstream * cs = NULL;
- struct roar_stream s;
- char name[1024];
- int i;
-
- if ( roar_get_stream(&(self->roar.con), &s, id) == -1 )
-  return;
-
- switch (s.dir) {
-  case ROAR_DIR_OUTPUT:
-  case ROAR_DIR_MIXING:
-  case ROAR_DIR_BRIDGE:
-    if ( roar_stream_get_name(&(self->roar.con), &s, name, sizeof(name)) != 0 )
-     snprintf(name, sizeof(name), "Stream %i", id);
-   break;
-  default:
-    return;
-   break;
- }
-
- switch (s.dir) {
-  case ROAR_DIR_MIXING:
-  case ROAR_DIR_BRIDGE:
-    if ( strstr(name, "MIDI") != NULL || strstr(name, "Light") != NULL )
-     return;
-   break;
- }
-
- for (i = 0; cs == NULL && i < (int)(sizeof(self->streams)/sizeof(*self->streams)); i++)
-  if (self->streams[i].id == -1 )
-   cs = &(self->streams[i]);
-
- if ( cs == NULL )
-  return;
-
- cs->id = id;
- cs->channels = s.info.channels;
- strncpy(cs->name, name, sizeof(cs->name) - 1); 
-}
-
-static int roar_plugin__find_streams(struct roar_alsa_ctl * self) {
- int id[ROAR_STREAMS_MAX];
- int num;
- int i;
-
- for (i = 0; i < (int)(sizeof(self->streams)/sizeof(*self->streams)); i++)
-  self->streams[i].id = -1;
-
- roar_err_clear_all();
-
- if ( (num = roar_list_streams(&(self->roar.con), id, ROAR_STREAMS_MAX)) == -1 ) {
-  roar_err_update();
-  return -errno;
- }
-
- for (i = 0; i < num; i++)
-  roar_plugin__handle_stream(self, i);
-
- return 0;
-}
-
-static snd_ctl_ext_callback_t roar_ext_callback = {
- .close            = roar_plugin_close,
- .elem_count       = roar_plugin_elem_count,
- .elem_list        = roar_plugin_elem_list,
- .find_elem        = roar_plugin_find_elem,
- .get_attribute    = roar_plugin_get_attribute,
- .get_integer_info = roar_plugin_get_integer_info,
- .read_integer     = roar_plugin_read_integer,
- .write_integer    = roar_plugin_write_integer,
- .read_event       = roar_plugin_read_event
-};
-
-SND_CTL_PLUGIN_DEFINE_FUNC(roar) {
- struct roar_alsa_ctl * self;
- snd_config_iterator_t i, next;
- snd_config_t * n;
- const char   * para;
- const char   * server = NULL;
- int error;
-
- const char   * ext_id   = "ROAR";
- const char   * ext_name = "RoarAudio";
-
- (void)root;
-
-#ifdef DEBUG
- roar_vio_open_dstr_simple(&DEBUG_FH, "/tmp/alsamixer-roar.log", O_WRONLY|O_CREAT|O_APPEND);
- roar_debug_set_stderr_vio(&DEBUG_FH);
- roar_debug_set_stderr_mode(ROAR_DEBUG_MODE_VIO);
-#endif
-
- snd_config_for_each(i, next, conf) {
-  n = snd_config_iterator_entry(i);
-  if ( snd_config_get_id(n, &para) < 0 )
-   continue;
-
-  if ( !strcmp(para, "type") || !strcmp(para, "comment") || !strcmp(para, "hint") )
-   continue;
-
-  if ( !strcmp(para, "server") ) {
-   if (snd_config_get_string(n, &server) < 0) {
-    return -EINVAL;
-   }
-  } else {
-   return -EINVAL;
-  }
- }
-
- if ( (self = malloc(sizeof(struct roar_alsa_ctl))) == NULL )
-  return -errno;
-
- memset(self, 0, sizeof(struct roar_alsa_ctl));
-
- errno = ENOSYS;
- if ( roar_simple_connect(&(self->roar.con), server, "ALSA Plugin") == -1 ) {
-  free(self);
-  return -errno;
- }
-
- if ( (error = roar_plugin__find_streams(self)) < 0 ) {
-  roar_disconnect(&(self->roar.con));
-  free(self);
-  return error;
- }
-
- self->ext.version = SND_CTL_EXT_VERSION;
- self->ext.card_idx = 0; /* FIXME */
- strncpy(self->ext.id, ext_id, sizeof(self->ext.id) - 1);
- strcpy(self->ext.driver, "OSS-Emulation");
- strncpy(self->ext.name, ext_name, sizeof(self->ext.name) - 1);
- strncpy(self->ext.longname, ext_name, sizeof(self->ext.longname) - 1);
- strncpy(self->ext.mixername, ext_name, sizeof(self->ext.mixername) - 1);
- self->ext.poll_fd = -1;
- self->ext.callback = &roar_ext_callback; 
- self->ext.private_data = self;
-
- if ( (error = snd_ctl_ext_create(&(self->ext), name, mode)) < 0 ) {
-  roar_disconnect(&(self->roar.con));
-  free(self);
-  return error;
- }
-
- *handlep = self->ext.handle;
- return 0;
-}
-
-SND_CTL_PLUGIN_SYMBOL(roar);
Index: plugins/alsavs/pcm_roar.c
===================================================================
--- plugins/alsavs/pcm_roar.c	(revision 6052)
+++ 	(revision )
@@ -1,516 +1,0 @@
-//pcm_roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010-2011
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-//#define DEBUG
-#include "roar.h"
-
-// Equvivalent to prepare(). Starts a stream. Might/will be called several times during a program!
-/////////////////////////////////////////////////
-// Status: Should be mostly complete. 
-// Condition for invalid fh is not solved here.
-////////////////////////////////////////////////
-static int roar_pcm_start (snd_pcm_ioplug_t * io) {
- struct roar_alsa_pcm * self = io->private_data;
- int fh;
- int val;
- int err;
-
- ROAR_DBG("roar_pcm_start(*) = ?");
-
- // If start is called several times in a row, just ignore it.
- if (self->stream_opened)
-  return 0;
-
- if ( (self->vss = roar_vs_new_from_con(&(self->roar.con), &err)) == NULL ) {
-  roar_err_set(err);
-  roar_err_update();
-  return -errno;
- }
-
- if ( roar_vs_stream(self->vss, &(self->info),
-                     io->stream == SND_PCM_STREAM_PLAYBACK ? ROAR_DIR_PLAY : ROAR_DIR_MONITOR,
-                     &err) == -1 ) {
-  roar_vs_close(self->vss, ROAR_VS_TRUE, NULL);
-  self->vss = NULL;
-  roar_err_set(err);
-  roar_err_update();
-  return -errno;
- }
-
- // ALSA really expects there to be self->bufsize writable bytes.
- if ( roar_vs_buffer(self->vss, self->bufsize + 1, &err) == -1 ) {
-  roar_vs_close(self->vss, ROAR_VS_TRUE, NULL);
-  self->vss = NULL;
-  roar_err_set(err);
-  roar_err_update();
-  return -errno;
- }
-
- val = ROAR_VS_ASYNCLEVEL_AUTO;
- if ( roar_vs_ctl(self->vss, ROAR_VS_CMD_SET_ASYNC, &val, &err) == -1 ) {
-  roar_vs_close(self->vss, ROAR_VS_TRUE, NULL);
-  self->vss = NULL;
-  roar_err_set(err);
-  roar_err_update();
-  return -errno;
- }
-
- if ( self->stream_role != ROAR_ROLE_UNKNOWN ) {
-  if ( roar_vs_role(self->vss, self->stream_role, &err) == -1 ) {
-   ROAR_WARN("roar_pcm_start(*): Can not set stream role: %s(%i): %s",
-             roar_role2str(self->stream_role), self->stream_role, roar_error2str(roar_error));
-  }
- }
-
- if ( roar_vio_ctl(roar_vs_vio_obj(self->vss, NULL), 
-    io->stream == SND_PCM_STREAM_PLAYBACK ? ROAR_VIO_CTL_GET_SELECT_WRITE_FH :
-    ROAR_VIO_CTL_GET_SELECT_READ_FH, &fh) != 1 ) {
-  io->poll_fd = fh;
-  io->poll_events = io->stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
- }
-
- // Oh, no, what should we do here if roar_vio_ctl() fails to grab a valid fh to poll?
- // In any case, ALSA will error out the next time it tries to poll() if we don't give it a valid fh.
-
- snd_pcm_ioplug_reinit_status(io);
-
- // Stream is now active, yay.
- self->stream_opened = 1;
-
- ROAR_DBG("roar_pcm_start(*) = 0");
- return 0;
-}
-
-void roar_plugin_reset(struct roar_alsa_pcm *self) {
- if ( !self->stream_opened )
-  return;
-
- roar_vs_close(self->vss, ROAR_VS_TRUE, NULL);
- self->vss = NULL;
- self->stream_opened = 0;
- self->last_ptr = 0;
-}
-
-
-
-// Simply stopping the stream. Will need to be restarted to play more.
-// Will be called several times together with roar_pcm_start()
-///////////////////////////////////////////////////
-// Status: Still needs some error checking for the pthread calls, but
-// should work.
-//////////////////////////////////////////////////
-static int roar_pcm_stop (snd_pcm_ioplug_t *io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- // If this is called several times in a row, just ignore.
-
- ROAR_DBG("roar_pcm_stop(*) = 0");
-
- roar_plugin_reset(self);
-
- return 0;
-}
-
-///////////////////////////////
-// Status: Should be complete.
-///////////////////////////////
-static int roar_hw_constraint(struct roar_alsa_pcm * self) {
- snd_pcm_ioplug_t *io = &(self->io);
- static const snd_pcm_access_t access_list[] = {
-  SND_PCM_ACCESS_RW_INTERLEAVED
- };
- static const unsigned int formats[] = {
-  SND_PCM_FORMAT_S8,
-  SND_PCM_FORMAT_U8,
-  SND_PCM_FORMAT_A_LAW,
-  SND_PCM_FORMAT_MU_LAW,
-  SND_PCM_FORMAT_S16_LE,
-  SND_PCM_FORMAT_S16_BE,
-  SND_PCM_FORMAT_U16_LE,
-  SND_PCM_FORMAT_U16_BE,
-  SND_PCM_FORMAT_S32_LE,
-  SND_PCM_FORMAT_S32_BE,
-  SND_PCM_FORMAT_U32_LE,
-  SND_PCM_FORMAT_U32_BE,
-  SND_PCM_FORMAT_S24_3LE,
-  SND_PCM_FORMAT_S24_3BE,
-  SND_PCM_FORMAT_U24_3LE,
-  SND_PCM_FORMAT_U24_3BE,
- };
- int ret;
-
- ROAR_DBG("roar_hw_constraint(*) = ?");
-
- if ( (ret = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_ACCESS,
-     _as(access_list), access_list)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_FORMAT,
-     _as(formats), formats)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_CHANNELS,
-     1, ROAR_MAX_CHANNELS)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_RATE, 8000, 192000)) < 0 )
-  return ret;
-
- // We shouldn't let ALSA use extremely low or high values, it will kill a kitty most likely. :v
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES, 1 << 6, 1 << 18)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS, 1, 1024)) < 0 )
-  return ret;
-
- if ( (ret = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_BUFFER_BYTES, 1 << 13, 1 << 24)) < 0 )
-  return ret;
-
- ROAR_DBG("roar_hw_constraint(*) = 0");
-
- return 0;
-}
-
-// Referring to alsa-lib/src/pcm/pcm_ioplug.c : snd_pcm_ioplug_hw_ptr_update
-///////////////////////////////////////////////////////////
-// Status: Mostly complete, but uses a really nasty hack!
-///////////////////////////////////////////////////////////
-static snd_pcm_sframes_t roar_pcm_pointer(snd_pcm_ioplug_t *io) {
- struct roar_alsa_pcm * self = io->private_data;
- int ptr;
- int buffered;
- ssize_t avail;
-
- ROAR_DBG("roar_pcm_pointer(*) = ?");
-
- // Did ALSA just call snd_pcm_reset() or something like that without calling the plugin? 
- // We should restart our stream as well.
- if ( io->appl_ptr < self->last_ptr ) {
-  roar_pcm_stop(io);
-  roar_pcm_start(io);
- }
-
- // ALSA expects return value to be equal to the amount of data written on the hardware side.
- // It uses this to calculate writable amount. (Because hey, just calling a get_avail() is too hard.)
- // Return value is thus io->appl_ptr - buffered_amount;
-
- while ( roar_vs_iterate(self->vss, ROAR_VS_NOWAIT, NULL) == 2 );
-
- avail = roar_vs_get_avail_write(self->vss, NULL);
- ROAR_DBG("roar_pcm_pointer(*): avail=%lli", (long long int)avail);
- buffered = snd_pcm_bytes_to_frames(io->pcm, self->bufsize - avail);
-
- ptr = io->appl_ptr - buffered;
- self->last_ptr = io->appl_ptr;
-
- ROAR_DBG("roar_pcm_pointer(*) appl_ptr (frames): %i, buffered (frames): %i", (int)io->appl_ptr, (int)buffered);
- ROAR_DBG("roar_pcm_pointer(*) = %i", ptr);
- return ptr;
-}
-
-// TODO: FIXME: add support for reading data!
-//////////////////////////////////////////////////
-// Status: For writing, this should be complete.
-//////////////////////////////////////////////////
-static snd_pcm_sframes_t roar_pcm_transfer(snd_pcm_ioplug_t *io,
-  const snd_pcm_channel_area_t *areas,
-  snd_pcm_uframes_t offset,
-  snd_pcm_uframes_t size) {
- struct roar_alsa_pcm * self = io->private_data;
- char * buf;
- size_t len = size * self->info.channels * self->info.bits / 8;
- ssize_t ret;
-
- ROAR_DBG("roar_pcm_transfer(*) = ?");
- ROAR_DBG("roar_pcm_transfer(*): len=%lu", (long unsigned int) len);
-
- // Weird ALSA stuff.
- buf = (char *)areas->addr + (areas->first + areas->step * offset) / 8;
-
- while (len) {
-  ret = roar_vs_write(self->vss, buf, len, NULL);
-/*
- * <ph3-der-loewe> is it supposed to be EIO?
- * <ph3-der-loewe> or can we return the true error code from roar_vs_write()?
- * <maister> ALSA tends to give -EIO errors
- * <maister> It shouldn't cause problems to pass roar_vs errnos.
- * <maister> But the error strings might be a bit confusing perhaps
- */
-  if ( ret == -1 )
-   return -EIO;
-  len -= ret;
-  buf += ret;
- }
-
- while ( roar_vs_iterate(self->vss, ROAR_VS_NOWAIT, NULL) == 2 );
-
- ROAR_DBG("roar_pcm_transfer(*) = %lli", (long long int)size);
- return size;
-}
-
-///////////////////////////////////////////////////////////////////
-// Status: Still missing proper delay measurements from the roar server. 
-// Only uses a blind timer now. In ideal conditions, this will work well.
-///////////////////////////////////////////////////////////////////
-static int roar_pcm_delay(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp) {
- struct roar_alsa_pcm * self = io->private_data;
- roar_mus_t lat;
-
- ROAR_DBG("roar_pcm_delay(*) = ?");
-
- lat = roar_vs_latency(self->vss, ROAR_VS_BACKEND_DEFAULT, ROAR_VS_NOWAIT, NULL);
- *delayp = (lat * self->info.rate) / 1000000;
-
- return 0;
-}
-
-////////////////////
-// Status: Complete
-////////////////////
-static int roar_pcm_prepare(snd_pcm_ioplug_t *io) {
- ROAR_DBG("roar_pcm_prepare(*) = ?");
-
- return roar_pcm_start(io);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Status: This should be mostly complete.
-// I'm not sure if hw_params can be called several times during one stream without stop() start() in between. 
-// This will mean a memory leak, and possibly breakage should the buffer size change itself.
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static int roar_pcm_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params) {
- struct roar_alsa_pcm * self = io->private_data;
- snd_pcm_uframes_t buffersize;
- int err;
-
- ROAR_DBG("roar_pcm_hw_params(*) = ?");
-
- self->info.channels = io->channels;
- self->info.rate     = io->rate;
-
- switch (io->format) {
-  case SND_PCM_FORMAT_S8:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_U8:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_A_LAW:
-   self->info.codec = ROAR_CODEC_ALAW;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_MU_LAW:
-   self->info.codec = ROAR_CODEC_MULAW;
-   self->info.bits  = 8;
-   break;
-  case SND_PCM_FORMAT_S16_LE:
-   self->info.codec = ROAR_CODEC_PCM_S_LE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_S16_BE:
-   self->info.codec = ROAR_CODEC_PCM_S_BE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_U16_LE:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_U16_BE:
-   self->info.codec = ROAR_CODEC_PCM_U_BE;
-   self->info.bits  = 16;
-   break;
-  case SND_PCM_FORMAT_S32_LE:
-   self->info.codec = ROAR_CODEC_PCM_S_LE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_S32_BE:
-   self->info.codec = ROAR_CODEC_PCM_S_BE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_U32_LE:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_U32_BE:
-   self->info.codec = ROAR_CODEC_PCM_U_BE;
-   self->info.bits  = 32;
-   break;
-  case SND_PCM_FORMAT_S24_3LE:
-   self->info.codec = ROAR_CODEC_PCM_S_LE;
-   self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_S24_3BE:
-   self->info.codec = ROAR_CODEC_PCM_S_BE;
-   self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_U24_3LE:
-   self->info.codec = ROAR_CODEC_PCM_U_LE;
-   self->info.bits  = 24;
-   break;
-  case SND_PCM_FORMAT_U24_3BE:
-   self->info.codec = ROAR_CODEC_PCM_U_BE;
-   self->info.bits  = 24;
-   break;
-  default:
-   return -EINVAL;
- }
-
- if ((err = snd_pcm_hw_params_get_buffer_size(params, &buffersize) < 0))
-  return err;
-
- ROAR_DBG("roar_pcm_hw_params(*) buffersize (frames): %i", (int)buffersize);
-
- self->bufsize = self->info.bits * self->info.channels * buffersize / 8;
-
- ROAR_DBG("roar_pcm_hw_params(*) Setting buffersize (bytes): %i", (int)self->bufsize);
- ROAR_DBG("roar_pcm_hw_params(*) = 0");
- return 0;
-}
-
-///////////////////////////////////
-// Status: This should be complete. 
-// This is the last cleanup function to be called by ALSA.
-///////////////////////////////////
-static int roar_pcm_close (snd_pcm_ioplug_t * io) {
- struct roar_alsa_pcm * self = io->private_data;
-
- ROAR_DBG("roar_pcm_close(*) = ?");
-
- roar_plugin_reset(self);
- roar_disconnect(&(self->roar.con));
-
- free(self);
-
- return 0;
-}
-
-static snd_pcm_ioplug_callback_t roar_pcm_callback = {
- .start                  = roar_pcm_start,
- .stop                   = roar_pcm_stop,
- .pointer                = roar_pcm_pointer,
- .transfer               = roar_pcm_transfer,
- .delay                  = roar_pcm_delay,
- .prepare                = roar_pcm_prepare,
- .hw_params              = roar_pcm_hw_params,
- .close                  = roar_pcm_close,
-};
-
-SND_PCM_PLUGIN_DEFINE_FUNC(roar) {
- struct roar_alsa_pcm * self;
- snd_config_iterator_t i, next;
- snd_config_t * n;
- const char   * para;
- const char   * server = NULL;
- const char   * tmp;
- int            role = ROAR_ROLE_UNKNOWN;
- int            ret;
-
- (void)root;
-
- ROAR_DBG("SND_PCM_PLUGIN_DEFINE_FUNC(roar) = ?");
-
- snd_config_for_each(i, next, conf) {
-  n = snd_config_iterator_entry(i);
-  if ( snd_config_get_id(n, &para) < 0 )
-   continue;
-
-  if ( !strcmp(para, "type") || !strcmp(para, "comment") || !strcmp(para, "hint") )
-   continue;
-
-  if ( !strcmp(para, "server") ) {
-   if (snd_config_get_string(n, &server) < 0) {
-    return -EINVAL;
-   }
-  } else if ( !strcmp(para, "role") ) {
-   if (snd_config_get_string(n, &tmp) < 0) {
-    return -EINVAL;
-   }
-   if ( (role = roar_str2role(tmp)) == -1 ) {
-    return -EINVAL;
-   }
-  } else {
-   return -EINVAL;
-  }
- }
-
- errno = ENOSYS;
-
- if ( (self = malloc(sizeof(struct roar_alsa_pcm))) == NULL )
-  return -errno;
-
- memset(self, 0, sizeof(struct roar_alsa_pcm));
-
- self->stream_role = role;
-
- errno = ENOSYS;
- if ( roar_simple_connect(&(self->roar.con), server, "ALSA Plugin") == -1 ) {
-  free(self);
-  return -errno;
- }
-
- self->io.version      = SND_PCM_IOPLUG_VERSION;
- self->io.name         = "RoarAudio Plugin";
- self->io.poll_fd      =  -1;
- self->io.poll_events  =  POLLOUT;
- self->io.mmap_rw      =  0;
- self->io.callback     = &roar_pcm_callback;
- self->io.private_data =  self;
-
- if ( (ret = snd_pcm_ioplug_create(&(self->io), name, stream, mode)) < 0 ) {
-  roar_disconnect(&(self->roar.con));
-  free(self);
-  return ret;
- }
-
- if ( (ret = roar_hw_constraint(self)) < 0 ) {
-  snd_pcm_ioplug_delete(&(self->io));
-  roar_disconnect(&(self->roar.con));
-  free(self);
-  return ret;
- }
-
- *pcmp = self->io.pcm;
-
- ROAR_DBG("SND_PCM_PLUGIN_DEFINE_FUNC(roar) = 0");
-
- return 0;
-}
-
-SND_PCM_PLUGIN_SYMBOL(roar);
-
-//ll
Index: plugins/alsavs/roar.c
===================================================================
--- plugins/alsavs/roar.c	(revision 6052)
+++ 	(revision )
@@ -1,35 +1,0 @@
-//roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- */
-
-#include "roar.h"
-
-struct snd_dlsym_link *snd_dlsym_start;
-
-//ll
Index: plugins/alsavs/roar.h
===================================================================
--- plugins/alsavs/roar.h	(revision 6052)
+++ 	(revision )
@@ -1,87 +1,0 @@
-//roar.h:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010-2011
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-#ifndef _ROARAUDIO_PLUGINS_ALSA_ROAR_H_
-#define _ROARAUDIO_PLUGINS_ALSA_ROAR_H_
-
-#include <roaraudio.h>
-#include <errno.h>
-#include <alsa/asoundlib.h>
-#include <alsa/global.h>
-#include <alsa/pcm_external.h>
-#include <alsa/control_external.h>
-#include <pthread.h>
-#include <time.h>
-
-#define _as(x) (sizeof((x))/sizeof(*(x)))
-
-struct roar_alsa {
- struct roar_connection con;
-};
-
-struct roar_alsa_pcm {
- snd_pcm_ioplug_t       io;
- struct roar_alsa       roar;
- struct roar_audio_info info;
- roar_vs_t            * vss;
- int                    stream_role;
- int                    stream_opened;
- size_t                 bufsize;
- size_t                 last_ptr;
-};
-
-struct roar_mixerstream {
- int id;
- char name[32];
- unsigned int channels;
-};
-
-#define MAX_STREAMS      16
-
-struct roar_alsa_ctl {
- snd_ctl_ext_t          ext;
- struct roar_alsa       roar;
- struct roar_mixerstream streams[MAX_STREAMS];
-};
-
-void roar_plugin_reset(struct roar_alsa_pcm * self);
-void* roar_plugin_thread (void * thread_data);
-size_t roar_plugin_write(struct roar_alsa_pcm * self, const char * buf, size_t size);
-void roar_plugin_drain(struct roar_alsa_pcm * self);
-
-#endif
-
-//ll
Index: plugins/alsavs/thread.c
===================================================================
--- plugins/alsavs/thread.c	(revision 6052)
+++ 	(revision )
@@ -1,249 +1,0 @@
-//thread.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *      Copyright (C) Hans-Kristian 'maister' Arntzen - 2010
- *
- *  This file is part of libroar 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.
- *
- *  libroar 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.
- *
- *  NOTE for everyone want's to change something and send patches:
- *  read README and HACKING! There a addition information on
- *  the license of this document you need to read before you send
- *  any patches.
- *
- *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
- *  or libpulse*:
- *  The libs libroaresd, libroararts and libroarpulse link this lib
- *  and are therefore GPL. Because of this it may be illigal to use
- *  them with any software that uses libesd, libartsc or libpulse*.
- */
-
-//#define DEBUG
-
-#include "roar.h"
-#define CHUNK_SIZE 2048
-//#define CHUNK_SIZE 256
-
-
-
-/*
- * The following function should be re-written:
- * write in a loop untill all date is written,
- * if vs write returns less than requested call the thread and ask it to iterate.
- */
-
-// Writes to the FIFO buffer. Waits until there is room to write.
-size_t roar_plugin_write(struct roar_alsa_pcm *self, const char *buf, size_t size) {
- ssize_t ret;
-
- ROAR_DBG("roar_plugin_write(self=%p, buf=%p, size=%llu) = ?", self, buf, (long long unsigned int)size);
-
-#if 0
- /* Wait until we have a ready buffer */
- while (1) {
-  /* Should the thread be shut down while we're running, return with error */
-  if ( !self->thread_active )
-   return 0;
-
-  //fprintf(stderr, "%d + %d : %d\n", (int)self->bufptr, (int)size, (int)self->bufsize);
-  pthread_mutex_lock(&(self->lock));
-  if (roar_vs_get_avail_write(self->vss, NULL) >= (ssize_t)size) {
-   pthread_mutex_unlock(&(self->lock));
-   break;
-  }
-  pthread_mutex_unlock(&(self->lock));
-
-  ROAR_DBG("roar_plugin_write(self=%p, buf=%p, size=%llu): Send signal", self, buf, (long long unsigned int)size);
-  pthread_cond_signal(&(self->cond));
-  /* Sleeps until we can write to the FIFO. */
-  ROAR_DBG("roar_plugin_write(self=%p, buf=%p, size=%llu): Waiting for answer", self, buf, (long long unsigned int)size);
-  pthread_mutex_lock(&(self->cond_lock));
-  pthread_cond_wait(&(self->cond), &(self->cond_lock));
-  pthread_mutex_unlock(&(self->cond_lock));
- }
-#endif
-
-
- while (size) {
-  pthread_mutex_lock(&(self->lock));
-  ret = roar_vs_write(self->vss, buf, size, NULL);
-  pthread_mutex_unlock(&(self->lock));
-
-  if ( ret == -1 ) {
-   ROAR_WARN("roar_plugin_write(self=%p, buf=?, size=?): Can not write data: %s", self, roar_error2str(roar_error));
-   return -1;
-  }
-
-  size -= ret;
-  buf  += ret;
-
-  /* Send signal to thread that buffer has been updated */
-  ROAR_DBG("roar_plugin_write(self=%p, buf=%p, size=%llu): Send signal", self, buf, (long long unsigned int)size);
-  pthread_cond_signal(&(self->cond));
- }
-
- return size;
-}
-
-#define _TEST_CANCEL() do { \
- if ( !self->thread_active ) \
-  goto test_quit; \
-} while(0)
-
-// Attemps to drain the buffer at all times and write to libroar.
-// If there is no data, it will wait for roar_plugin_write() to fill up more data.
-void * roar_plugin_thread (void * thread_data) {
- /* We share data between thread and callable functions */
- struct roar_alsa_pcm *self = thread_data;
- int rc;
- int err;
-
- ROAR_DBG("roar_plugin_thread(thread_data=%p) = ?", thread_data);
- pthread_mutex_unlock(&(self->lock)); // we are now up.
-
- /* Plays back data as long as there is data in the buffer. Else, sleep until it can. */
- /* Two loops! :3 Beware! */
- while(1) {
-  ROAR_DBG("roar_plugin_thread(thread_data=%p): got woken up.", thread_data);
-  while(1) {
-   _TEST_CANCEL();
-   // We ask the server to send its latest backend data. Do not really care about errors atm.
-   // We only bother to check after 1 sec of audio has been played, as it might be quite inaccurate in the start of the stream.
-
-   // do wee need to lock before this?
-   pthread_mutex_lock(&(self->lock));
-   ROAR_DBG("roar_plugin_thread(thread_data=%p): Start iterate", thread_data);
-   rc = roar_vs_iterate(self->vss, ROAR_VS_WAIT, &err);
-   ROAR_DBG("roar_plugin_thread(thread_data=%p): Ended iterate", thread_data);
-   pthread_mutex_unlock(&(self->lock));
-
-   if ( rc == 0 ) {
-    break;
-   } else if ( rc < 0 ) {
-    _TEST_CANCEL();
-    roar_plugin_reset(self);
-
-    /* Wakes up a potentially sleeping fill_buffer() */
-    pthread_cond_signal(&(self->cond));
-
-    /* This thread will not be joined, so detach. */
-    pthread_detach(pthread_self());
-    pthread_exit(NULL);
-   }
-
-   pthread_cond_signal(&(self->cond));
-
-#if 0
-   /* If the buffer is empty or we've stopped the stream. Jump out of this for loop */
-   pthread_mutex_lock(&(self->lock));
-   if ( self->bufptr < CHUNK_SIZE ) {
-    pthread_mutex_unlock(&(self->lock));
-    break;
-   }
-   pthread_mutex_unlock(&(self->lock));
-
-   rc = roar_vio_write(&(self->stream_vio), self->buffer, CHUNK_SIZE);
-
-   /* If this happens, we should make sure that subsequent and current calls to rsd_write() will fail. */
-   if ( rc < 0 ) {
-    _TEST_CANCEL();
-    roar_plugin_reset(self);
-
-    /* Wakes up a potentially sleeping fill_buffer() */
-    pthread_cond_signal(&(self->cond));
-
-    /* This thread will not be joined, so detach. */
-    pthread_detach(pthread_self());
-    pthread_exit(NULL);
-   }
-
-   if ( !self->has_written ) {
-    pthread_mutex_lock(&(self->lock));
-    clock_gettime(CLOCK_MONOTONIC, &(self->start_tv));
-    self->has_written = 1;
-    pthread_mutex_unlock(&(self->lock));
-   }
-
-   pthread_mutex_lock(&(self->lock));
-   self->total_written += rc;
-   pthread_mutex_unlock(&(self->lock));
-
-   /* "Drains" the buffer. This operation looks kinda expensive with large buffers, but hey. D: */
-   pthread_mutex_lock(&(self->lock));
-   memmove(self->buffer, self->buffer + rc, self->bufsize - rc);
-   self->bufptr -= rc;
-   pthread_mutex_unlock(&(self->lock));
-   ROAR_DBG("roar_plugin_thread(*): Wrote data to vio. New bufptr: %i", (int)self->bufptr);
-
-   /* Buffer has decreased, signal fill_buffer() */
-   pthread_cond_signal(&(self->cond));
-#endif
-
-  }
-  ROAR_DBG("roar_plugin_thread(thread_data=%p): going to sleep again.", thread_data);
-
-  /* If we're still good to go, sleep. We are waiting for fill_buffer() to fill up some data. */
-test_quit:
-  if ( self->thread_active ) {
-   //struct timespec abstime = {0, 1000*1000*100};
-   pthread_cond_signal(&(self->cond));
-   ROAR_DBG("roar_plugin_thread(thread_data=%p): Wating for wakeup", thread_data);
-   pthread_mutex_lock(&(self->cond_lock));
-   pthread_cond_wait(&(self->cond), &(self->cond_lock));
-   pthread_mutex_unlock(&(self->cond_lock));
-  } else {
-   /* Abandon the ship, chap. */
-   pthread_cond_signal(&(self->cond));
-   pthread_exit(NULL);
-  }
-
- }
-}
-
-void roar_plugin_drain(struct roar_alsa_pcm *self) {
-#if 0
- struct timespec now_tv;
- int64_t temp, temp2;
-
- /* If the audio playback has started on the server we need to use timers. */
- if ( self->has_written ) {
-
-  /* Falls back to gettimeofday() when CLOCK_MONOTONIC is not supported */
-
-  /* Calculates the amount of bytes that the server has consumed. */
-  clock_gettime(CLOCK_MONOTONIC, &now_tv);
-
-  temp   = (int64_t)now_tv.tv_sec - (int64_t)self->start_tv.tv_sec;
-
-  temp  *= self->info.rate * self->info.channels * self->info.bits / 8;
-
-  temp2  = (int64_t)now_tv.tv_nsec - (int64_t)self->start_tv.tv_nsec;
-  temp2 *= self->info.rate * self->info.channels * self->info.bits / 8;
-  temp2 /= 1000000000LL;
-  temp  += temp2;
-  /* Calculates the amount of data we have in our virtual buffer. Only used to calculate delay. */
-  self->bytes_in_buffer = (int)((int64_t)self->total_written + (int64_t)self->bufptr - temp);
- } else {
-  self->bytes_in_buffer = self->bufptr;
- }
-#endif
- ROAR_DBG("roar_plugin_drain(self=%p) = (void)", self);
-}
-
-//ll
Index: plugins/ao/.cvsignore
===================================================================
--- plugins/ao/.cvsignore	(revision 2802)
+++ 	(revision )
@@ -1,2 +1,0 @@
-Makefile.conf
-*.dll
Index: plugins/ao/Makefile
===================================================================
--- plugins/ao/Makefile	(revision 5851)
+++ plugins/ao/Makefile	(revision 0)
@@ -1,28 +1,14 @@
 TARGET=libroar.so
-OBJ=ao_roar.o
-
-include ../../Makefile.conf
-include ../../Makefile.inc
-include Makefile.conf
-
-#DEFINES=-DDEBUG
-CFLAGS += $(DEBUG_g) $(Wall) $(OPTI_O) -I../../include $(DEFINES) $(HAVE_MATRIX) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC) $(AO_CFLAGS)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(SHARED) $(LDPATH) -L../../lib
-LIBS    = $(LIBROAR) $(AO_LIBS)
 
 all: ${TARGET}
 clean:
-	rm -f ${TARGET} *.o tests tests.c
+	rm -f ${TARGET} tests tests.c
 new: clean all
 
 install: libroar.so
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	cp libroar.so ${DESTDIR}${INSTALL_DIR}
-semi-install: libroar.so
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	ln -fs `pwd`/libroar.so ${DESTDIR}${INSTALL_DIR}
+	cp libroar.so ${INSTALL_DIR}
 
-libroar.so: $(OBJ)
-	$(CC) $(LDFLAGS) -Wl,-soname,libroar.so -o libroar.so $(OBJ) $(LIBS)
+libroar.so: ao_roar.c
+	cc -shared -lroar -o libroar.so ao_roar.c
 
 ao_roar.c:
Index: plugins/ao/README
===================================================================
--- plugins/ao/README	(revision 3232)
+++ plugins/ao/README	(revision 0)
@@ -2,5 +2,5 @@
          -------------------------------------------
 
-Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2010
+Copyright (C) Philipp 'ph3-der-loewe' Schafft - May 2008
 based on ao_esd.c of libao by Stan Seibert - July 2000, July 2001
 
Index: plugins/ao/ao_roar.c
===================================================================
--- plugins/ao/ao_roar.c	(revision 6052)
+++ plugins/ao/ao_roar.c	(revision 0)
@@ -3,5 +3,5 @@
  *  ao_roar.c
  *
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - May 2008
  *      based on ao_esd.c of libao by Stan Seibert - July 2000, July 2001
  *
@@ -11,5 +11,5 @@
  *  This file is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your opinion)
+ *  the Free Software Foundation; either version 2, or (at your option)
  *  any later version.
  *
@@ -21,6 +21,5 @@
  *  You should have received a copy of the GNU General Public License
  *  along with GNU Make; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
@@ -59,5 +58,5 @@
  "Outputs to the RoarAudio Sound Daemon.",
  AO_FMT_NATIVE,
- 50,
+ 41,
  ao_roar_options,
  1
@@ -66,5 +65,5 @@
 
 typedef struct ao_roar_internal {
- struct roar_vio_calls svio;
+ int    sock;
  char * host;
 } ao_roar_internal;
@@ -120,32 +119,12 @@
 int ao_plugin_open(ao_device * device, ao_sample_format * format) {
  ao_roar_internal * internal = (ao_roar_internal *) device->internal;
-#ifdef HAVE_MATRIX
- char * map = NULL;
-#endif
 
- if ( roar_vio_simple_stream(&(internal->svio), format->rate, format->channels, format->bits,
-                             ROAR_CODEC_DEFAULT, internal->host, ROAR_DIR_PLAY, "libao client") == -1 )
+ internal->sock = roar_simple_play(format->rate, format->channels, format->bits,
+                                   ROAR_CODEC_DEFAULT, internal->host, "libao client");
+
+ if ( internal->sock == -1 )
   return 0;
 
  device->driver_byte_format = AO_FMT_NATIVE;
-
-#ifdef HAVE_MATRIX
- if( device->output_matrix != NULL )
-  free(device->output_matrix);
-
- device->output_matrix = NULL;
-
- switch (format->channels) {
-  case  1: map = "M";               break;
-  case  2: map = "L,R";             break;
-  case  3: map = "L,R,C";           break;
-  case  4: map = "L,R,BL,BR";       break;
-  case  5: map = "L,R,C,BL,BR";     break;
-  case  6: map = "L,R,C,LFE,BL,BR"; break;
- }
-
- if ( map != NULL )
-  device->output_matrix = strdup(map);
-#endif
 
  return 1;
@@ -155,5 +134,5 @@
  ao_roar_internal * internal = (ao_roar_internal *) device->internal;
 
- if (roar_vio_write(&(internal->svio), (char*)output_samples, num_bytes) == -1) {
+ if (write(internal->sock, output_samples, num_bytes) == -1) {
   return 0;
  } else {
@@ -166,5 +145,5 @@
  ao_roar_internal * internal = (ao_roar_internal *) device->internal;
 
- roar_vio_close(&(internal->svio));
+ roar_simple_close(internal->sock);
 
  return 1;
Index: plugins/ao/configure
===================================================================
--- plugins/ao/configure	(revision 4011)
+++ plugins/ao/configure	(revision 0)
@@ -1,23 +1,12 @@
 #!/bin/sh
 
-. ../configure.inc
-
 INSTALL_DIR=/usr/lib/ao/plugins-2/
-
-HAVE_ROAR=false
 
 while [ "$1" != '' ]
 do
  case "$1" in
-  --install-dir|--inst-dir)
+  --inst-dir)
    INSTALL_DIR="$2"
    shift;
-  ;;
-  --pkg-config)
-   PKG_CONFIG="$2"
-   shift;
-  ;;
-  --force-have-roar)
-   HAVE_ROAR=true
   ;;
   --help|-h)
@@ -26,10 +15,7 @@
 
 Options:
-  --help               - Show this help
-  --inst-dir DIR       - Install dir
-  --force-have-roar    - Force to assume libroar is ok
-  --pkg-config PKGCONF - Set filename for pkg-config
+  --help         - Show this help
+  --inst-dir DIR - Install dir
 EOF
-    exit 0
    ;;
   *)
@@ -40,11 +26,13 @@
 done
 
-on_error () {
- rm -f Makefile.conf
+echo -n 'testing for C compiler... '
+CC=$(which gcc cc 2> /dev/null | head -n 1)
+if [ -x "$CC" ]
+then
+ echo $CC
+else
+ echo no.
  exit 1;
-}
-
-check_cc;
-check_pkg_config;
+fi
 
 echo -n 'testing for libao... '
@@ -55,19 +43,5 @@
 EOF
 
-if [ "$PKG_CONFIG" = '' ]
-then
- AO_LIBS=''
- AO_CFLAGS=''
-else
- AO_LIBS=`pkg-config --libs ao`
- AO_CFLAGS=`pkg-config --cflags ao`
-fi
-if [ "$AO_LIBS" = '' -a "$AO_CFLAGS" = '' ]
-then
- AO_LIBS='-lao'
- AO_CFLAGS=''
-fi
-
-$CC $AO_LIBS $AO_CFLAGS -o tests tests.c 2> /dev/null
+$CC -lao -o tests tests.c 2> /dev/null
 ./tests 2> /dev/null
 
@@ -77,44 +51,30 @@
 else
  echo no.
- on_error
+ exit 1
 fi
+rm -f tests tests.c
 
-echo -n 'testing for libao to support mapping matrix... '
+echo -n 'testing for libroar... '
 cat > tests.c << EOF
-#include <ao/ao.h>
-#include <ao/plugin.h>
-int main (void) { ao_device dev = {.output_matrix = ""}; return 0; }
+#include <roaraudio.h>
+int main (void) { return 0; }
 EOF
 
-$CC $AO_LIBS $AO_CFLAGS -o tests tests.c 2> /dev/null
-R="$?"
+$CC -lroar -o tests tests.c 2> /dev/null
 ./tests 2> /dev/null
 
-HAVE_MATRIX=false
-
-if [ "$R" = '0' -a "$?" = '0' ]
+if [ "$?" = '0' ]
 then
  echo yes
- HAVE_MATRIX=true
 else
  echo no.
+ exit 1
 fi
-
-check_libroar;
-
 rm -f tests tests.c
 
-echo creating Makefile.conf...
-{
- echo "CC=$CC"
- echo "INSTALL_DIR=$INSTALL_DIR"
- echo
- echo "AO_CFLAGS=$AO_CFLAGS"
- echo "AO_LIBS=$AO_LIBS"
- echo
- $HAVE_MATRIX && echo "HAVE_MATRIX=-DHAVE_MATRIX"
-} > Makefile.conf
-
-true; # needed so return value is correct
+echo creating Makefile...
+echo "CC=$CC" > Makefile
+echo "INSTALL_DIR=$INSTALL_DIR" >> Makefile
+cat Makefile.pre >> Makefile
 
 #ll
Index: plugins/audacious/.cvsignore
===================================================================
--- plugins/audacious/.cvsignore	(revision 2802)
+++ 	(revision )
@@ -1,2 +1,0 @@
-Makefile.conf
-*.dll
Index: plugins/audacious/Makefile
===================================================================
--- plugins/audacious/Makefile	(revision 5851)
+++ 	(revision )
@@ -1,27 +1,0 @@
-TARGET=libroar.so
-
-OBJ=roar.o gui.o
-
-include ../../Makefile.conf
-include ../../Makefile.inc
-include Makefile.conf
-
-#DEFINES=-DDEBUG
-CFLAGS += $(DEBUG_g) $(Wall) $(OPTI_O) -I../../include $(DEFINES) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC) $(GTK_CFLAFS) $(XMMS_CFLAGS)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(SHARED) $(LDPATH) -L../../lib
-LIBS    = $(LIBROAR) $(GTK_LIBS) $(XMMS_LIBS)
-
-all: ${TARGET}
-clean:
-	rm -f ${TARGET} *.o *~
-new: clean all
-
-install: libroar.so
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	cp libroar.so ${DESTDIR}${INSTALL_DIR}/
-semi-install: libroar.so
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	ln -fs `pwd`/libroar.so ${DESTDIR}${INSTALL_DIR}/
-
-libroar.so: $(OBJ)
-	$(CC) $(LDFLAGS) -Wl,-soname,libroar.so -o libroar.so $(OBJ) $(LIBS)
Index: plugins/audacious/all.h
===================================================================
--- plugins/audacious/all.h	(revision 6052)
+++ 	(revision )
@@ -1,97 +1,0 @@
-//all.h:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft    - 2008-2015,
- *                    Daniel Duntemann <dauxx@dauxx.org> - 2009
- *
- *  This file is part of the XMMS RoarAudio output plugin 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.
- *
- */
-
-#ifndef _ALL_H_
-#define _ALL_H_
-
-#include <roaraudio.h>
-
-//#include "xmms/i18n.h"
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <audacious/configdb.h>
-#include <audacious/util.h>
-#include <audacious/plugin.h>
-#include <audacious/audctrl.h>
-/* #include <audacious/dirbrowser.h> */
-
-
-
-#define _(x) (x)
-
-gint ctrlsocket_get_session_id(void);
-
-void roar_init(void);
-void roar_about(void);
-void roar_configure(void);
-
-void roar_get_volume(int *l, int *r);
-void roar_set_volume(int l, int r);
-void roar_mixer_init(void);
-void roar_mixer_init_vol(int l, int r);
-
-int roar_playing(void);
-int roar_free(void);
-void roar_write(void *ptr, int length);
-void roar_close(void);
-void roar_flush(int time);
-void roar_pause(short p);
-int roar_open(AFormat fmt, int rate, int nch);
-int roar_get_output_time(void);
-int roar_get_written_time(void);
-
-int roar_update_metadata(void);
-int roar_chk_metadata(void);
-
-#define STATE_CONNECTED   1
-#define STATE_PLAYING     2
-#define STATE_NORECONNECT 4
-
-struct xmms_roar_out {
- int                 state;
- char              * server;
- struct roar_connection con;
- struct roar_stream     stream;
- int                 data_fh;
- long unsigned int   written;
- long unsigned int   bps;
- int                 session;
- int                 pause;
- struct {
-  int                server_type;
-  int                port;
-  int              * proxy_type;
-  char             * proxy;
-  char             * player_name;
- } cfg;
-} g_inst;
-
-#endif
-
-//ll
Index: plugins/audacious/configure
===================================================================
--- plugins/audacious/configure	(revision 1742)
+++ 	(revision )
@@ -1,120 +1,0 @@
-#!/bin/sh
-
-. ../configure.inc
-
-HAVE_ROAR=false
-
-while [ "$1" != '' ]
-do
- case "$1" in
-  --inst-dir)
-   INSTALL_DIR="$2"
-   shift;
-  ;;
-  --pkg-config)
-   PKG_CONFIG="$2"
-   shift;
-  ;;
-  --force-have-roar)
-   HAVE_ROAR=true
-  ;;
-  --help|-h)
-    cat << EOF
-Usage: ./configure [OPTIONS]...
-
-Options:
-  --help               - Show this help
-  --inst-dir DIR       - Install dir
-  --force-have-roar    - Force to assume libroar is ok
-  --pkg-config PKGCONF - Set filename for pkg-config
-EOF
-    exit 0
-   ;;
-  *)
-    echo 'Unknown option. Try ./configure --help'
-    exit 2
- esac
- shift;
-done
-
-on_error () {
- exit 1;
-}
-
-check_cc;
-check_pkg_config;
-
-echo -n 'testing for gtk... '
-
-if [ "$PKG_CONFIG" != '' ]
-then
- GTK_LIBS=`$PKG_CONFIG  gtk+-2.0 --libs 2> /dev/null`
- GTK_CFLAFS=`$PKG_CONFIG --cflags gtk+-2.0 2> /dev/null`
-else
- GTK_LIBS=`gtk-config gtk+-2.0 --libs 2> /dev/null`
- GTK_CFLAFS=`gtk-config gtk+-2.0 --cflags 2> /dev/null`
-fi
-
-if [ "$GTK_LIBS" = '' -a "$GTK_CFLAFS" = '' ]
-then
- echo no.
- on_error;
-else
- echo yes
-fi
-
-echo -n 'testing for audacious version... '
-if $PKG_CONFIG --atleast-version=1.5.1 audacious 2> /dev/null
-then
- echo '>= 1.5.1'
-else
- echo 'too old'
- on_error;
-fi
-
-echo -n 'testing for audacious... '
-XMMS_LIBS=`$PKG_CONFIG audacious  --libs 2> /dev/null`
-XMMS_CFLAGS=`$PKG_CONFIG audacious  --cflags 2> /dev/null`
-
-if [ "$XMMS_LIBS" = '' -a "$XMMS_CFLAGS" = '' ]
-then
- echo no.
- on_error;
-else
- echo yes
-fi
-
-echo -n 'testing for audacious plugin dir... '
-if [ "$INSTALL_DIR" = '' ]
-then
- INSTALL_DIR="`$PKG_CONFIG --variable=output_plugin_dir audacious 2> /dev/null`"
-
- if [ "$INSTALL_DIR" = '' ]
- then
-  echo not found.
-  on_error;
- else
-  echo "$INSTALL_DIR"
- fi
-else
-  echo "$INSTALL_DIR"
-fi
-
-check_libroar;
-
-rm -f tests tests.c
-
-echo creating Makefile.conf...
-{
- echo "CC=$CC"
- echo
- echo "GTK_LIBS=$GTK_LIBS"
- echo "GTK_CFLAFS=$GTK_CFLAFS"
- echo
- echo "XMMS_LIBS=$XMMS_LIBS"
- echo "XMMS_CFLAGS=$XMMS_CFLAGS"
- echo
- echo "INSTALL_DIR=$INSTALL_DIR"
-} > Makefile.conf
-
-#ll
Index: plugins/audacious/gui.c
===================================================================
--- plugins/audacious/gui.c	(revision 6052)
+++ 	(revision )
@@ -1,345 +1,0 @@
-//gui.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft    - 2008-2015,
- *                    Daniel Duntemann <dauxx@dauxx.org> - 2009
- *
- *  This file is part of the XMMS RoarAudio output plugin 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 "all.h"
-
-// ABOUT:
-
-void roar_about(void) {
- static GtkWidget *dialog;
-
- if (dialog != NULL)
-  return;
-
- dialog = audacious_info_dialog(
-                _("About RoarAudio Plugin"),
-                _("RoarAudio Audacious Plugin..."
-                 ), _("OK"), FALSE, NULL, NULL);
- gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
-                    GTK_SIGNAL_FUNC(gtk_widget_destroyed),
-                    &dialog);
-}
-
-// CONFIG:
-
-void on_button_ok_enter(GtkButton * button, gpointer user_data) {
-}
-
-void roar_configure(void) {
-  GtkWidget *config_win;
-  GtkWidget *vbox_main;
-  GtkWidget *tabs_main;
-  GtkWidget *frame_server;
-  GtkWidget *alignment_server;
-  GtkWidget *table1;
-  GtkWidget *label_server_type;
-  GtkWidget *label_server_host;
-  GtkWidget *label_server_port;
-  GtkObject *input_server_port_adj;
-  GtkWidget *input_server_port;
-  GtkWidget *input_server_host;
-/*
-  GtkWidget *input_server_type;
-*/
-  GtkWidget *label_host;
-  GtkWidget *label_server;
-  GtkWidget *frame_proxy;
-  GtkWidget *alignment_proxy;
-  GtkWidget *table2;
-  GtkWidget *label_proxy_type;
-  GtkWidget *label_proxy_addr;
-  GtkWidget *input_proxy_host;
-/*
-  GtkWidget *input_proxy_type;
-*/
-  GtkWidget *label_frame_proxy;
-  GtkWidget *label_proxy;
-  GtkWidget *vbox_meta;
-  GtkWidget *frame_meta_player;
-  GtkWidget *alignment1;
-  GtkWidget *hbox_meta_player;
-  GtkWidget *label_player_name;
-  GtkWidget *input_meta_player_name;
-  GtkWidget *label_player;
-  GtkWidget *frame_meta_title;
-  GtkWidget *alignment2;
-  GtkWidget *hbox_meta_title;
-/*
-  GtkWidget *input_meta_send_title;
-  GtkWidget *input_meta_send_filename;
-*/
-  GtkWidget *label_meta_title;
-  GtkWidget *label_meta;
-  GtkWidget *hbox_buttons;
-  GtkWidget *button_ok;
-  GtkWidget *button_cancel;
-
-  config_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title(GTK_WINDOW(config_win), _("RoarAudio Plugin - Configuration"));
-//  gtk_window_set_destroy_with_parent(GTK_WINDOW(config_win), TRUE);
-//  gtk_window_set_icon_name(GTK_WINDOW(config_win), "gtk-preferences");
-
-  gtk_widget_show (config_win);
-
-  vbox_main = gtk_vbox_new (FALSE, 0);
-  gtk_widget_show (vbox_main);
-  gtk_container_add (GTK_CONTAINER (config_win), vbox_main);
-
-  tabs_main = gtk_notebook_new ();
-  gtk_widget_show (tabs_main);
-  gtk_box_pack_start (GTK_BOX (vbox_main), tabs_main, TRUE, TRUE, 0);
-
-  frame_server = gtk_frame_new (NULL);
-  gtk_widget_show (frame_server);
-  gtk_container_add (GTK_CONTAINER (tabs_main), frame_server);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_server), GTK_SHADOW_NONE);
-
-  alignment_server = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment_server);
-  gtk_container_add (GTK_CONTAINER (frame_server), alignment_server);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment_server), 0, 0, 12, 0);
-
-  table1 = gtk_table_new (3, 2, FALSE);
-  gtk_widget_show (table1);
-  gtk_container_add (GTK_CONTAINER (alignment_server), table1);
-
-  label_server_type = gtk_label_new (_("Server Type:"));
-  gtk_widget_show (label_server_type);
-  gtk_table_attach (GTK_TABLE (table1), label_server_type, 0, 1, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_server_type), 0, 0.5);
-
-  label_server_host = gtk_label_new (_("Host or Path:"));
-  gtk_widget_show (label_server_host);
-  gtk_table_attach (GTK_TABLE (table1), label_server_host, 0, 1, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_server_host), 0, 0.5);
-
-  label_server_port = gtk_label_new (_("Port:"));
-  gtk_widget_show (label_server_port);
-  gtk_table_attach (GTK_TABLE (table1), label_server_port, 0, 1, 2, 3,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_server_port), 0, 0.5);
-
-  input_server_port_adj = gtk_adjustment_new (16002, 0, 65535, 1, 10, 10);
-  input_server_port = gtk_spin_button_new (GTK_ADJUSTMENT (input_server_port_adj), 1, 0);
-  gtk_widget_show (input_server_port);
-  gtk_table_attach (GTK_TABLE (table1), input_server_port, 1, 2, 2, 3,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-  input_server_host = gtk_entry_new ();
-  gtk_widget_show (input_server_host);
-  gtk_table_attach (GTK_TABLE (table1), input_server_host, 1, 2, 1, 2,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-/*
-  input_server_type = gtk_combo_box_entry_new_text ();
-  gtk_widget_show (input_server_type);
-  gtk_table_attach (GTK_TABLE (table1), input_server_type, 1, 2, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("Local"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("TCP/IP"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("DECnet"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("Fork"));
-*/
-  label_host = gtk_label_new (_("<b>Host:</b>"));
-  gtk_widget_show (label_host);
-//  gtk_frame_set_label_widget (GTK_FRAME (frame_server), label_host);
-//  gtk_label_set_use_markup (GTK_LABEL (label_host), TRUE);
-
-  label_server = gtk_label_new (_("Server & Network"));
-  gtk_widget_show (label_server);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs_main), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs_main), 0), label_server);
-
-  frame_proxy = gtk_frame_new (NULL);
-  gtk_widget_show (frame_proxy);
-  gtk_container_add (GTK_CONTAINER (tabs_main), frame_proxy);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_proxy), GTK_SHADOW_NONE);
-
-  alignment_proxy = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment_proxy);
-  gtk_container_add (GTK_CONTAINER (frame_proxy), alignment_proxy);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment_proxy), 0, 0, 12, 0);
-
-  table2 = gtk_table_new (2, 2, FALSE);
-  gtk_widget_show (table2);
-  gtk_container_add (GTK_CONTAINER (alignment_proxy), table2);
-
-  label_proxy_type = gtk_label_new (_("Type:"));
-  gtk_widget_show (label_proxy_type);
-  gtk_table_attach (GTK_TABLE (table2), label_proxy_type, 0, 1, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_proxy_type), 0, 0.5);
-
-  label_proxy_addr = gtk_label_new (_("Proxy Address"));
-  gtk_widget_show (label_proxy_addr);
-  gtk_table_attach (GTK_TABLE (table2), label_proxy_addr, 0, 1, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_proxy_addr), 0, 0.5);
-
-  input_proxy_host = gtk_entry_new ();
-  gtk_widget_show (input_proxy_host);
-  gtk_table_attach (GTK_TABLE (table2), input_proxy_host, 1, 2, 1, 2,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-/*
-  input_proxy_type = gtk_combo_box_entry_new_text ();
-  gtk_widget_show (input_proxy_type);
-  gtk_table_attach (GTK_TABLE (table2), input_proxy_type, 1, 2, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("None"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SOCKS4"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SOCKS4a"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SOCKS4d"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("HTTP Connect"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SSH"));
-*/
-
-  label_frame_proxy = gtk_label_new (_("<b>Proxy</b>"));
-  gtk_widget_show (label_frame_proxy);
-/*
-  gtk_frame_set_label_widget (GTK_FRAME (frame_proxy), label_frame_proxy);
-  gtk_label_set_use_markup (GTK_LABEL (label_frame_proxy), TRUE);
-*/
-
-  label_proxy = gtk_label_new (_("Proxy"));
-  gtk_widget_show (label_proxy);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs_main), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs_main), 1), label_proxy);
-
-  vbox_meta = gtk_vbox_new (FALSE, 0);
-  gtk_widget_show (vbox_meta);
-  gtk_container_add (GTK_CONTAINER (tabs_main), vbox_meta);
-
-  frame_meta_player = gtk_frame_new (NULL);
-  gtk_widget_show (frame_meta_player);
-  gtk_box_pack_start (GTK_BOX (vbox_meta), frame_meta_player, TRUE, TRUE, 0);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_meta_player), GTK_SHADOW_NONE);
-
-  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment1);
-  gtk_container_add (GTK_CONTAINER (frame_meta_player), alignment1);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
-
-  hbox_meta_player = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox_meta_player);
-  gtk_container_add (GTK_CONTAINER (alignment1), hbox_meta_player);
-
-  label_player_name = gtk_label_new (_("Player Name:"));
-  gtk_widget_show (label_player_name);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_player), label_player_name, FALSE, FALSE, 0);
-
-  input_meta_player_name = gtk_entry_new ();
-  gtk_widget_show (input_meta_player_name);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_player), input_meta_player_name, TRUE, TRUE, 0);
-  gtk_entry_set_text (GTK_ENTRY (input_meta_player_name), _("Audacious"));
-
-  label_player = gtk_label_new (_("<b>Player</b>"));
-  gtk_widget_show (label_player);
-/*
-  gtk_frame_set_label_widget (GTK_FRAME (frame_meta_player), label_player);
-  gtk_label_set_use_markup (GTK_LABEL (label_player), TRUE);
-*/
-
-  frame_meta_title = gtk_frame_new (NULL);
-  gtk_widget_show (frame_meta_title);
-  gtk_box_pack_start (GTK_BOX (vbox_meta), frame_meta_title, TRUE, TRUE, 0);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_meta_title), GTK_SHADOW_NONE);
-
-  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment2);
-  gtk_container_add (GTK_CONTAINER (frame_meta_title), alignment2);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0);
-
-  hbox_meta_title = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox_meta_title);
-  gtk_container_add (GTK_CONTAINER (alignment2), hbox_meta_title);
-
-/*
-  input_meta_send_title = gtk_check_button_new_with_mnemonic (_("Send song title to server"));
-  gtk_widget_show (input_meta_send_title);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_title), input_meta_send_title, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (input_meta_send_title), TRUE);
-
-  input_meta_send_filename = gtk_check_button_new_with_mnemonic (_("Send song filename to server"));
-  gtk_widget_show (input_meta_send_filename);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_title), input_meta_send_filename, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (input_meta_send_filename), TRUE);
-*/
-
-  label_meta_title = gtk_label_new (_("<b>Current Song</b>"));
-  gtk_widget_show (label_meta_title);
-/*
-  gtk_frame_set_label_widget (GTK_FRAME (frame_meta_title), label_meta_title);
-  gtk_label_set_use_markup (GTK_LABEL (label_meta_title), TRUE);
-*/
-
-  label_meta = gtk_label_new (_("Meta Data"));
-  gtk_widget_show (label_meta);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs_main), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs_main), 2), label_meta);
-
-  hbox_buttons = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox_buttons);
-  gtk_box_pack_start (GTK_BOX (vbox_main), hbox_buttons, TRUE, TRUE, 0);
-
-
-  button_ok = gtk_button_new_with_label(_("OK"));
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_ok, FALSE, FALSE, 0);
-
-  button_cancel = gtk_button_new_with_label(_("Cancel"));
-  gtk_signal_connect_object(GTK_OBJECT(button_cancel), "clicked",
-                            GTK_SIGNAL_FUNC(gtk_widget_destroy),
-                            GTK_OBJECT(config_win));
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_cancel, FALSE, FALSE, 0);
-
-/*
-  button_ok = gtk_button_new_from_stock ("gtk-ok");
-  gtk_widget_show (button_ok);
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_ok, FALSE, FALSE, 0);
-
-  button_cancel = gtk_button_new_from_stock ("gtk-cancel");
-  gtk_widget_show (button_cancel);
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_cancel, FALSE, FALSE, 0);
-
-  g_signal_connect_swapped ((gpointer) button_ok, "clicked",
-                            G_CALLBACK (on_button_ok_enter),
-                            GTK_OBJECT (config_win));
-  g_signal_connect_swapped ((gpointer) button_cancel, "clicked",
-                            G_CALLBACK (gtk_widget_destroy),
-                            GTK_OBJECT (config_win));
-*/
-}
-
-//ll
Index: plugins/audacious/roar.c
===================================================================
--- plugins/audacious/roar.c	(revision 6052)
+++ 	(revision )
@@ -1,427 +1,0 @@
-//roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft    - 2008-2015,
- *                    Daniel Duntemann <dauxx@dauxx.org> - 2009
- *
- *  This file is part of the Audacious RoarAudio output plugin 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 "all.h"
-
-// FIXME: This interface has been changed
-gint ctrlsocket_get_session_id(void) {
- return -1;
-}
-
-OutputPlugin roar_op = {
-    .description = "RoarAudio Output Plugin",         
-    .init = roar_init,
-    .cleanup = NULL,
-    .about = roar_about,
-    .configure = roar_configure,  
-    .get_volume = roar_get_volume,
-    .set_volume = roar_set_volume,
-    .open_audio = roar_open,  
-    .write_audio = roar_write,
-    .close_audio = roar_close,
-    .flush = roar_flush,
-    .pause = roar_pause,
-    .buffer_free = roar_free,
-    .buffer_playing = roar_playing,
-    .output_time = roar_get_output_time,  
-    .written_time = roar_get_written_time,
-    .tell_audio = NULL
-};
-
-OutputPlugin *roar_oplist[] = { &roar_op, NULL };
-
-
-SIMPLE_OUTPUT_PLUGIN("RoarAudio Audacious Plugin",roar_oplist);
-
-OutputPlugin *get_oplugin_info(void) {
- return &roar_op;
-}
-
-void roar_init(void) {
- mcs_handle_t * cfgfile;
-
- cfgfile = aud_cfg_db_open();
-
- g_inst.state = 0;
- g_inst.server = NULL;
- g_inst.session = ctrlsocket_get_session_id();
-
- aud_cfg_db_get_string(cfgfile, "ROAR", "server", &g_inst.server);
-
- aud_cfg_db_get_string(cfgfile, "ROAR", "player_name", &g_inst.cfg.player_name);
-
- aud_cfg_db_close(cfgfile);
-
- if ( g_inst.cfg.player_name == NULL )
-  g_inst.cfg.player_name = "Audacious";
-
- ROAR_DBG("roar_init(*) = (void)");
-}
-
-int roar_playing(void) {
- return FALSE;
-}
-
-void roar_write(void *ptr, int length) {
- int r;
-
- if ( g_inst.pause )
-  return;
-
- ROAR_DBG("roar_write(ptr=%p, length=%i) = (void)", ptr, length);
-
- while (length) {
-  if ( (r = write(g_inst.data_fh, ptr, length >= 17640 ? 17640 : length)) != -1 ) {
-   g_inst.written   += r;
-   ptr              += r;
-   length           -= r;
-  } else {
-   return;
-  }
- }
-}
-
-int roar_open(AFormat fmt, int rate, int nch) {
- int codec = ROAR_CODEC_DEFAULT;
- int bits;
-
- if ( !(g_inst.state & STATE_CONNECTED) ) {
-  if ( roar_simple_connect(&(g_inst.con), g_inst.server, g_inst.cfg.player_name) == -1 ) {
-   return FALSE;
-  }
-  g_inst.state |= STATE_CONNECTED;
- }
-
-  bits = 16;
-  switch (fmt) {
-   case FMT_S8:
-     bits = 8;
-     codec = ROAR_CODEC_DEFAULT;
-    break;
-   case FMT_U8:
-     bits = 8;
-     codec = ROAR_CODEC_PCM_U_LE; // _LE, _BE, _PDP,... all the same for 8 bit output
-    break;
-   case FMT_U16_LE:
-     codec = ROAR_CODEC_PCM_U_LE;
-    break;
-   case FMT_U16_BE:
-     codec = ROAR_CODEC_PCM_U_BE;
-    break;
-   case FMT_U16_NE:
-#if BYTE_ORDER == BIG_ENDIAN
-     codec = ROAR_CODEC_PCM_U_BE;
-#elif BYTE_ORDER == LITTLE_ENDIAN
-     codec = ROAR_CODEC_PCM_U_LE;
-#else
-     codec = ROAR_CODEC_PCM_U_PDP;
-#endif
-    break;
-   case FMT_S16_LE:
-     codec = ROAR_CODEC_PCM_S_LE;
-    break;
-   case FMT_S16_BE:
-     codec = ROAR_CODEC_PCM_S_BE;
-    break;
-   case FMT_S16_NE:
-     codec = ROAR_CODEC_DEFAULT;
-    break;
-    case FMT_U24_LE: /* stored in lower 3 bytes of 32-bit value, highest byte must be 0 */
-     codec = ROAR_CODEC_PCM_U_LE;
-     bits = 24;
-     break;
-    case FMT_U24_BE:
-     codec = ROAR_CODEC_PCM_U_BE;
-     bits = 24;
-     break;
-    case FMT_U24_NE:
-     bits = 24;
-#if BYTE_ORDER == BIG_ENDIAN
-     codec = ROAR_CODEC_PCM_U_BE;
-#elif BYTE_ORDER == LITTLE_ENDIAN
-     codec = ROAR_CODEC_PCM_U_LE;
-#else
-     codec = ROAR_CODEC_PCM_U_PDP;
-#endif     
-     break;
-    case FMT_S24_LE:
-     bits = 24;
-     codec = ROAR_CODEC_PCM_S_LE;
-     break;
-    case FMT_S24_BE:
-     bits = 24;
-     codec = ROAR_CODEC_PCM_S_BE;
-     break;
-    case FMT_S24_NE:
-     codec = ROAR_CODEC_DEFAULT;
-     bits= 24;
-     break;
-    case FMT_U32_LE: /* highest byte must be 0 */
-     codec = ROAR_CODEC_PCM_U_LE;
-     bits = 32;
-     break;
-    case FMT_U32_BE:
-     codec = ROAR_CODEC_PCM_U_BE;
-     bits = 32;
-     break;
-    case FMT_U32_NE:
-     bits = 32;
-#if BYTE_ORDER == BIG_ENDIAN
-     codec = ROAR_CODEC_PCM_U_BE;
-#elif BYTE_ORDER == LITTLE_ENDIAN
-     codec = ROAR_CODEC_PCM_U_LE;
-#else
-     codec = ROAR_CODEC_PCM_U_PDP;
-#endif     
-     break;
-    case FMT_S32_LE:
-     bits = 32;
-     codec = ROAR_CODEC_PCM_S_LE;
-     break;
-    case FMT_S32_BE:
-     bits = 32;
-     codec = ROAR_CODEC_PCM_S_BE;
-     break;
-    case FMT_S32_NE:
-     codec = ROAR_CODEC_DEFAULT;
-     bits= 32;
-     break;
-    case FMT_FLOAT:
-    ROAR_DBG("roar_open(*): FMT_FLOAT");
-    break;
-    case FMT_FIXED32:
-     ROAR_DBG("roar_open(*): FMT_FIXED32");
-     break;
-     
- }
-
- ROAR_DBG("roar_open(*): fmt %i", fmt);
-
- g_inst.bps       = nch * rate * bits / 8;
-
- roar_close();
-
- if ( (g_inst.data_fh = roar_simple_new_stream_obj(&(g_inst.con), &(g_inst.stream),
-                              rate, nch, bits, codec, ROAR_DIR_PLAY)) == -1) {
-  roar_disconnect(&(g_inst.con));
-  g_inst.state |= STATE_CONNECTED;
-  g_inst.state -= STATE_CONNECTED;
-  if ( !(g_inst.state & STATE_NORECONNECT) ) {
-   g_inst.state |= STATE_NORECONNECT;
-   usleep(100000);
-   return roar_open(fmt, rate, nch);
-  } else {
-   g_inst.state -= STATE_NORECONNECT;
-   return FALSE;
-  }
- }
- g_inst.state |= STATE_PLAYING;
-
- g_inst.written = 0;
- g_inst.pause   = 0;
-
-#ifdef _WITH_BROKEN_CODE
- roar_update_metadata();
-#endif
-
- return TRUE;
-}
-
-void roar_close(void) {
- if ( g_inst.data_fh != -1 )
-  close(g_inst.data_fh);
- g_inst.data_fh = -1;
- g_inst.state |= STATE_PLAYING;
- g_inst.state -= STATE_PLAYING;
- g_inst.written = 0;
- ROAR_DBG("roar_close(void) = (void)");
-}
-
-void roar_pause(short p) {
- g_inst.pause = p;
-}
-
-int roar_free(void) {
- if ( g_inst.pause )
-  return 0;
- else
-  return 1000000; // ???
-}
-
-void roar_flush(int time) {
- gint64 r = time;
-
- r *= g_inst.bps;
- r /= 1000;
-
- g_inst.written = r;
-}
-
-int roar_get_output_time(void) {
- return roar_get_written_time();
-}
-
-int roar_get_written_time(void) {
- gint64 r;
-
- if ( !g_inst.bps ) {
-  ROAR_DBG("roar_get_written_time(void) = 0");
-  return 0;
- }
-
- r  = g_inst.written;
- r *= 1000; // sec -> msec
- r /= g_inst.bps;
- ROAR_DBG("roar_get_written_time(void) = %lu", r);
-
- return r;
-}
-
-
-// META DATA:
-
-int roar_update_metadata(void) {
-#ifdef _WITH_BROKEN_CODE
- struct roar_meta   meta;
- char empty = 0;
- char * info = NULL;
- int pos;
-
- pos     = audacious_remote_get_playlist_pos(g_inst.session);
-
- meta.value = &empty;
- meta.key[0] = 0;
- meta.type = ROAR_META_TYPE_NONE;
-
- roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_CLEAR, &meta);
-
- info = audacious_remote_get_playlist_file(g_inst.session, pos);
-
- if ( info ) {
-  if ( strncmp(info, "http:", 5) == 0 )
-   meta.type = ROAR_META_TYPE_FILEURL;
-  else
-   meta.type = ROAR_META_TYPE_FILENAME;
-
-  meta.value = info;
-  ROAR_DBG("roar_update_metadata(*): setting meta data: type=%i, strlen(value)=%i", meta.type, strlen(info));
-  roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_SET, &meta);
-
-  free(info);
- }
-
- info = audacious_remote_get_playlist_title(g_inst.session, pos);
- if ( info ) {
-  meta.type = ROAR_META_TYPE_TITLE;
-
-  meta.value = info;
-  roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_SET, &meta);
-
-  free(info);
- }
-
- meta.value = &empty;
- meta.type = ROAR_META_TYPE_NONE;
- roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_FINALIZE, &meta);
-
-#endif
- return 0;
-}
-
-int roar_chk_metadata(void) {
-#ifdef _WITH_BROKEN_CODE
- static int    old_pos = -1;
- static char * old_title = "NEW TITLE";
- int pos;
- char * title;
- int need_update = 0;
-
- pos     = audacious_remote_get_playlist_pos(g_inst.session);
-
- if ( pos != old_pos ) {
-  old_pos = pos;
-  need_update = 1;
- } else {
-  title = audacious_remote_get_playlist_title(g_inst.session, pos);
-
-  if ( strcmp(title, old_title) ) {
-   free(old_title);
-   old_title = title;
-   need_update = 1;
-  } else {
-   free(title);
-  }
- }
-
- if ( need_update ) {
-  roar_update_metadata();
- }
-
-#endif
- return 0;
-}
-
-// MIXER:
-
-
-void roar_get_volume(int *l, int *r) {
- struct roar_mixer_settings mixer;
- int channels;
- float fs;
-
- if ( !(g_inst.state & STATE_CONNECTED) )
-  return;
-
- if ( roar_get_vol(&(g_inst.con), g_inst.stream.id, &mixer, &channels) == -1 ) {
-  *l = *r = 100;
-  return;
- }
-
- fs = (float)mixer.scale/100.;
-
- if ( channels == 1 ) {
-  *l = *r = mixer.mixer[0]/fs;
- } else {
-  *l = mixer.mixer[0]/fs;
-  *r = mixer.mixer[1]/fs;
- }
-}
-
-void roar_set_volume(int l, int r) {
- struct roar_mixer_settings mixer;
-
- if ( !(g_inst.state & STATE_CONNECTED) )
-  return;
-
- mixer.mixer[0] = l;
- mixer.mixer[1] = r;
-
- mixer.scale    = 100;
-
- roar_set_vol(&(g_inst.con), g_inst.stream.id, &mixer, 2);
-}
-
-//ll
Index: plugins/bash/roaraudio
===================================================================
--- plugins/bash/roaraudio	(revision 5875)
+++ 	(revision )
@@ -1,835 +1,0 @@
-#
-#  /etc/bash_completion.d/roaraudio
-#
-# Bash completion function for the RoarAudio.
-# http://roaraudio.keep-cool.org/
-#
-# Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
-# --
-#
-
-# Tools supported completly:
-#roard
-#roar-config
-
-# Tools supported partly:
-#roarctl (volume not implemented correctly)
-
-# Tools not supported at all:
-
-# Tools not supported at all and unimportent:
-
-# Unsupported devel tools:
-#roartypes
-
-# The rest:
-#roarcat
-#roarcatplay
-#roarcatvio
-#roarbidir
-#roarmon
-#roarmonhttp
-#roarradio
-#roarlight
-#roarinterconnect
-#roarclientpass
-#roarfilt
-#roarvumeter
-#roarsockconnect
-#roarphone
-#roarshout
-#roarvorbis
-#roarsin
-#roardtmf
-#roarvio
-
-_roar_no_opts() {
-    COMPREPLY=()
-}
-complete -F _roar_no_opts roarsocktypes roartypes
-
-_roar_server() {
-    COMPREPLY=( $(_roar_server_exec "$1") )
-}
-
-_roar_server_exec() {
- local cur link words nodes stdsocks x11sock file_based file_based_ok
- local addr
- cur="$1"
- link=$(readlink /etc/roarserver 2> /dev/null)
-
- nodes=$(grep '^\(node\|executor\)' /etc/decnet.conf 2> /dev/null | sed 's/^.*\tname\t\t*//; s/\t.*$//; s/$/::/')
-
- file_based="/tmp/roar $HOME/.roar /tmp/muroard"
- stdsocks="localhost ::roar";
-
- x11sock=$(xprop -root 2>/dev/null | grep '^ROAR_SERVER(STRING) = ' | sed 's/^[^"]*"//; s/"$//')
-
- file_based_ok=""
- for addr in $file_based
- do
-  if [ -S "$addr" ]
-  then
-   file_based_ok="$file_based_ok $addr"
-  fi
- done
-
- words="$ROAR_SERVER $link $nodes $file_based_ok $stdsocks $x11sock +slp +fork +abstract"
-
- compgen -A hostname $cur
- compgen -W "$words" $cur
-}
-
-_roar_jumbo_mtu() {
-    COMPREPLY=($(compgen -W "750 1000 1100 1200 1300" -- "${COMP_WORDS[COMP_CWORD]}"))  
-}
-
-_roar_rate() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    COMPREPLY=($(compgen -W "8000 16000 32000 11025 22050 44100 48000 96000" -- ${cur}))  
-}
-
-_roar_bits() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    COMPREPLY=($(compgen -W "8 16 24 32" -- ${cur}))  
-}
-
-_roar_channels() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 9" -- ${cur}))  
-}
-
-_roar_codec() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    words=$(roard --list-cf | tail -n +4 | sed 's/^ *//; s/ .*$//')
-    COMPREPLY=($(compgen -W "${words} default pcm" -- ${cur}))  
-}
-
-_roar_flag() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    COMPREPLY=($(compgen -W "meta primary sync cleanmeta hwmixer pause mute mmap antiecho recsource passmixer virtual prethru immutable enhance singlesink" -- ${cur}))
-}
-
-_roar_dir() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    COMPREPLY=($(compgen -W "play record monitor filter output mixing meta bidir thru bridge midi_in midi_out light_in light_out raw_in raw_out complex_in complex_out rdtcs_in rdtcs_out" -- ${cur}))
-}
-
-_roar_metatype() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-#phi@ph7:roaraudio $ echo $(grep '^#define ROAR_META_TYPE_' include/roaraudio/meta.h  | cut -d_ -f4,5,6,7,8,9 | cut -d' ' -f1 | tr A-Z a-z)
-    COMPREPLY=($(compgen -W "none title album author autor artist version date license tracknumber organization description genre location contact streamurl homepage thumbnail length comment other filename fileurl server duration www woaf encoder encodedby year discid rpg_track_peak rpg_track_gain rpg_album_peak rpg_album_gain hash signalinfo audioinfo offset performer copyright likeness composer rights isrc language gtin isbn ean publisher discnumber sourcemedia label labelno" -- ${cur}))
-}
-
-_roar_role() {
-    local cur
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    COMPREPLY=($(compgen -W "unknown none music video game event beep phone background_music voice instrument rhythm click mixed" -- ${cur}))
-}
-
-_roar_baseopts() {
-    case "$1" in
-        '--rate')
-            _roar_rate
-            return 0
-            ;;
-        '--bits')
-            _roar_bits
-            return 0
-            ;;
-        '--chans')
-            _roar_channels
-            return 0
-            ;;
-        '--server')
-            _roar_server "${COMP_WORDS[COMP_CWORD]}"
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-  return 77
-}
-
-_roar_basecodec() {
-    case "$1" in
-        '--codec')
-            _roar_codec
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-  return 77
-}
-
-
-_roar_baseclients() {
-    local cur prev opts dirs
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    dirs="--wave --midi --light --raw --complex --rdtcs"
-    opts="$dirs --server --rate -R --bits -B --chans -C --codec --rel-id --help"
-
-    [ "${COMP_WORDS[0]}" = "roarmon" ] && opts="$opts --prethru"
-
-    _roar_baseopts  "$prev" && return 0;
-    _roar_basecodec "$prev" && return 0;
-
-    case "${prev}" in
-        '-R')
-            _roar_rate
-            return 0
-            ;;
-        '-B')
-            _roar_bits
-            return 0
-            ;;
-        '-C')
-            _roar_channels
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   _filedir
-   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roar_baseclients roarcat roarmon
-
-_roarcatplay() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-
-    opts="--server --simple --passive --background --verbose --help"
-
-    case "${COMP_WORDS[COMP_CWORD-1]}" in
-        '--server')
-            _roar_server "$cur"
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   _filedir
-   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarcatplay roarcatplay
-
-_roarvumeter() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    opts="--server --rate --bits --chans --samples --pc --db --beat --lowpass --help"
-
-    _roar_baseopts "$prev" && return 0;
-
-    case "${prev}" in
-        '--samples')
-            COMPREPLY=($(compgen -W "5000 50000" -- ${cur}))  
-            return 0
-            ;;
-        '--lowpass')
-            COMPREPLY=($(compgen -W "100 200 300 400 500" -- ${cur}))  
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarvumeter roarvumeter
-
-_roarradio() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    opts="--server --rate --bits --chans --codec --help"
-
-    _roar_baseopts  "$prev" && return 0;
-    _roar_basecodec "$prev" && return 0;
-
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarradio roarradio
-
-_roarvorbis() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    opts="--server --vclt-out --help"
-
-    case "${prev}" in
-        '--vclt-out')
-            _filedir
-            return 0
-            ;;
-        '--server')
-            _roar_server "$cur"
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarvorbis roarvorbis
-
-
-_roarinterconnect() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    opts="--server --remote --type --rate --bits --chans --codec --help"
-
-    _roar_baseopts  "$prev" && return 0;
-    _roar_basecodec "$prev" && return 0;
-
-    case "${prev}" in
-        '--remote')
-            _roar_server "$cur"
-            return 0
-            ;;
-        '--type')
-            COMPREPLY=($(compgen -W "roar esd bidir filter transmit receive" -- ${cur}))  
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarinterconnect roarinterconnect
-
-_roarbidir() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    opts="--server --rate --bits --chans --codec --help"
-
-    _roar_baseopts  "$prev" && return 0;
-    _roar_basecodec "$prev" && return 0;
-
-   _filedir
-   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarbidir roarbidir roarcatvio roarcatpassfh roarcatsendfile
-
-_roarcatad() {
-    local cur prev opts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    opts="--server --rate --bits --chans --help"
-
-    _roar_baseopts  "$prev" && return 0;
-
-   _filedir
-   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarcatad roarcatad roarcat2sock
-
-_roarphone() {
-    local cur prev opts mopts
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    mopts="--m-rn --m-nick --m-email --m-hp --m-thumbn --m-loc --m-org"
-    opts="--server --jumbo-mtu --io-flush --rate --bits --chans --afi-downmix --afi-lowpass --afi-speex-prep --afi-speex-denoise --afi-speex-agc --afi-speex-vad --codec --transcode --driver --device --antiecho --threshold --help $mopts"
-
-    _roar_baseopts  "$prev" && return 0;
-    _roar_basecodec "$prev" && return 0;
-
-    case "${prev}" in
-        '--jumbo-mtu')
-            _roar_jumbo_mtu
-            return 0
-            ;;
-        '--io-flush')
-            return 0
-            ;;
-        '--afi-lowpass')
-            return 0
-            ;;
-        '--driver')
-            return 0
-            ;;
-        '--device')
-            _filedir
-            return 0
-            ;;
-        '--antiecho')
-            COMPREPLY=($(compgen -W "none simple speex roard" -- ${cur}))  
-            return 0
-            ;;
-        '--threshold')
-            return 0
-            ;;
-        '--m-rn')
-            return 0
-            ;;
-        '--m-nick')
-            COMPREPLY=($(compgen -W "$USER" -- ${cur}))  
-            return 0
-            ;;
-        '--m-email')
-            COMPREPLY=($(compgen -W "$USER@$HOSTNAME" -- ${cur}))  
-            return 0
-            ;;
-        '--m-hp')
-            return 0
-            ;;
-        '--m-thumbn')
-            return 0
-            ;;
-        '--m-loc')
-            return 0
-            ;;
-        '--m-org')
-            return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
-   return 0
-}
-complete -F _roarphone roarphone
-
-_roarctl() {
-    local cur prev pprev opts cmds
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    pprev="--NX-COMMAND--"
-    if [ "$COMP_CWORD" -ge 2 ]
-    then
-     pprev="${COMP_WORDS[COMP_CWORD-2]}"
-    fi
-
-    if [ "$COMP_CWORD" -ge 3 ]
-    then
-     if [ "${COMP_WORDS[COMP_CWORD-3]}" = 'newvirtual' ]
-     then
-      _roar_codec
-      return 0
-     fi
-     if [ "$COMP_CWORD" -ge 4 ]
-     then
-      if [ "${COMP_WORDS[COMP_CWORD-4]}" = 'newvirtual' ]
-      then
-       _roar_rate
-       return 0
-      fi
-      if [ "$COMP_CWORD" -ge 5 ]
-      then
-       if [ "${COMP_WORDS[COMP_CWORD-5]}" = 'newvirtual' ]
-       then
-        _roar_bits
-        return 0
-       fi
-       if [ "$COMP_CWORD" -ge 6 ]
-       then
-        if [ "${COMP_WORDS[COMP_CWORD-6]}" = 'newvirtual' ]
-        then
-         _roar_channels
-         return 0
-        fi
-       fi
-      fi
-     fi
-    fi
-
-    opts="--server --help --verbose -v --list-aiprofiles --list-libstandards --enum-servers --hash-password"
-    cmds="help sleep ping whoami listaiprofiles aiprofileget standby off resume on standbymode exit terminate volume flag unflag kick newvirtual metaget metasave metaload serveroinfo listclients liststreams allinfo toogleflag protectflag role serverinfo servertime serveroinfo2 serverstandards libstandards clientinfo streaminfo"
-
-    case "${pprev}" in
-        'volume')
-            COMPREPLY=($(compgen -W "mono stereo 1 2 3 4 5 6 7 8 9" -- ${cur}))  
-	    return 0
-            ;;
-        'flag'|'unflag'|'toogleflag'|'protectflag')
-            _roar_flag
-	    return 0
-            ;;
-        'kick')
-	    return 0
-            ;;
-        'newvirtual')
-            _roar_dir
-	    return 0
-            ;;
-        'metaget')
-            _roar_metatype
-	    return 0
-            ;;
-        'metasave')
-            _filedir
-	    return 0
-            ;;
-        'metaload')
-            _filedir
-	    return 0
-            ;;
-        'role')
-            _roar_role
-	    return 0
-            ;;
-       *)
-        ;;
-    esac
-
-    case "${prev}" in
-        '--server')
-            _roar_server "$cur"
-            return 0
-            ;;
-        'sleep')
-	    return 0
-            ;;
-        'ping')
-	    return 0
-            ;;
-        'aiprofileget')
-            COMPREPLY=($(compgen -W "$(roarctl --list-aiprofiles | grep '^Profile Name *: *' | sed 's/^.*: *//')" -- ${cur}))  
-	    return 0
-            ;;
-        'volume')
-	    return 0
-            ;;
-        'flag'|'unflag'|'toogleflag'|'protectflag')
-	    return 0
-            ;;
-        'kick')
-            COMPREPLY=($(compgen -W "client stream sample source" -- ${cur}))  
-	    return 0
-            ;;
-        'newvirtual')
-	    return 0
-            ;;
-        'metaget')
-	    return 0
-            ;;
-        'metasave')
-	    return 0
-            ;;
-        'metaload')
-	    return 0
-            ;;
-        'serveroinfo2')
-            _roar_dir
-	    return 0
-            ;;
-        'clientinfo'|'streaminfo'|'role')
-            COMPREPLY=($(compgen -W "0 1 2 3 4 5 6 7 8 9" -- ${cur}))  
-	    return 0
-            ;;
-        *)
-        ;;
-    esac
-
-   COMPREPLY=($(compgen -W "${opts} ${cmds}" -- ${cur}))
-   return 0
-}
-
-complete -F _roarctl roarctl
-
-# TODO: add support to this so interactions between parameters are represented.
-_roar_config() {
-    local cur prev opts libs
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-    opts="--help --version --libs --cflags --output-pc --output-normal --render-path --universal --provider --product --list-path --path --compare-versions"
-    libs="roar roardsp roarmidi roarlight roareio roaresd esd roarartsc artsc roarpulse pulse roarpulse-simple pulse-simple roarsndio sndio roaryiff Y2"
-    liblibs=lib`echo "$libs" | sed 's/ / lib/g'`
-   COMPREPLY=($(compgen -W "${opts} ${libs} ${liblibs}" -- ${cur}))
-   return 0
-}
-
-complete -F _roar_config roar-config
-
-_roard() 
-{
-    local cur prev opts
-    local opts_misc opts_auth opts_plugins opts_audio opts_stream opts_rolestack opts_output opts_source opts_cf opts_midi opts_light opts_rdtcs opts_x11 opts_server
-    COMPREPLY=()
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-
-    #
-    #  The basic options we'll complete.
-    #
-    opts_misc="--daemon --verbose --terminate --start --restart --stop --shutdown --realtime --memlock --chroot --setgid --setuid --sysclocksync --location --description --pidfile --log-syslog --script-postdown --watchdog --watchdog-time"
-    opts_auth="--guest-acclev --trust-acclev --trust-root --no-trust-root --authfile-gen --authfile-load --authfile-type --authfile-acclev --new-authfile"
-    opts_plugins="--plugin-load"
-    opts_audio="--rate --bits --chans -R -B -C --aiprofile"
-    opts_stream="--stream-flags"
-    opts_rolestack="--list-rolestack --rolestack-push"
-    opts_output="--odriver --odevice -o -O -oO -oP -oN --list-driver"
-    opts_source="--source -s -S -sO -sP -sN --list-sources"
-    opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers"
-    opts_cf="--list-cf"
-    opts_midi="--midi-no-console --midi-console-enable --midi-console --ssynth-enable --ssynth-disable"
-    opts_light="--light-channels"
-    opts_rdtcs="--rds-pi --rds-ps --rds-pty --rds-tp --rds-ct"
-    opts_x11="--x11-display --display"
-    opts_server="--tcp --unix --decnet -t -u -n -4 -6 -64 --port -p --bind -b --sock --proto --proto-dir --proto-rate --proto-bits --proto-codec --proto-chans --list-proto --list-profiles --proto-profile --proto-aiprofile --list-aiprofiles --new-sock --slp --x11 --jumbo-mtu -G -U --no-listen --client-fh --close-fh --standby --auto-standby"
-
-    opts="$opts_misc $opts_auth $opts_plugins $opts_audio $opts_stream $opts_rolestack $opts_output $opts_source $opts_mixer $opts_cf $opts_midi $opts_light $opts_rdtcs $opts_x11 $opts_server --help"
-
-
-    #
-    #  Complete the arguments to some of the basic commands.
-    #
-    case "${prev}" in
-# DIR/FILE:
-	'--chroot')
-            _filedir -d
-	    return 0
-            ;;
-	'--pidfile')
-            _filedir
-	    return 0
-            ;;
-	'--script-postdown')
-            _filedir
-	    return 0
-            ;;
-        '--plugin-load')
-            _filedir
-	    return 0
-            ;;
-	'--authfile-gen'|'--authfile-load')
-            _filedir
-	    return 0
-            ;;
-# MemLock:
-	'--memlock')
-            COMPREPLY=($(compgen -W "none low medium high nearlyall nearlyallsys allcur all default" -- ${cur}))  
-	    return 0
-            ;;
-# Acclev
-	'--guest-acclev'|'--trust-acclev'|'--authfile-acclev')
-            COMPREPLY=($(compgen -W "none idented conctl guest user pwruser all" -- ${cur}))  
-	    return 0
-            ;;
-	'--authfile-type')
-            COMPREPLY=($(compgen -W "roar esd pulse htpasswd xauth" -- ${cur}))  
-	    return 0
-            ;;
-# String:
-	'--location'|'--description')
-	    return 0
-            ;;
-# Int:
-	'--rate'|'-R'|'--proto-rate')
-            _roar_rate
-	    return 0
-            ;;
-	'--bits'|'-B'|'--proto-bits')
-            _roar_bits
-	    return 0
-            ;;
-	'--chans'|'-C'|'--proto-chans')
-            _roar_channels
-	    return 0
-            ;;
-	'--light-channels')
-            COMPREPLY=($(compgen -W "512 1024 1536 2048 4096 8192" -- ${cur}))  
-	    return 0
-            ;;
-	'--jumbo-mtu')
-            _roar_jumbo_mtu
-	    return 0
-            ;;
-# C=F:
-	'--stream-flags')
-	    return 0
-            ;;
-# R:A
-	'--rolestack-push')
-	    return 0
-            ;;
-# driver:
-	'--odriver'|'-o')
-            words=$(roard --list-driver | tail -n +3 | sed 's/^ *//; s/ .*$//')
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))  
-	    return 0
-            ;;
-# Source:
-	'--source'|'-s')
-            words=$(roard --list-sources | tail -n +3 | sed 's/^ *//; s/ .*$//')
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))  
-	    return 0
-            ;;
-# Device:
-# FIXME: add support for non file devices
-	'--odevice'|'-O')
-            _filedir
-	    return 0
-            ;;
-	'-S')
-            _filedir
-	    return 0
-            ;;
-	'--midi-console')
-            _filedir
-	    return 0
-            ;;
-# Options:
-	'-dO')
-	    return 0
-            ;;
-	'-oO')
-	    return 0
-            ;;
-	'-sO')
-	    return 0
-            ;;
-# RDS:
-	'--rds-pi')
-	    return 0
-            ;;
-	'--rds-ps')
-	    return 0
-            ;;
-	'--rds-pty')
-	    return 0
-            ;;
-# Mixer:
-#    opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers"
-        '--mixer'|'-m')
-            words=$(roard --list-mixers | tail -n +3 | sed 's/^ *//; s/ .*$//')
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
-            return 0
-            ;;
-        '-M')
-            _filedir
-            return 0
-            ;;
-        '-mO')
-            return 0
-            ;;
-        '-mN')
-            return 0
-            ;;
-        '-mP')
-            return 0
-            ;;
-        '--list-mixers')
-            return 0
-            ;;
-# X11:
-	'--x11-display'|'--display')
-	    return 0
-            ;;
-# Port:
-	'--port'|'-p')
-	    COMPREPLY=( $( compgen -s $cur ) )
-	    return 0
-            ;;
-# Host/Node/File:
-	'--bind'|'-b')
-	    COMPREPLY=( $( compgen -A hostname $cur ) "0.0.0.0" )
-	    return 0
-            ;;
-	'--sock')
-            _filedir
-	    return 0
-            ;;
-# Proto:
-	'--proto')
-            words=$(roard --list-proto | tail -n +3 | sed 's/^ *//; s/ .*$//')
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))  
-	    return 0
-            ;;
-        '--proto-profile')
-            words=$(roard --list-profiles | tail -n +3 | sed 's/^ *//; s/ .*$//')
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
-            return 0
-            ;;
-        '--proto-aiprofile'|'--aiprofile')
-            words=$(roarctl --list-aiprofiles | grep '^Profile Name' | sed 's/^.*: *//')
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
-            return 0
-            ;;
-# FH:
-	'--client-fh')
-            words=$(command ls /proc/self/fd 2> /dev/null)
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))  
-	    return 0
-            ;;
-	'--close-fh')
-            words=$(command ls /proc/self/fd 2> /dev/null)
-            COMPREPLY=($(compgen -W "${words}" -- ${cur}))  
-	    return 0
-            ;;
-# Dir:
-        '--proto-dir')
-            _roar_dir
-            return 0;
-            ;;
-# Codec:
-        '--proto-codec')
-            _roar_codec
-            return 0;
-            ;;
-# Time:
-        '--watchdog-time')
-            COMPREPLY=($(compgen -W "1000 2000 3000 5000 10000 20000 25000 640000" -- ${cur}))
-            return 0;
-            ;;
-        *)
-        ;;
-    esac
-
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))  
-   return 0
-}
-complete -F _roard roard
-
-complete -F _command roarify
-
-# vim:ft=sh:
-
-#ll
Index: plugins/configure.inc
===================================================================
--- plugins/configure.inc	(revision 1742)
+++ 	(revision )
@@ -1,69 +1,0 @@
-#!/bin/sh
-
-# check for bash...
-
-if [ "$(echo -n)" = '-n' ]
-then
- SHELL=$(which bash ksh sh 2> /dev/null | grep ^/ | head -n 1)
- exec $SHELL $0 "$@"
-fi
-
-
-TF_C=test.c
-TF=./test
-
-check_cc() {
- echo -n 'testing for C compiler... '
- CC=$(which gcc cc 2> /dev/null | head -n 1)
- if [ -x "$CC" ]
- then
-  echo $CC
- else
-  echo no.
-  on_error;
- fi
-}
-
-check_pkg_config() {
- echo -n "checking for pkg-config... "
- if [ "$PKG_CONFIG" = '' ]
- then
-  PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
-  if $PKG_CONFIG --help > /dev/null 2> /dev/null
-  then
-   echo $PKG_CONFIG
-  else
-   PKG_CONFIG=''
-   echo no
-   on_error;
-  fi
- else
-   echo $PKG_CONFIG '(forced)'
- fi
-}
-
-check_libroar() {
- echo -n 'testing for libroar... '
- if $HAVE_ROAR
- then
-  echo 'yes (forced)'
- else
-  cat > $TF_C << EOF
-#include <roaraudio.h>
-int main (void) { return 0; }
-EOF
-
-  $CC -o $TF $TF_C -lroar 2> /dev/null
-  $TF 2> /dev/null
-
-  if [ "$?" = '0' ]
-  then
-   echo yes
-  else
-   echo no.
-   on_error
-  fi
- fi
-}
-
-#ll
Index: plugins/gstreamer0.10/.cvsignore
===================================================================
--- plugins/gstreamer0.10/.cvsignore	(revision 2802)
+++ 	(revision )
@@ -1,4 +1,0 @@
-Makefile.conf
-Makefile.OLD
-files
-*.dll
Index: plugins/gstreamer0.10/Makefile
===================================================================
--- plugins/gstreamer0.10/Makefile	(revision 5851)
+++ 	(revision )
@@ -1,23 +1,0 @@
-include ../../Makefile.conf
-include ../../Makefile.inc
-include Makefile.conf
-
-SLIB=libgstroar.so
-TARGETS=$(SLIB)
-
-OBJS=gstroar.o roarsink.o roarmixer.o
-
-#DEFINES        = -DDEBUG
-INCLUDE = -I. -I../include -I../include/libroar
-CFLAGS += $(DEBUG_g) $(Wall) $(OPTI_O) $(DEFINES) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC) $(GST_CFLAGS)
-LDFLAGS+= $(DEBUG_g) $(Wall) -L../lib/ $(SHARED) $(LDPATH) $(LIBROAR) $(GST_LIBS) -lgstaudio-0.10
-
-all: $(TARGETS)
-	rm -f ../../lib/${SLIB} 2> /dev/null || true
-	cp $(cp_v) ${TARGETS} ../../lib/
-clean:
-	rm -f $(TARGETS) *.o
-new: clean all
-
-libgstroar.so: $(OBJS)
-	$(CC) $(LDFLAGS) -o libgstroar.so $(OBJS)
Index: plugins/gstreamer0.10/gstroar.c
===================================================================
--- plugins/gstreamer0.10/gstroar.c	(revision 6052)
+++ 	(revision )
@@ -1,57 +1,0 @@
-//gstroar.c:
-/* GStreamer
- * Copyright (C) <1999>      Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2003>      David A. Schleef <ds@schleef.org>
- * Copyright (C) <2008-2015> Philipp 'ph3-der-loewe' Schafft
- *                                    <lion@lion.leolix.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "roarsink.h"
-#include "roarmixer.h"
-
-//#include "gst/gst-i18n-plugin.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-  if (!gst_roarsink_factory_init (plugin))
-    return FALSE;
-  if (!gst_roarmixer_factory_init (plugin))
-    return FALSE;
-
-//  GST_DEBUG_CATEGORY_INIT (roar_debug, "roar", 0, "RoarAudio elements");
-
-#ifdef ENABLE_NLS
-  setlocale (LC_ALL, "");
-  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-#endif /* ENABLE_NLS */
-
-  return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    "roaraudio",
-    "RoarAudio Element Plugins",
-    plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
-
-
-//ll
Index: plugins/gstreamer0.10/roarmixer.c
===================================================================
--- plugins/gstreamer0.10/roarmixer.c	(revision 6052)
+++ 	(revision )
@@ -1,484 +1,0 @@
-//roarmixer.c:
-/* GStreamer
- * Copyright (C) <2005>      Arwed v. Merkatz <v.merkatz@gmx.net>
- * Copyright (C) <2008-2015> Philipp 'ph3-der-loewe' Schafft
- *                                    <lion@lion.leolix.org>
- *
- * roarmixer.h: an RoarAudio audio mixer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#include "roarmixer.h"
-
-GST_DEBUG_CATEGORY_EXTERN (roar_debug);
-#define GST_CAT_DEFAULT roar_debug
-
-enum
-{
-  PROP_DEVICE_NAME = 1
-};
-
-
-static const GstElementDetails gst_roar_mixer_element_details =
-GST_ELEMENT_DETAILS ("RoarAudio Mixer",
-    "Generic/Audio",
-    "Control sound input and output levels with RoarAudio",
-    "Philipp 'ph3-der-loewe' Schafft <lion@lion.leolix.org>");
-
-GST_BOILERPLATE_WITH_INTERFACE (GstRoarMixerElement, gst_roar_mixer_element,
-    GstElement, GST_TYPE_ELEMENT, GstMixer, GST_TYPE_MIXER,
-    gst_roar_mixer_element);
-
-GST_IMPLEMENT_ROAR_MIXER_METHODS (GstRoarMixerElement, gst_roar_mixer_element);
-
-static GstStateChangeReturn gst_roar_mixer_element_change_state (GstElement *
-    element, GstStateChange transition);
-
-static void gst_roar_mixer_element_get_property (GObject * object,
-    guint prop_id, GValue * value, GParamSpec * pspec);
-
-static void
-gst_roar_mixer_element_base_init (gpointer klass)
-{
-  gst_element_class_set_details (GST_ELEMENT_CLASS (klass),
-      &gst_roar_mixer_element_details);
-}
-
-static void
-gst_roar_mixer_element_class_init (GstRoarMixerElementClass * klass)
-{
-  GstElementClass *element_class;
-  GObjectClass *gobject_class;
-
-  element_class = (GstElementClass *) klass;
-  gobject_class = (GObjectClass *) klass;
-
-  gobject_class->get_property = gst_roar_mixer_element_get_property;
-
-  g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
-      g_param_spec_string ("device-name", "Device name",
-          "Human-readable name of the sound device", "", G_PARAM_READABLE));
-
-  element_class->change_state =
-      GST_DEBUG_FUNCPTR (gst_roar_mixer_element_change_state);
-}
-
-static void
-gst_roar_mixer_element_init (GstRoarMixerElement * this,
-    GstRoarMixerElementClass * g_class)
-{
-  this->mixer = NULL;
-}
-
-static void
-gst_roar_mixer_element_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec)
-{
-  GstRoarMixerElement *this = GST_ROAR_MIXER_ELEMENT (object);
-
-  switch (prop_id) {
-    case PROP_DEVICE_NAME:
-      if (this->mixer) {
-        g_value_set_string (value, this->mixer->cardname);
-      } else {
-        g_value_set_string (value, NULL);
-      }
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static GstStateChangeReturn
-gst_roar_mixer_element_change_state (GstElement * element,
-    GstStateChange transition)
-{
-  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-  GstRoarMixerElement *this = GST_ROAR_MIXER_ELEMENT (element);
-
-  switch (transition) {
-    case GST_STATE_CHANGE_NULL_TO_READY:
-      if (!this->mixer) {
-        this->mixer = gst_roarmixer_new(NULL, GST_ROAR_MIXER_ALL);
-      }
-      break;
-    default:
-      break;
-  }
-
-  ret = GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
-  if (ret == GST_STATE_CHANGE_FAILURE)
-    return ret;
-
-  switch (transition) {
-    case GST_STATE_CHANGE_READY_TO_NULL:
-      if (this->mixer) {
-        gst_roarmixer_free(this->mixer);
-        this->mixer = NULL;
-      }
-      break;
-    default:
-      break;
-  }
-
-  return ret;
-}
-
-
-gboolean gst_roarmixer_factory_init (GstPlugin * plugin) {
-  if (!gst_element_register(plugin, "roarmixer", GST_RANK_MARGINAL,
-                            GST_TYPE_ROAR_MIXER_ELEMENT))
-    return FALSE;
-
-  return TRUE;
-}
-
-G_DEFINE_TYPE (GstRoarMixerTrack, gst_roarmixer_track, GST_TYPE_MIXER_TRACK);
-
-GstRoarMixer*    gst_roarmixer_new                (const gchar *device,
-                                                 GstRoarMixerDirection dir) {
-  GstRoarMixer *ret = NULL;
-
-  ROAR_WARN("gst_roarmixer_new(device='%s', dir=0x%.4x) = ?", device, dir);
-
-  ret = g_new0(GstRoarMixer, 1);
-
-  ret->device = g_strdup(device);
-  ret->dir    = dir;
-  ret->cardname = g_strdup("RoarAudio Default Device");
-
-/*
-  if (!gst_ossmixer_open (ret))
-    goto error;
-*/
-
-  if ( roar_simple_connect(&(ret->con), (char*)device, "gstroarmixer") == -1 )
-   goto error;
-
-  ROAR_WARN("gst_roarmixer_new(device='%s', dir=0x%.4x) = %p", device, dir, ret);
-  return ret;
-
-error:
-  if (ret)
-    gst_roarmixer_free (ret);
-
-  ROAR_WARN("gst_roarmixer_new(device='%s', dir=0x%.4x) = NULL // Error?", device, dir);
-  return NULL;
-}
-
-void            gst_roarmixer_free               (GstRoarMixer *mixer) {
-  g_return_if_fail(mixer != NULL);
-
-  ROAR_WARN("gst_roarmixer_free(mixer=%p) = ?", mixer);
-
-  if (mixer->device) {
-    g_free(mixer->device);
-    mixer->device = NULL;
-  }
-
-  if (mixer->cardname) {
-    g_free(mixer->cardname);
-    mixer->cardname = NULL;
-  }
-
-  if (mixer->tracklist) {
-    g_list_foreach(mixer->tracklist, (GFunc) g_object_unref, NULL);
-    g_list_free(mixer->tracklist);
-    mixer->tracklist = NULL;
-  }
-
-  roar_disconnect(&(mixer->con));
-
-  g_free (mixer);
-
-  ROAR_WARN("gst_roarmixer_free(mixer=%p) = (void)", mixer);
-}
-
-/* unused with G_DISABLE_* */
-static G_GNUC_UNUSED gboolean gst_roarmixer_contains_track (GstRoarMixer * mixer,
-                                                            GstRoarMixerTrack * roartrack) {
-  const GList *item;
-
-  if ( mixer == NULL || mixer->tracklist == NULL )
-   return FALSE;
-
-  for (item = mixer->tracklist; item != NULL; item = item->next)
-    if (item->data == roartrack)
-      return TRUE;
-
-  return FALSE;
-}
-
-void            gst_roarmixer_updatestreamlist   (GstRoarMixer *mixer) {
-  gint  i      = 0;
-  gint num;
-  gint id[ROAR_STREAMS_MAX];
-  GstMixerTrack *track;
-
-  ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p) = ? // ########################", mixer);
-  ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p): tracklist=%p", mixer, mixer->tracklist);
-
-  if (mixer->tracklist) {
-    ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p) = (void)", mixer);
-    return;
-  }
-
-/*
-  if (mixer->tracklist) {
-    g_list_foreach(mixer->tracklist, (GFunc) g_object_unref, NULL);
-    g_list_free(mixer->tracklist);
-    mixer->tracklist = NULL;
-  }
-*/
-
-  ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p): tracklist=%p", mixer, mixer->tracklist);
-
-  if ( (num = roar_list_streams(&(mixer->con), id, ROAR_STREAMS_MAX)) == -1 ) {
-    return;
-  }
-
-
-  for (i = 0; i < num; i++) {
-   track = gst_roarmixer_track_new(mixer, id[i]);
-   ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p): track=%p", mixer, track);
-
-   if ( track == NULL )
-    continue;
-
-   mixer->tracklist = g_list_append(mixer->tracklist, track);
-  }
-
-  ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p): tracklist=%p", mixer, mixer->tracklist);
-
-  ROAR_WARN("gst_roarmixer_updatestreamlist(mixer=%p) = (void) // ###################", mixer);
-}
-
-const GList*    gst_roarmixer_list_tracks        (GstRoarMixer * mixer) {
- ROAR_WARN("gst_roarmixer_list_tracks(mixer=%p) = ?", mixer);
-
- gst_roarmixer_updatestreamlist(mixer);
-
- ROAR_WARN("gst_roarmixer_list_tracks(mixer=%p) = %p", mixer, mixer->tracklist);
- return (const GList *) mixer->tracklist;
-}
-
-void            gst_roarmixer_set_volume         (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gint * volumes) {
- GstRoarMixerTrack *roartrack = GST_ROARMIXER_TRACK(track);
- int channels;
- struct roar_mixer_settings m;
- int mode = ROAR_SET_VOL_ALL;
- gint i;
-
-
- g_return_if_fail(gst_roarmixer_contains_track(mixer, roartrack));
-
- if ( roar_get_vol(&(mixer->con), roartrack->stream_id, &m, &channels) == -1 ) {
-  ROAR_WARN("gst_roarmixer_get_volume(*): can not get mixer infos for stream %i", roartrack->stream_id);
-  return;
- }
-
- if ( channels != track->num_channels ) {
-  ROAR_WARN("gst_roarmixer_get_volume(*): numer of channels for stream %i mismatch (local: %i, server: %i)",
-            roartrack->stream_id, (int)track->num_channels, channels);
-
-  if ( track->num_channels < channels )
-   channels = track->num_channels;
-  mode = ROAR_SET_VOL_UNMAPPED;
- }
-
- for (i = 0; i < channels; i++) {
-  m.mixer[i] = volumes[i];
- }
-
- m.scale = 65535;
-
- _LIBROAR_IGNORE_RET(roar_set_vol(&(mixer->con), roartrack->stream_id, &m, channels, mode));
-}
-
-void            gst_roarmixer_get_volume         (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gint * volumes) {
- GstRoarMixerTrack *roartrack = GST_ROARMIXER_TRACK(track);
- int channels;
- struct roar_mixer_settings m;
- gint i;
-
-
- g_return_if_fail(gst_roarmixer_contains_track(mixer, roartrack));
-
- if ( roar_get_vol(&(mixer->con), roartrack->stream_id, &m, &channels) == -1 ) {
-  ROAR_WARN("gst_roarmixer_get_volume(*): can not get mixer infos for stream %i", roartrack->stream_id);
-  return;
- }
-
- if ( channels != track->num_channels ) {
-  ROAR_WARN("gst_roarmixer_get_volume(*): numer of channels for stream %i mismatch", roartrack->stream_id);
-
-  if ( track->num_channels < channels )
-   channels = track->num_channels;
- }
-
- for (i = 0; i < channels; i++) {
-  if ( m.scale == 65535 ) {
-   volumes[i] = m.mixer[i];
-  } else {
-   volumes[i] = m.mixer[i] * 65535. / (float) m.scale; // we do not hanle precides scaling here
-                                                       // as it does not matter:
-                                                       // we never write those values back to roard.
-  }
- }
-
-}
-void            gst_roarmixer_set_record         (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gboolean record) {
-}
-void            gst_roarmixer_set_mute           (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gboolean mute) {
-  GstRoarMixerTrack *roartrack = GST_ROARMIXER_TRACK(track);
-  struct roar_stream s;
-
-  g_return_if_fail(gst_roarmixer_contains_track(mixer, roartrack));
-
-  roar_stream_new_by_id(&s, roartrack->stream_id);
-
-  if (mute) {
-    _LIBROAR_IGNORE_RET(roar_stream_set_flags(&(mixer->con), &s, ROAR_FLAG_MUTE, ROAR_SET_FLAG));
-  } else {
-    _LIBROAR_IGNORE_RET(roar_stream_set_flags(&(mixer->con), &s, ROAR_FLAG_MUTE, ROAR_RESET_FLAG));
-  }
-}
-
-// tracks:
-#define MASK_BIT_IS_SET(mask, bit) \
-  (mask & (1 << bit))
-
-static void
-gst_roarmixer_track_class_init (GstRoarMixerTrackClass * klass)
-{
-  /* nop */
-}
-
-static void
-gst_roarmixer_track_init (GstRoarMixerTrack * track)
-{
-  //memset(track, 0, sizeof(*track));
-  track->stream_id = -1;
-  ROAR_WARN("gst_roarmixer_track_init(track=%p) = (void)", track);
-}
-
-GstMixerTrack *
-gst_roarmixer_track_new (GstRoarMixer * mixer,
-    gint stream_id)
-{
-  GstRoarMixerTrack *roartrack;
-  GstMixerTrack *track;
-  struct roar_stream s;
-  struct roar_client c;
-  struct roar_meta   m;
-  gint flags = 0;
-  gchar buf[1024];
-  int num;
-  int id[ROAR_CLIENTS_MAX];
-  char * clientname = NULL;
-  char * metaname   = NULL;
-  char   streamname[1024] = {0};
-  gint i, h;
-
-  ROAR_WARN("gst_roarmixer_track_new(mixer=%p, stream_id=%i) = ?", mixer, stream_id);
-
-  if ( roar_get_stream(&(mixer->con), &s, stream_id) == -1 ) {
-    return NULL;
-  }
-
- // TODO: find something more efficent:
-
- if ( (num = roar_list_clients(&(mixer->con), id, ROAR_CLIENTS_MAX)) != -1 ) {
-  for (i = 0; i < num; i++) {
-   ROAR_DBG("gst_roarmixer_track_new(*): stream %i -->> client %i?", stream_id, id[i]);
-   if ( roar_get_client(&(mixer->con), &c, id[i]) != -1 ) {
-    for (h = 0; h < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; h++) {
-     ROAR_DBG("gst_roarmixer_track_new(*): stream %i <-> %i -->> client %i?", stream_id, c.streams[h], id[i]);
-     if ( c.streams[h] == stream_id ) {
-      clientname = c.name;
-      h = ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT;
-      i = num;
-     }
-    }
-   }
-  }
- }
-
- m.type = ROAR_META_TYPE_TITLE;
- if ( roar_stream_meta_get(&(mixer->con), &s, &m) != -1 ) {
-  metaname = m.value;
- }
-
- if ( roar_stream_get_name(&(mixer->con), &s, streamname, 1024) != 0 )
-  *streamname = 0;
-
-  switch (s.dir) {
-   case ROAR_DIR_PLAY:
-     flags |= GST_MIXER_TRACK_OUTPUT;
-    break;
-   case ROAR_DIR_MIXING:
-     flags |= GST_MIXER_TRACK_OUTPUT;
-    break;
-   case ROAR_DIR_OUTPUT:
-     flags |= GST_MIXER_TRACK_MASTER;
-   case ROAR_DIR_MONITOR:
-     flags |= GST_MIXER_TRACK_OUTPUT;
-    break;
-   default: return NULL;
-  }
-
-#if 0
-  if ( !*streamname && metaname == NULL )
-   sprintf(streamname, "[Stream %i]", stream_id);
-
-  sprintf(buf, "%s\n%s",  clientname ? clientname : "[Unknown]",
-                         *streamname ? streamname : metaname
-                         );
-#else
-  if ( *streamname ) {
-   strcpy(buf, streamname);
-  } else {
-   sprintf(buf, "Stream %i/%s", stream_id, clientname);
-  }
-#endif
-
-  roartrack = g_object_new(GST_TYPE_ROARMIXER_TRACK, NULL);
-  ROAR_WARN("gst_roarmixer_track_new(*): roartrack=%p", roartrack);
-  track               = GST_MIXER_TRACK(roartrack);
-  track->label        = g_strdup(buf);
-  track->num_channels = s.info.channels;
-  track->flags        = flags;
-  track->min_volume   = 0;
-  track->max_volume   = 65535;
-  roartrack->stream_id = stream_id;
-
-  /* volume */
-  ROAR_WARN("gst_roarmixer_track_new(mixer=%p, stream_id=%i) = %p", mixer, stream_id, track);
-  return track;
-}
-
-//ll
Index: plugins/gstreamer0.10/roarmixer.h
===================================================================
--- plugins/gstreamer0.10/roarmixer.h	(revision 6052)
+++ 	(revision )
@@ -1,222 +1,0 @@
-//roarmixer.h:
-/* GStreamer
- * Copyright (C) <2005>      Arwed v. Merkatz <v.merkatz@gmx.net>
- * Copyright (C) <2008-2015> Philipp 'ph3-der-loewe' Schafft
- *                                    <lion@lion.leolix.org>
- *
- * roarmixer.h: an RoarAudio audio mixer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_ROARMIXER_H__
-#define __GST_ROARMIXER_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/mixer.h>
-#include <roaraudio.h>
-
-#define VERSION "0.0.1"
-#define PACKAGE "gst-plugins"
-#define GST_PACKAGE_ORIGIN "Unknown package origin"
-#define GST_PACKAGE_NAME "GStreamer Plug-ins source release"
-
-G_BEGIN_DECLS
-
-#define GST_ROAR_MIXER_ELEMENT(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ROAR_MIXER_ELEMENT,GstRoarMixerElement))
-#define GST_ROAR_MIXER_ELEMENT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ROAR_MIXER_ELEMENT,GstRoarMixerElementClass))
-#define GST_IS_ROAR_MIXER_ELEMENT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ROAR_MIXER_ELEMENT))
-#define GST_IS_ROAR_MIXER_ELEMENT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ROAR_MIXER_ELEMENT))
-#define GST_TYPE_ROAR_MIXER_ELEMENT              (gst_roar_mixer_element_get_type())
-
-#define GST_TYPE_ROARMIXER_TRACK \
-  (gst_roarmixer_track_get_type ())
-#define GST_ROARMIXER_TRACK(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ROARMIXER_TRACK, \
-                               GstRoarMixerTrack))
-#define GST_ROARMIXER_TRACK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ROARMIXER_TRACK, \
-                            GstRoarMixerTrackClass))
-#define GST_IS_ROARMIXER_TRACK(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ROARMIXER_TRACK))
-#define GST_IS_ROARMIXER_TRACK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ROARMIXER_TRACK))
-
-
-typedef struct _GstRoarMixerElement GstRoarMixerElement;
-typedef struct _GstRoarMixerElementClass GstRoarMixerElementClass;
-typedef struct _GstRoarMixer GstRoarMixer;
-
-struct _GstRoarMixerElement {
-  GstElement            parent;
-
-  GstRoarMixer           *mixer;
-};
-
-struct _GstRoarMixerElementClass {
-  GstElementClass       parent;
-};
-
-
-GType           gst_roar_mixer_element_get_type          (void);
-
-typedef enum {
-  GST_ROAR_MIXER_CAPTURE = 1<<0,
-  GST_ROAR_MIXER_PLAYBACK = 1<<1,
-  GST_ROAR_MIXER_ALL = GST_ROAR_MIXER_CAPTURE | GST_ROAR_MIXER_PLAYBACK
-} GstRoarMixerDirection;
-
-
-#define GST_ROAR_MIXER(obj)              ((GstRoarMixer*)(obj))
-
-struct _GstRoarMixer {
-  GList *               tracklist;      /* list of available tracks */
-
-  struct roar_connection con;
-  int       fd;
-  gchar    *host;
-
-  gchar *               device;
-  gchar *               cardname;
-  GstRoarMixerDirection dir;
-};
-
-typedef struct _GstRoarMixerTrack {
-  GstMixerTrack parent;
-
-  struct roar_mixer_settings mixer;
-  gint          channels;
-  gchar       * name;
-  gint          stream_id;
-} GstRoarMixerTrack;
-
-typedef struct _GstRoarMixerTrackClass {
-  GstMixerTrackClass parent;
-} GstRoarMixerTrackClass;
-
-GType gst_roarmixer_get_type(void);
-gboolean gst_roarmixer_factory_init (GstPlugin *plugin);
-
-GstRoarMixer*    gst_roarmixer_new                (const gchar *device,
-                                                 GstRoarMixerDirection dir);
-void            gst_roarmixer_free               (GstRoarMixer *mixer);
-void            gst_roarmixer_updatestreamlist   (GstRoarMixer *mixer);
-
-const GList*    gst_roarmixer_list_tracks        (GstRoarMixer * mixer);
-void            gst_roarmixer_set_volume         (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gint * volumes);
-void            gst_roarmixer_get_volume         (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gint * volumes);
-void            gst_roarmixer_set_record         (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gboolean record);
-void            gst_roarmixer_set_mute           (GstRoarMixer * mixer,
-                                                 GstMixerTrack * track,
-                                                 gboolean mute);
-
-GType           gst_roarmixer_track_get_type     (void);
-GstMixerTrack *
-gst_roarmixer_track_new (GstRoarMixer * mixer,
-    gint stream_id);
-
-#define GST_IMPLEMENT_ROAR_MIXER_METHODS(Type, interface_as_function)            \
-static gboolean                                                                 \
-interface_as_function ## _supported (Type *this, GType iface_type)              \
-{                                                                               \
-  g_assert (iface_type == GST_TYPE_MIXER);                                      \
-                                                                                \
-  return (this->mixer != NULL);                                                 \
-}                                                                               \
-                                                                                \
-static const GList*                                                             \
-interface_as_function ## _list_tracks (GstMixer * mixer)                        \
-{                                                                               \
-  Type *this = (Type*) mixer;                                                   \
-                                                                                \
-  g_return_val_if_fail (this != NULL, NULL);                                    \
-  g_return_val_if_fail (this->mixer != NULL, NULL);                             \
-                                                                                \
-  return gst_roarmixer_list_tracks (this->mixer);                                \
-}                                                                               \
-                                                                                \
-static void                                                                     \
-interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track,  \
-    gint * volumes)                                                             \
-{                                                                               \
-  Type *this = (Type*) mixer;                                                   \
-                                                                                \
-  g_return_if_fail (this != NULL);                                              \
-  g_return_if_fail (this->mixer != NULL);                                       \
-                                                                                \
-  gst_roarmixer_set_volume (this->mixer, track, volumes);                        \
-}                                                                               \
-                                                                                \
-static void                                                                     \
-interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track,  \
-    gint * volumes)                                                             \
-{                                                                               \
-  Type *this = (Type*) mixer;                                                   \
-                                                                                \
-  g_return_if_fail (this != NULL);                                              \
-  g_return_if_fail (this->mixer != NULL);                                       \
-                                                                                \
-  gst_roarmixer_get_volume (this->mixer, track, volumes);                        \
-}                                                                               \
-                                                                                \
-static void                                                                     \
-interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track,  \
-    gboolean record)                                                            \
-{                                                                               \
-  Type *this = (Type*) mixer;                                                   \
-                                                                                \
-  g_return_if_fail (this != NULL);                                              \
-  g_return_if_fail (this->mixer != NULL);                                       \
-                                                                                \
-  gst_roarmixer_set_record (this->mixer, track, record);                         \
-}                                                                               \
-                                                                                \
-static void                                                                     \
-interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track,    \
-    gboolean mute)                                                              \
-{                                                                               \
-  Type *this = (Type*) mixer;                                                   \
-                                                                                \
-  g_return_if_fail (this != NULL);                                              \
-  g_return_if_fail (this->mixer != NULL);                                       \
-                                                                                \
-  gst_roarmixer_set_mute (this->mixer, track, mute);                             \
-}                                                                               \
-                                                                                \
-static void                                                                     \
-interface_as_function ## _interface_init (GstMixerClass * klass)                \
-{                                                                               \
-  GST_MIXER_TYPE (klass) = GST_MIXER_HARDWARE;                                  \
-                                                                                \
-  /* set up the interface hooks */                                              \
-  klass->list_tracks = interface_as_function ## _list_tracks;                   \
-  klass->set_volume = interface_as_function ## _set_volume;                     \
-  klass->get_volume = interface_as_function ## _get_volume;                     \
-  klass->set_mute = interface_as_function ## _set_mute;                         \
-  klass->set_record = interface_as_function ## _set_record;                     \
-}
-
-
-G_END_DECLS
-
-#endif /* __GST_ROARMIXER_H__ */
Index: plugins/gstreamer0.10/roarsink.c
===================================================================
--- plugins/gstreamer0.10/roarsink.c	(revision 6052)
+++ 	(revision )
@@ -1,528 +1,0 @@
-//roarsink.c:
-/* GStreamer
- * Copyright (C) <2005>      Arwed v. Merkatz <v.merkatz@gmx.net>
- * Copyright (C) <2008-2015> Philipp 'ph3-der-loewe' Schafft
- *                            <lion@lion.leolix.org>
- *
- * Roughly based on the gstreamer 0.8 esdsink plugin:
- * Copyright (C) <2001> Richard Boulton <richard-gst@tartarus.org>
- *
- * roarsink.c: an RoarAudio audio sink
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "roarsink.h"
-#include <unistd.h>
-#include <errno.h>
-
-#define _(x) (x)
-
-//#include <gst/gst-i18n-plugin.h>
-
-#ifndef ROAR_MAX_WRITE_SIZE
-#define ROAR_MAX_WRITE_SIZE (21 * 4096)
-#endif
-#define ROAR_BUF_SIZE 1764 /* this is dynamic for RoarAudio, use the most common value here for the moment */
-
-//GST_DEBUG_CATEGORY_EXTERN (roar_debug);
-//#define GST_CAT_DEFAULT roar_debug
-
-/* elementfactory information */
-static const GstElementDetails roarsink_details =
-GST_ELEMENT_DETAILS("RoarAudio audio sink",
-    "Sink/Audio",
-    "Plays audio to an RoarAudio server",
-    "Philipp 'ph3-der-loewe' Schafft <lion@lion.leolix.org>");
-
-enum
-{
-  PROP_0,
-  PROP_HOST,
-  PROP_ROLE,
-  PROP_VOLUME,
-  PROP_MUTE
-};
-
-#define _QM(x) #x
-#define  QM(x) _QM(x)
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS(
-        "audio/x-alaw, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, " QM(ROAR_MAX_CHANNELS) " ]; "
-
-        "audio/x-mulaw, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, " QM(ROAR_MAX_CHANNELS) " ]; "
-
-//        "audio/x-flac; "
-
-        "audio/x-gsm; "
-
-//        "application/ogg; "
-
-//        "audio/x-wav; "
-
-/*
-        "audio/x-raw-int, "
-        "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
-        "signed = (boolean) { true, false }, "
-        "width = (int) 32, "
-        "depth = (int) 32, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, " QM(ROAR_MAX_CHANNELS) " ]; "
-*/
-
-/*
-        "audio/x-raw-int, "
-        "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
-        "signed = (boolean) { true, false }, "
-        "width = (int) 24, "
-        "depth = (int) 24, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, " QM(ROAR_MAX_CHANNELS) " ]; "
-*/
-
-        "audio/x-raw-int, "
-        "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
-        "signed = (boolean) { true, false }, "
-        "width = (int) 16, "
-        "depth = (int) 16, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, " QM(ROAR_MAX_CHANNELS) " ]; "
-
-        "audio/x-raw-int, "
-        "signed = (boolean) { true, false }, "
-        "width = (int) 8, "
-        "depth = (int) 8, "
-        "rate = (int) [ 1, MAX ], "
-        "channels = (int) [ 1, " QM(ROAR_MAX_CHANNELS) " ]"
-       )
-    );
-
-#undef _QM
-#undef  QM
-
-static void gst_roarsink_finalize (GObject * object);
-
-static GstCaps *gst_roarsink_getcaps (GstBaseSink * bsink);
-
-static gboolean gst_roarsink_open (GstAudioSink * asink);
-static gboolean gst_roarsink_close (GstAudioSink * asink);
-static gboolean gst_roarsink_prepare (GstAudioSink * asink,
-    GstRingBufferSpec * spec);
-static gboolean gst_roarsink_unprepare (GstAudioSink * asink);
-static guint gst_roarsink_write (GstAudioSink * asink, gpointer data,
-    guint length);
-static guint gst_roarsink_delay (GstAudioSink * asink);
-static void gst_roarsink_reset (GstAudioSink * asink);
-
-static void gst_roarsink_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_roarsink_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-GST_BOILERPLATE (GstRoarSink, gst_roarsink, GstAudioSink, GST_TYPE_AUDIO_SINK);
-
-static void gst_roarsink_base_init (gpointer g_class) {
-  GstElementClass *element_class = GST_ELEMENT_CLASS(g_class);
-
-  gst_element_class_add_pad_template(element_class,
-      gst_static_pad_template_get(&sink_factory));
-  gst_element_class_set_details(element_class, &roarsink_details);
-}
-
-static void gst_roarsink_class_init (GstRoarSinkClass * klass) {
-  GObjectClass *gobject_class;
-  GstBaseSinkClass *gstbasesink_class;
-  GstBaseAudioSinkClass *gstbaseaudiosink_class;
-  GstAudioSinkClass *gstaudiosink_class;
-
-  gobject_class          = (GObjectClass *) klass;
-  gstbasesink_class      = (GstBaseSinkClass *) klass;
-  gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
-  gstaudiosink_class     = (GstAudioSinkClass *) klass;
-
-  parent_class = g_type_class_peek_parent(klass);
-
-  gobject_class->finalize = gst_roarsink_finalize;
-
-  gstbasesink_class->get_caps   = GST_DEBUG_FUNCPTR(gst_roarsink_getcaps);
-
-  gstaudiosink_class->open      = GST_DEBUG_FUNCPTR(gst_roarsink_open);
-  gstaudiosink_class->close     = GST_DEBUG_FUNCPTR(gst_roarsink_close);
-  gstaudiosink_class->prepare   = GST_DEBUG_FUNCPTR(gst_roarsink_prepare);
-  gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR(gst_roarsink_unprepare);
-  gstaudiosink_class->write     = GST_DEBUG_FUNCPTR(gst_roarsink_write);
-  gstaudiosink_class->delay     = GST_DEBUG_FUNCPTR(gst_roarsink_delay);
-  gstaudiosink_class->reset     = GST_DEBUG_FUNCPTR(gst_roarsink_reset);
-
-  gobject_class->set_property   = gst_roarsink_set_property;
-  gobject_class->get_property   = gst_roarsink_get_property;
-
-  /* default value is filled in the _init method */
-  g_object_class_install_property(gobject_class, PROP_HOST,
-      g_param_spec_string("host", "Host",
-          "The server/host running the RoarAudio daemon", NULL, G_PARAM_READWRITE));
-  g_object_class_install_property(gobject_class, PROP_HOST,
-      g_param_spec_string("server", "Server",
-          "The server/host running the RoarAudio daemon", NULL, G_PARAM_READWRITE));
-  g_object_class_install_property(gobject_class, PROP_ROLE,
-      g_param_spec_string("role", "Role",
-          "The stream role", NULL, G_PARAM_READWRITE));
-  g_object_class_install_property(gobject_class, PROP_VOLUME,
-      g_param_spec_float("volume", "Volume",
-          "The stream volume (0.0 to 1.0)", 0.0, 1.0, 1.0, G_PARAM_READWRITE));
-  g_object_class_install_property(gobject_class, PROP_MUTE,
-      g_param_spec_boolean("mute", "Mute",
-          "The mute state of the stream", FALSE, G_PARAM_READWRITE));
-}
-
-static void gst_roarsink_init (GstRoarSink * roarsink, GstRoarSinkClass * klass) {
-  roarsink->vss    = NULL;
-  roarsink->host   = NULL;
-  roarsink->role   = NULL;
-  roarsink->volume = -1;
-  roarsink->mute   = ROAR_VS_ASK;
-}
-
-static void gst_roarsink_finalize (GObject * object) {
-  GstRoarSink *roarsink = GST_ROARSINK(object);
-
-  gst_caps_replace(&roarsink->cur_caps, NULL);
-  if ( roarsink->host != NULL )
-   g_free(roarsink->host);
-  if ( roarsink->role != NULL )
-   g_free(roarsink->role);
-
-  G_OBJECT_CLASS(parent_class)->finalize(object);
-}
-
-static GstCaps * gst_roarsink_getcaps (GstBaseSink * bsink) {
-  GstRoarSink *roarsink;
-
-  roarsink = GST_ROARSINK(bsink);
-
-  /* no fd, we're done with the template caps */
-  if (roarsink->vss == NULL || roarsink->cur_caps == NULL) {
-    GST_LOG_OBJECT(roarsink, "getcaps called, returning template caps");
-    return NULL;
-  }
-
-  GST_LOG_OBJECT(roarsink, "returning %" GST_PTR_FORMAT, roarsink->cur_caps);
-
-  return gst_caps_ref(roarsink->cur_caps);
-}
-
-static gboolean gst_roarsink_open(GstAudioSink * asink) {
-  GstPadTemplate *pad_template;
-  GstRoarSink *roarsink;
-  gint i;
-  struct roar_stream oinfo;
-
-  roarsink = GST_ROARSINK(asink);
-
-  GST_DEBUG_OBJECT(roarsink, "open");
-
-  /* now try to connect to any existing/running sound daemons */
-  if ( (roarsink->vss = roar_vs_new(roarsink->host, "gstreamer client", NULL)) == NULL )
-    goto couldnt_connect;
-
-  if ( roar_server_oinfo(roar_vs_connection_obj(roarsink->vss, NULL), &oinfo, ROAR_DIR_PLAY) == -1 )
-    goto no_server_info;
-
-  GST_INFO_OBJECT(roarsink, "got server info rate: %i", oinfo.info.rate);
-
-  pad_template = gst_static_pad_template_get(&sink_factory);
-  roarsink->cur_caps = gst_caps_copy(gst_pad_template_get_caps(pad_template));
-
-  for (i = 0; i < roarsink->cur_caps->structs->len; i++) {
-    GstStructure *s;
-
-    s = gst_caps_get_structure(roarsink->cur_caps, i);
-    gst_structure_set(s, "rate", G_TYPE_INT, oinfo.info.rate, NULL);
-  }
-
-  GST_INFO_OBJECT(roarsink, "server caps: %" GST_PTR_FORMAT, roarsink->cur_caps);
-
-  return TRUE;
-
-  /* ERRORS */
-couldnt_connect:
-  {
-    GST_ELEMENT_ERROR(roarsink, RESOURCE, OPEN_WRITE,
-        (_("Could not establish connection to sound server")),
-        ("can't open connection to RoarAudio server"));
-    return FALSE;
-  }
-no_server_info:
-  {
-    GST_ELEMENT_ERROR(roarsink, RESOURCE, OPEN_WRITE,
-        (_("Failed to query sound server capabilities")),
-        ("couldn't get server info!"));
-    return FALSE;
-  }
-}
-
-static gboolean gst_roarsink_close (GstAudioSink * asink) {
-  GstRoarSink *roarsink = GST_ROARSINK(asink);
-
-  GST_DEBUG_OBJECT(roarsink, "close");
-
-  gst_caps_replace(&roarsink->cur_caps, NULL);
-
-  roar_vs_close(roarsink->vss, ROAR_VS_FALSE, NULL);
-  roarsink->vss = NULL;
-
-  return TRUE;
-}
-
-static gboolean gst_roarsink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) {
-  GstRoarSink *roarsink = GST_ROARSINK(asink);
-  struct roar_audio_info info;
-
-  info.codec    = ROAR_CODEC_DEFAULT;
-  info.bits     = spec->depth;
-  info.rate     = spec->rate;
-  info.channels = spec->channels;
-
-  GST_DEBUG_OBJECT(roarsink, "prepare");
-
-  
-  GST_INFO_OBJECT(roarsink, "attempting to open data connection to RoarAudio server");
-
-  switch (spec->type) {
-   case GST_BUFTYPE_LINEAR:
-     switch (spec->sign) {
-      case TRUE:
-        switch (spec->bigend) {
-         case TRUE:  info.codec = ROAR_CODEC_PCM_S_BE; break;
-         case FALSE: info.codec = ROAR_CODEC_PCM_S_LE; break;
-         default: return FALSE; break;
-        }
-       break;
-      case FALSE:
-        switch (spec->bigend) {
-         case TRUE:  info.codec = ROAR_CODEC_PCM_U_BE; break;
-         case FALSE: info.codec = ROAR_CODEC_PCM_U_LE; break;
-         default: return FALSE; break;
-        }
-       break;
-      default: return FALSE; break;
-     }
-    break;
-   case GST_BUFTYPE_A_LAW:
-     info.codec = ROAR_CODEC_ALAW;
-     info.bits  = 8;
-    break;
-   case GST_BUFTYPE_MU_LAW:
-     info.codec = ROAR_CODEC_MULAW;
-     info.bits  = 8;
-    break;
-   case GST_BUFTYPE_GSM:
-     info.codec = ROAR_CODEC_GSM;
-     info.bits  = 0;
-    break;
-   default:
-     return FALSE;
-  }
-
-  if ( roar_vs_stream(roarsink->vss, &info, ROAR_DIR_PLAY, NULL) == -1 )
-    goto cannot_open;
-
-  // apply parameters:
-  if ( roarsink->mute != ROAR_VS_ASK && roar_vs_mute(roarsink->vss, roarsink->mute, NULL) == -1 ) {
-    goto cannot_open;
-  }
-  if ( roarsink->volume >= 0.0 && roar_vs_volume_mono(roarsink->vss, roarsink->volume, NULL) == -1 ) {
-    goto cannot_open;
-  }
-
-  /* get server info */
-  spec->segsize  = ROAR_BUF_SIZE;
-  spec->segtotal = (ROAR_MAX_WRITE_SIZE / spec->segsize);
-
-  /* FIXME: this is wrong for signed ints (and the
-   * audioringbuffers should do it for us anyway) */
-  spec->bytes_per_sample = roar_info2framesize(&info) / 8;
-  memset(&(spec->silence_sample), 0, sizeof(spec->silence_sample));
-
-  GST_INFO_OBJECT(roarsink, "successfully opened connection to RoarAudio server");
-
-  return TRUE;
-
-  /* ERRORS */
-cannot_open:
-  {
-    GST_ELEMENT_ERROR(roarsink, RESOURCE, OPEN_WRITE,
-        (_("Could not establish connection to sound server")),
-        ("can't open connection to RoarAudio server"));
-    return FALSE;
-  }
-}
-
-static gboolean gst_roarsink_unprepare (GstAudioSink * asink) {
-  GstRoarSink *roarsink = GST_ROARSINK(asink);
-
-  if (roarsink->vss == NULL)
-    return TRUE;
-
-  roar_vs_close(roarsink->vss, ROAR_VS_FALSE, NULL);
-  roarsink->vss = NULL;
-
-  GST_INFO_OBJECT(roarsink, "closed sound device");
-
-  return TRUE;
-}
-
-
-static guint gst_roarsink_write (GstAudioSink * asink, gpointer data, guint length) {
-  GstRoarSink *roarsink = GST_ROARSINK(asink);
-  gint to_write = 0;
-
-  to_write = length;
-
-  while (to_write > 0) {
-    ssize_t done;
-
-    done = roar_vs_write(roarsink->vss, data, to_write, NULL);
-
-    if (done < 0)
-      goto write_error;
-
-    to_write -= done;
-    data += done;
-  }
-  return length;
-
-  /* ERRORS */
-write_error:
-  {
-    GST_ELEMENT_ERROR(roarsink, RESOURCE, WRITE,
-        ("Failed to write data to the RoarAudio daemon"), GST_ERROR_SYSTEM);
-    return 0;
-  }
-}
-
-static guint gst_roarsink_delay (GstAudioSink * asink) {
-//  GstRoarSink *roarsink = GST_ROARSINK (asink);
-  guint latency;
-
-  latency = 441; // compile type depending and link level deppendent,
-                 // use default value for local operations here for the moment
-
-  GST_DEBUG_OBJECT(asink, "got latency: %u", latency);
-
-  return latency;
-}
-
-static void gst_roarsink_reset (GstAudioSink * asink) {
-  GST_DEBUG_OBJECT(asink, "reset called");
-}
-
-static void gst_roarsink_set_property (GObject * object, guint prop_id, const GValue * value,
-                                       GParamSpec * pspec) {
-  GstRoarSink *roarsink = GST_ROARSINK(object);
-
-  switch (prop_id) {
-    case PROP_HOST:
-      if ( roarsink->host != NULL )
-       g_free(roarsink->host);
-      roarsink->host = g_value_dup_string(value);
-     break;
-    case PROP_ROLE:
-      if ( roarsink->role != NULL )
-       g_free(roarsink->role);
-      roarsink->role = g_value_dup_string(value);
-     break;
-    case PROP_VOLUME:
-      roarsink->volume = (float)g_value_get_float(value);
-
-      if ( roarsink->vss == NULL )
-       return;
-
-      roar_vs_volume_mono(roarsink->vss, roarsink->volume, NULL);
-     break;
-    case PROP_MUTE:
-      if ( g_value_get_boolean(value) ) {
-       roarsink->mute = ROAR_VS_TRUE;
-      } else {
-       roarsink->mute = ROAR_VS_FALSE;
-      }
-
-      if ( roarsink->vss == NULL )
-       return;
-
-      roar_vs_mute(roarsink->vss, roarsink->mute, NULL);
-     break;
-    default:
-      break;
-  }
-}
-
-static void gst_roarsink_get_property (GObject * object, guint prop_id, GValue * value,
-                                       GParamSpec * pspec) {
-  GstRoarSink *roarsink = GST_ROARSINK(object);
-  float l, r;
-  int ret;
-
-  switch (prop_id) {
-    case PROP_HOST:
-      g_value_set_string(value, roarsink->host);
-     break;
-    case PROP_ROLE:
-      g_value_set_string(value, roarsink->role);
-     break;
-    case PROP_VOLUME:
-      if ( roarsink->vss == NULL || roar_vs_volume_get(roarsink->vss, &l, &r, NULL) == -1 ) {
-       l = roarsink->volume >= 0.0 ? roarsink->volume : 1.0;
-      } else {
-       l = (l + r)/2;
-       roarsink->volume = l;
-      }
-      g_value_set_float(value, l);
-     break;
-    case PROP_MUTE:
-      if ( roarsink->vss == NULL || (ret = roar_vs_mute(roarsink->vss, ROAR_VS_ASK, NULL)) == -1 ) {
-       ret = roarsink->mute != ROAR_VS_ASK ? roarsink->mute : ROAR_VS_FALSE;
-      } else {
-       roarsink->mute = ret;
-      }
-
-      g_value_set_boolean(value, ret == ROAR_VS_TRUE ? TRUE : FALSE);
-     break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-     break;
-  }
-}
-
-gboolean gst_roarsink_factory_init (GstPlugin * plugin) {
-  if (!gst_element_register(plugin, "roarsink", GST_RANK_MARGINAL,
-                            GST_TYPE_ROARSINK))
-    return FALSE;
-
-  return TRUE;
-}
Index: plugins/gstreamer0.10/roarsink.h
===================================================================
--- plugins/gstreamer0.10/roarsink.h	(revision 6052)
+++ 	(revision )
@@ -1,78 +1,0 @@
-//roarsink.h:
-/* GStreamer
- * Copyright (C) <2005>      Arwed v. Merkatz <v.merkatz@gmx.net>
- * Copyright (C) <2008-2015> Philipp 'ph3-der-loewe' Schafft
- *                                    <lion@lion.leolix.org>
- *
- * roarsink.h: an RoarAudio audio sink
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_ROARSINK_H__
-#define __GST_ROARSINK_H__
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosink.h>
-#include <roaraudio.h>
-
-#define VERSION "0.0.1"
-#define PACKAGE "gst-plugins"
-#define GST_PACKAGE_ORIGIN "Unknown package origin"
-#define GST_PACKAGE_NAME "GStreamer Plug-ins source release"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_ROARSINK \
-  (gst_roarsink_get_type())
-#define GST_ROARSINK(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ROARSINK,GstRoarSink))
-#define GST_ROARSINK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ROARSINK,GstRoarSinkClass))
-#define GST_IS_ROARSINK(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ROARSINK))
-#define GST_IS_ROARSINK_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ROARSINK))
-
-typedef struct _GstRoarSink GstRoarSink;
-typedef struct _GstRoarSinkClass GstRoarSinkClass;
-
-struct _GstRoarSink {
-  GstAudioSink   sink;
-
-  roar_vs_t * vss;
-
-  gchar    *host;
-  gchar    *role;
-
-  float     volume;
-  int       mute;
-
-  GstCaps  *cur_caps;
-};
-
-struct _GstRoarSinkClass {
-  GstAudioSinkClass parent_class;
-};
-
-GType gst_roarsink_get_type(void);
-gboolean gst_roarsink_factory_init (GstPlugin *plugin);
-
-
-G_END_DECLS
-
-#endif /* __GST_ROARSINK_H__ */
Index: plugins/mplayer/ao_roar.c
===================================================================
--- plugins/mplayer/ao_roar.c	(revision 6052)
+++ 	(revision )
@@ -1,222 +1,0 @@
-//ao_roar.c:
-/*
- * ao_roar - RoarAudio audio output driver for MPlayer
- *
- * copyright (c) 2002 Juergen Keil <jk@tools.de>
- * copyright (c) 2008-2015 Philipp 'ph3-der-loewe' Schafft
- *
- * This file is part of RoarAudio, based on a file from MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <time.h>
-#ifdef	__svr4__
-#include <stropts.h>
-#endif
-#include <roaraudio.h>
-
-#include "config.h"
-#include "audio_out.h"
-#include "audio_out_internal.h"
-#include "libaf/af_format.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-
-
-#undef	ESD_DEBUG
-
-#if	ESD_DEBUG
-#define	dprintf(...)	printf(__VA_ARGS__)
-#else
-#define	dprintf(...)	/**/
-#endif
-
-
-#define	ROAR_CLIENT_NAME	"MPlayer"
-
-static struct roar_connection  roar_con;
-static struct roar_stream      roar_stream;
-static struct roar_stream_info roar_info;
-static int                     roar_fh;
-
-static ao_info_t info =
-{
-    "RoarAudio audio output",
-    "roar",
-    "Philipp 'ph3-der-loewe' Schafft <lion@lion.leolix.org>",
-    ""
-};
-
-LIBAO_EXTERN(roar)
-
-/*
- * to set/get/query special features/parameters
- */
-static int control(int cmd, void *arg)
-{
-    switch (cmd) {
-    case AOCONTROL_GET_VOLUME:
-    case AOCONTROL_SET_VOLUME:
-      return CONTROL_OK;
-    default:
-      return CONTROL_UNKNOWN;
-    }
-}
-
-
-/*
- * open & setup audio device
- * return: 1=success 0=fail
- */
-static int init(int rate_hz, int channels, int format, int flags) {
- int codec = ROAR_CODEC_DEFAULT;
- int bits  = 16;
-
- if ( roar_simple_connect(&roar_con, NULL, ROAR_CLIENT_NAME) == -1 )
-  return 0;
-
- switch (format) {
-  case AF_FORMAT_S8:
-   bits = 8;
-   break;
-  case AF_FORMAT_U8:
-   bits  = 8;
-   codec = ROAR_CODEC_PCM_U_LE;
-   break;
- }
-
- if ( (roar_fh = roar_simple_new_stream_obj(&roar_con, &roar_stream, rate_hz, channels, bits, codec, ROAR_DIR_PLAY)) == -1 )
-  return 0;
-
- if ( roar_stream_get_info(&roar_con, &roar_stream, &roar_info) == -1 ) {
-  close(roar_fh);
-  return 0;
- }
-
- roar_socket_nonblock(roar_fh, ROAR_SOCKET_NONBLOCK);
-
- return 1;
-}
-
-
-/*
- * close audio device
- */
-static void uninit(int immed) {
- if ( roar_fh != -1 )
-  close(roar_fh);
-
- roar_fh = -1;
-
- roar_disconnect(&roar_con);
-}
-
-
-/*
- * plays 'len' bytes of 'data'
- * it should round it down to outburst*n
- * return: number of bytes played
- */
-static int play(void* data, int len, int flags) {
- int pkg  = 441*2*2;
- int ret  = 0;
- int r;
-
- while (len > 0) {
-  if ( (r = write(roar_fh, data, pkg < len ? pkg : len)) > 0 ) {
-   len  -= r;
-   data += r;
-   ret  += r;
-  } else {
-   break;
-  }
- }
-
-// ROAR_WARN("play(*) = %i", ret);
-
- return ret;
-}
-
-
-/*
- * stop playing, keep buffers (for pause)
- */
-static void audio_pause(void)
-{
-    /*
-     * not possible with esd.  the esd daemom will continue playing
-     * buffered data (not more than ESD_MAX_DELAY seconds of samples)
-     */
-}
-
-
-/*
- * resume playing, after audio_pause()
- */
-static void audio_resume(void)
-{
-    /*
-     * not possible with esd.
-     *
-     * Let's hope the pause was long enough that the esd ran out of
-     * buffered data;  we restart our time based delay computation
-     * for an audio resume.
-     */
-}
-
-
-/*
- * stop playing and empty buffers (for seeking/pause)
- */
-static void reset(void) {
-}
-
-
-/*
- * return: how many bytes can be played without blocking
- */
-static int get_space(void) {
- fd_set sl;
- struct timeval tv;
- int r;
-
- FD_ZERO(&sl);
- FD_SET(roar_fh, &sl);
-
- tv.tv_sec  = 0;
- tv.tv_usec = 1;
-
- if ((r = select(roar_fh + 1, NULL, &sl, NULL, &tv)) > 0) {
-  return roar_info.block_size;
- }
- return 0;
-}
-
-
-/*
- * return: delay in seconds between first and last sample in buffer
- */
-static float get_delay(void) {
- return 0.02;
-}
Index: plugins/roard/Makefile
===================================================================
--- plugins/roard/Makefile	(revision 6017)
+++ 	(revision )
@@ -1,28 +1,0 @@
-include ../../Makefile.conf
-include ../../Makefile.inc
-
-TARGETS_PROTO=protocol-irc protocol-esound protocol-rplay protocol-gopher
-TARGETS_DMX=dmx-waveform
-TARGETS_SERVICE=service-client
-TARGETS_MISC=listenpty
-TARGETS__NAMES=$(TARGETS_PROTO) $(TARGETS_SERVICE) $(TARGETS_DMX) $(TARGETS_MISC)
-TARGETS       = $(foreach c,$(TARGETS__NAMES),$c$(SHARED_SUFFIX))
-
-#DEFINES        = -DDEBUG
-INCLUDE = -I../../include -I../..
-CFLAGS += $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) $(DEFINES) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) $(SHARED) -L../../lib $(LDPATH)
-LIBS    = $(LIBROAR)
-
-all: ${TARGETS}
-clean:
-	rm -f ${TARGETS} *.o
-new: clean all
-
-install: all
-	cp $(cp_v) ${TARGETS} '$(DESTDIR)$(PREFIX_PLUGINS)/$(DEV_VENDOR)-$(DEV_VENDOR_NAME)/roard/$(DEV_VENDOR)-$(DEV_VENDOR_NAME)/'
-semi-install: all
-	sh -c 'set -e; for file in *$(SHARED_SUFFIX); do ln -fs `pwd`/$$file '$(DESTDIR)$(PREFIX_PLUGINS)/$(DEV_VENDOR)-$(DEV_VENDOR_NAME)/roard/$(DEV_VENDOR)-$(DEV_VENDOR_NAME)/'; done'
-
-%$(SHARED_SUFFIX): %.o
-	$(CC) $(LDFLAGS) -o $@ $+ $(LIBS)
Index: plugins/roard/dmx-i2c.c
===================================================================
--- plugins/roard/dmx-i2c.c	(revision 6052)
+++ 	(revision )
@@ -1,165 +1,0 @@
-//dmx-i2c.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-#include <sys/ioctl.h>
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
-
-#define DEFAULT_DEVICE "/dev/i2c-1"
-#define DEFAULT_SLAVE  0x58
-
-#define ADDR_COMMAND   2
-#define ADDR_BANK      4
-#define ADDR_DATA      5
-
-#define COMMAND_DMX    0x3f
-
-struct state {
- size_t startaddr;
- size_t len;
- uint8_t slave;
- struct roar_vio_calls * vio;
-};
-
-static struct state * g_state;
-static struct state   g_state_init = {
- .startaddr =  0,
- .len       =  16,
- .slave     = DEFAULT_SLAVE,
- .vio       = NULL
-};
-
-static inline int __i2c_set_slave(void) {
- struct roar_vio_sysio_ioctl ctl = {.cmd = I2C_SLAVE, .argp = (void*)(int)g_state->slave};
-
- return roar_vio_ctl(g_state->vio, ROAR_VIO_CTL_SYSIO_IOCTL, &ctl);
-}
-static inline int __i2c_write(size_t off, const uint8_t value) {
- union i2c_smbus_data data = {.byte = value};
- struct i2c_smbus_ioctl_data args = {.read_write = I2C_SMBUS_WRITE, .command = off, .size = I2C_SMBUS_BYTE_DATA, .data = &data};
- struct roar_vio_sysio_ioctl ctl = {.cmd = I2C_SMBUS, .argp = &args};
-
- return roar_vio_ctl(g_state->vio, ROAR_VIO_CTL_SYSIO_IOCTL, &ctl);
-}
-
-static inline int __i2c_command(uint8_t command) {
- return __i2c_write(ADDR_COMMAND, command);
-}
-
-static inline int __i2c_start_dmx(void) {
- return __i2c_command(COMMAND_DMX);
-}
-
-static inline int __i2c_set_channel(size_t channel, uint8_t value) {
- size_t bank, offset;
-
- bank = channel/32;
- offset = bank*32;
-
- if ( __i2c_write(ADDR_BANK, bank) == -1 )
-  return -1;
-
- return __i2c_write(ADDR_DATA+channel-offset, value);
-}
-
-static int _init  (struct roar_dl_librarypara * para) {
- struct roar_keyval * p;
- const char * dev = DEFAULT_DEVICE;
-
- p = roar_keyval_lookup(para->argv, "startaddr", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->startaddr = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "len", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->len = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "slave", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->slave = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "device", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  dev = p->value;
-
- g_state->vio = roar_vio_open_dstr_simple_new(dev, ROAR_VIOF_READWRITE);
- if ( g_state->vio == NULL ) {
-  ROAR_ERR("_init(para=%p): Can not open device: %s: %s", para, dev, roar_errorstring);
-  return -1;
- }
-
- __i2c_set_slave();
-
- return 0;
-}
-
-static int _free  (struct roar_dl_librarypara * para) {
- (void)para;
- roar_vio_close(g_state->vio);
- g_state->vio = NULL;
- return 0;
-}
-
-static int _update  (struct roar_dl_librarypara * para) {
- size_t i;
- int val;
-
- (void)para;
-
- __i2c_start_dmx();
-
- for (i = 0; i < g_state->len; i++) {
-  val = light_dmxchannel_get(g_state->startaddr + i);
-  if ( val < 0 )
-   continue;
-  __i2c_set_channel(i, val);
- }
-
- return 0;
-}
-
-static struct roar_dl_appsched sched = {
- .init   = _init,
- .free   = _free,
- .update = _update,
- .tick   = NULL,
- .wait   = NULL
-};
-
-ROAR_DL_PLUGIN_START(dmx_waveform) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("dmx-i2c", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This plugin sends DMX data to RoarAudio DMX Transmitters using I²C");
-
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(g_state, g_state_init);
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched); 
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/roard/dmx-random.c
===================================================================
--- plugins/roard/dmx-random.c	(revision 6052)
+++ 	(revision )
@@ -1,141 +1,0 @@
-//dmx-random.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-struct channel {
- int32_t endsamp;
- int32_t cursamp;
- unsigned char startval, endval;
-};
-
-struct state {
- size_t startaddr;
- size_t len;
- int32_t samples_per_tick;
- struct channel * channels;
-};
-
-static struct state * g_state;
-static struct state   g_state_init = {
- .startaddr        = 0,
- .len              = 4,
- .samples_per_tick = 2, /* default: 2, good for fireflies, for moodlight 8 seems to be a better value */
- .channels         = NULL
-};
-
-
-static void calc_end(size_t index) {
- if ( g_state->channels[index].cursamp <= g_state->channels[index].endsamp )
-  return;
-
- g_state->channels[index].cursamp = 0;
- g_state->channels[index].endsamp = (int32_t)1 + (int32_t)roar_random_uint16() * g_state->samples_per_tick;
-
- g_state->channels[index].startval = g_state->channels[index].endval;
-
- if ( roar_random_uint16() < 32768 )
-  return;
-
- g_state->channels[index].endval = roar_random_uint16() & 0xE0;
-}
-
-static void calc_channel(size_t index) {
- // trel = cursamp/endsamp
- double trel = (double)g_state->channels[index].cursamp/(double)g_state->channels[index].endsamp;
- double valdiff = (double)(g_state->channels[index].endval - g_state->channels[index].startval)*trel;
- valdiff += (double)g_state->channels[index].startval;
- light_dmxchannel_set(g_state->startaddr + index, (unsigned char)(unsigned int)(int)valdiff);
-}
-
-static int _init  (struct roar_dl_librarypara * para) {
- struct roar_keyval * p;
-
- p = roar_keyval_lookup(para->argv, "startaddr", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->startaddr = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "len", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->len = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "samples-per-tick", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->samples_per_tick = atoi(p->value);
-
- g_state->channels = roar_mm_malloc(g_state->len*sizeof(struct channel));
- if ( g_state->channels == NULL )
-  return -1;
-
- memset(g_state->channels, 0, g_state->len*sizeof(struct channel));
-
- return 0;
-}
-
-static int _free  (struct roar_dl_librarypara * para) {
- (void)para;
-
- if ( g_state->channels != NULL )
-  roar_mm_free(g_state->channels);
- g_state->channels = NULL;
- return 0;
-}
-
-static int _update  (struct roar_dl_librarypara * para) {
- size_t i;
-
- (void)para;
-
- for (i = 0; i < g_state->len; i++) {
-  calc_end(i);
-  calc_channel(i);
-  g_state->channels[i].cursamp += ROAR_OUTPUT_BUFFER_SAMPLES;
- }
-
- return 0;
-}
-
-static struct roar_dl_appsched sched = {
- .init   = _init,
- .free   = _free,
- .update = _update,
- .tick   = NULL,
- .wait   = NULL
-};
-
-ROAR_DL_PLUGIN_START(dmx_random) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("dmx-random", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This generates random light effects using roard's DMX interface.");
-
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(g_state, g_state_init);
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched); 
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/roard/dmx-strobe.c
===================================================================
--- plugins/roard/dmx-strobe.c	(revision 6052)
+++ 	(revision )
@@ -1,165 +1,0 @@
-//dmx-strobe.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-struct state {
- // config:
- ssize_t channel_brightness;
- ssize_t channel_frequency;
- ssize_t channel_trigger;
- uint8_t brightness;
- uint8_t frequency;
-
- // runtime:
- uint8_t tigger_value;
- struct roar_subscriber * subscription_event;
-};
-
-static struct state * g_state;
-static struct state   g_state_init = {
- .channel_brightness = -1,
- .channel_frequency  = -1,
- .channel_trigger    = -1,
- .brightness         = 255,
- .frequency          = 64,
- .tigger_value       = 0
-};
-
-#define __set_XXX(type) \
-static void __set_##type (uint8_t val) { \
- ROAR_DBG("__set_%s(val=%i): channel=%li", #type, val, (long int)g_state->channel_##type); \
- if ( g_state->channel_##type != -1 ) \
-  light_dmxchannel_set(g_state->channel_##type, val); \
-}
-
-__set_XXX(brightness)
-__set_XXX(frequency)
-__set_XXX(trigger)
-
-static void __handle_event(uint8_t event) {
- switch (event) {
-  case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_BEAT:
-    g_state->tigger_value += 7; // prime value > 3 for maximum 'random' effect.
-    __set_trigger(g_state->tigger_value);
-   break;
-  case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_OFF:
-    __set_frequency(0);
-   break;
-  case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_ON:
-  case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_HOLD:
-    __set_brightness(g_state->brightness);
-    __set_frequency(g_state->frequency);
-   break;
- }
-}
-
-static int _init  (struct roar_dl_librarypara * para) {
- struct roar_keyval * p;
-
- p = roar_keyval_lookup(para->argv, "channel-brightness", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->channel_brightness = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "channel-frequency", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->channel_frequency = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "channel-trigger", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->channel_trigger = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "brightness", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->brightness = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "frequency", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->frequency = atoi(p->value);
-
- return 0;
-}
-
-static struct roar_dl_appsched sched = {
- .init   = _init,
- .free   = NULL,
- .update = NULL,
- .tick   = NULL,
- .wait   = NULL
-};
-
-static void cb_event(struct roar_notify_core * core, struct roar_event * event, void * userdata) {
- struct state * old = g_state;
-
- (void)core, (void)userdata;
-
- g_state = userdata;
-
- __handle_event(event->arg0);
-
- g_state = old;
-}
-
-static int init(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- struct roar_event event;
-
- (void)para, (void)lib;
-
- memset(&event, 0, sizeof(event));
-
- event.event = ROAR_DATA_DMX512_EVENT;
- event.emitter = -1;
- event.target = -1;
- event.target_type = ROAR_OT_STREAM;
-
- g_state->subscription_event = roar_notify_core_subscribe(NULL, &event, cb_event, g_state);
-
- return 0;
-}
-
-static int unload(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
-
- roar_notify_core_unsubscribe(NULL, g_state->subscription_event);
-
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(dmx_strobe) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("dmx-strobe", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Controls strobes using roard's DMX interface.");
-
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(g_state, g_state_init);
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched); 
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_INIT, init);
- ROAR_DL_PLUGIN_REG_UNLOAD(unload);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/roard/dmx-waveform.c
===================================================================
--- plugins/roard/dmx-waveform.c	(revision 6052)
+++ 	(revision )
@@ -1,209 +1,0 @@
-//dmx-waveform.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-#define SAMPLES_PER_TICK 2
-
-struct state {
- size_t startaddr;
- size_t len;
- int stream;
- struct roar_stream_server * ss;
-};
-
-static struct state * g_state;
-static struct state   g_state_init = {
- .startaddr =  0,
- .len       =  4,
- .stream    = -1,
- .ss        = NULL
-};
-
-static int16_t __get_chanval(struct state * self, size_t c, int pos) {
- int16_t ret = 0;
-
- if ( pos ) {
-  ret = light_dmxchannel_get(self->startaddr + c);
- } else {
-  if ( self->len & 1 ) {
-   ret = light_dmxchannel_get(self->startaddr + self->len - 1);
-  } else {
-   ret = light_dmxchannel_get(self->startaddr + self->len/2 + c);
-  }
- }
-
- if ( !pos )
-  ret *= -1;
-
- ret *= 127;
-
- ROAR_DBG("__get_chanval(self=%p, c=%lu, pos=%i) = %i", self, (long unsigned int)c, pos, (int)ret);
- return ret;
-}
-
-static ssize_t _vio_read   (struct roar_vio_calls * vio, void *buf, size_t count) {
- struct state * self = vio->inst;
- ssize_t samplesize = roar_info2samplesize(&(ROAR_STREAM(self->ss)->info)) / 8;
- ssize_t framesize = roar_info2framesize(&(ROAR_STREAM(self->ss)->info)) / 8;
- size_t i, c;
- int16_t * samp = buf;
- size_t zeros = 0;
-
- ROAR_DBG("_vio_read(vio=%p, buf=%p, count=%lu) = ?", vio, buf, (long unsigned int)count);
-
- if ( count % framesize ) {
-  roar_err_set(ROAR_ERROR_RANGE);
-  return -1;
- }
-
- framesize *= 2;
-
- if ( count % framesize ) {
-  zeros = count % framesize;
-  count -= zeros;
-  memset(buf+count, 0, zeros);
- }
-
- ROAR_DBG("_vio_read(vio=%p, buf=%p, count=%lu) = ?", vio, buf, (long unsigned int)count);
-
- for (i = 0; i < count/samplesize;) {
-  for (c = 0; c < ROAR_STREAM(self->ss)->info.channels; c++, i++)
-   samp[i] = __get_chanval(self, c, 1);
-  for (c = 0; c < ROAR_STREAM(self->ss)->info.channels; c++, i++)
-   samp[i] = __get_chanval(self, c, 0);
- }
-
- ROAR_DBG("_vio_read(vio=%p, buf=%p, count=%lu) = %lu", vio, buf, (long unsigned int)count, (long unsigned int)count);
-
- return count + zeros;
-}
-
-static int     _vio_ctl     (struct roar_vio_calls * vio, roar_vio_ctl_t cmd, void * data) {
- (void)vio, (void)data;
-
- if ( cmd == ROAR_VIO_CTL_NONBLOCK )
-  return 0;
-
- roar_err_set(ROAR_ERROR_BADRQC);
- return -1;
-}
-
-static int     _vio_close   (struct roar_vio_calls * vio) {
- struct state * self = vio->inst;
- self->stream = -1;
- self->ss     = NULL;
- return 0;
-}
-
-static int _init  (struct roar_dl_librarypara * para) {
- struct roar_keyval * p;
-
- p = roar_keyval_lookup(para->argv, "startaddr", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->startaddr = atoi(p->value);
-
- p = roar_keyval_lookup(para->argv, "len", para->argc, 1);
- if ( p != NULL && p->value != NULL )
-  g_state->len = atoi(p->value);
-
- if ((g_state->stream = streams_new()) == -1 )
-  return -1;
-
- if ( streams_get(g_state->stream, &(g_state->ss)) == -1 ) {
-  streams_delete(g_state->stream);
-  return -1;
- }
-
- if ( streams_set_dir(g_state->stream, ROAR_DIR_PLAY, 1) == -1 ) {
-  streams_delete(g_state->stream);
-  return -1;
- }
-
- if ( streams_set_name(g_state->stream, "DMX to Waveform bridge") == -1 ) {
-  streams_delete(g_state->stream);
-  return -1;
- }
-
- ROAR_STREAM(g_state->ss)->info = *g_sa;
- if ( g_state->len & 1 ) {
-  ROAR_STREAM(g_state->ss)->info.channels = g_state->len - 1;
- } else {
-  ROAR_STREAM(g_state->ss)->info.channels = g_state->len / 2;
- }
- ROAR_STREAM(g_state->ss)->info.bits = 16;
-
- roar_vio_clear_calls(&(g_state->ss->vio));
- g_state->ss->vio.inst  = g_state;
- g_state->ss->vio.read  = _vio_read;
- g_state->ss->vio.ctl   = _vio_ctl;
- g_state->ss->vio.close = _vio_close;
-
- streams_set_fh(g_state->stream, -2);
-
- client_stream_add(g_self_client, g_state->stream);
-
- return 0;
-}
-
-static int _free  (struct roar_dl_librarypara * para) {
- (void)para;
-
- if ( g_state->stream == -1 )
-  return 0;
-
- if ( streams_reset_flag(g_state->stream, ROAR_FLAG_IMMUTABLE) == -1 )
-  return -1;
-
- if ( streams_delete(g_state->stream) == -1 )
-  return -1;
-
- g_state->stream = -1;
-
- return 0;
-}
-
-static struct roar_dl_appsched sched = {
- .init   = _init,
- .free   = _free,
- .update = NULL,
- .tick   = NULL,
- .wait   = NULL
-};
-
-ROAR_DL_PLUGIN_START(dmx_waveform) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("dmx-waveform", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This renders DMX channels as waveform signals. This is helpful to drive LEDs with cheap PWM based sound devices.");
-
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(g_state, g_state_init);
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched); 
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/roard/listenpty.c
===================================================================
--- plugins/roard/listenpty.c	(revision 6052)
+++ 	(revision )
@@ -1,88 +1,0 @@
-//listenpty.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-#if defined(ROAR_HAVE_POSIX_OPENPT) && defined(ROAR_HAVE_GRANTPT) && defined(ROAR_HAVE_UNLOCKPT) && defined(ROAR_HAVE_TCGETATTR) && defined(ROAR_HAVE_TCSETATTR) && defined(ROAR_HAVE_CFMAKERAW)
-#define __HAVE_SUPPORT
-#endif
-
-#ifdef __HAVE_SUPPORT
-#include <termios.h>
-#endif
-
-static int init  (struct roar_dl_librarypara * para) {
-#ifdef __HAVE_SUPPORT
- int serverfh = posix_openpt(O_RDWR|O_NOCTTY);
- struct termios termios;
-
- (void)para;
-
- if ( serverfh == -1 ) {
-  ROAR_WARN("Can not open PTY Master: %s", strerror(errno));
-  return 0;
- }
-
- tcgetattr(serverfh, &termios);
- cfmakeraw(&termios);
- tcsetattr(serverfh, TCSANOW, &termios);
-
- grantpt(serverfh);
- unlockpt(serverfh);
-
- if ( clients_new_from_fh(serverfh, ROAR_PROTO_ROARAUDIO, ROAR_BYTEORDER_NETWORK, 0) == -1 ) {
-  close(serverfh);
-  return 0;
- }
-
- ROAR_WARN("PTY Slave: %s", ptsname(serverfh));
- return 0;
-#else
- ROAR_ERR("No PTY Support found so can not load listenpty plugin.");
- return -1;
-#endif
-}
-
-static struct roar_dl_appsched sched = {
- .init   = init,
- .free   = NULL,
- .update = NULL,
- .tick   = NULL,
- .wait   = NULL
-};
-
-ROAR_DL_PLUGIN_START(listenpty) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("listenpty", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This implements a listen socket using a PTY");
-
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched); 
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/roard/protocol-esound.c
===================================================================
--- plugins/roard/protocol-esound.c	(revision 6052)
+++ 	(revision )
@@ -1,595 +1,0 @@
-//emul_esd.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD
-#ifdef ROAR_HAVE_H_ESD
-#include <esd.h>
-
-
-struct emul_esd_command {
- int    cmd;
- size_t datalen;
-#if !defined(ROAR_TARGET_MICROCONTROLLER) && !defined(ROAR_MINIMAL)
- char name[COMMAND_MAX_NAMELEN];
-#else
- char * name;
-#endif
- int (*handler)(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-};
-
-static int emul_esd_exec_command  (int client, int cmd, struct roar_vio_calls * vio);
-static int emul_esd_check_client  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara);
-
-static int emul_esd_int_read_buf  (int client, int * data, void * buf);
-static int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio);
-static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio);
-static int emul_esd_test_byteorder(int client, void * data);
-
-static int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-static int emul_esd_on_stream     (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-static int emul_esd_on_latency    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-static int emul_esd_on_standby    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-
-static int emul_esd_on_stream_pan (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-
-static int emul_esd_on_server_info(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-
-static int emul_esd_on_all_info   (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio);
-
-
-
-#if !defined(ROAR_TARGET_MICROCONTROLLER) && !defined(ROAR_MINIMAL)
-#define _NAME(x) (x)
-#else
-#define _NAME(x) ((char*)NULL)
-#endif
-
-#define _cmd_t   int
-#define _INTSIZE sizeof(_cmd_t)
-
-#define _NOT_TO_IMPLEMENT    NULL
-#define _UNIMPLEMNTED_IN_ESD NULL
-#define _NEED_SAMPLE_SUPPORT NULL
-
-#define _ROAR2ESD(x) ((x)+1)
-#define _ESD2ROAR(x) ((x)-1)
-
-static struct emul_esd_command g_emul_esd_commands[] = {
- {ESD_PROTO_CONNECT,      ESD_KEY_LEN  +     _INTSIZE, _NAME("CONNECT"),      emul_esd_on_connect},
- {ESD_PROTO_LOCK,         ESD_KEY_LEN  +     _INTSIZE, _NAME("LOCK"),         NULL},
- {ESD_PROTO_UNLOCK,       ESD_KEY_LEN  +     _INTSIZE, _NAME("UNLOCK"),       NULL},
- {ESD_PROTO_STREAM_PLAY,  ESD_NAME_MAX + 2 * _INTSIZE, _NAME("STREAM_PLAY"),  emul_esd_on_stream},
- {ESD_PROTO_STREAM_REC,   ESD_NAME_MAX + 2 * _INTSIZE, _NAME("STREAM_REC"),   emul_esd_on_stream},
- {ESD_PROTO_STREAM_MON,   ESD_NAME_MAX + 2 * _INTSIZE, _NAME("STREAM_MON"),   emul_esd_on_stream},
- {ESD_PROTO_SAMPLE_CACHE, ESD_NAME_MAX + 3 * _INTSIZE, _NAME("SAMPLE_CACHE"), _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_SAMPLE_FREE,                     _INTSIZE, _NAME("SAMPLE_FREE"),  _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_SAMPLE_PLAY,                     _INTSIZE, _NAME("SAMPLE_PLAY"),  _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_SAMPLE_LOOP,                     _INTSIZE, _NAME("SAMPLE_LOOP"),  _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_SAMPLE_STOP,                     _INTSIZE, _NAME("SAMPLE_STOP"),  _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_SAMPLE_KILL,  0                          , _NAME("SAMPLE_KILL"),  _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_STANDBY,      ESD_KEY_LEN +      _INTSIZE, _NAME("STANDBY"),      emul_esd_on_standby},
- {ESD_PROTO_RESUME,       ESD_KEY_LEN +      _INTSIZE, _NAME("RESUME"),       emul_esd_on_standby},
- {ESD_PROTO_SAMPLE_GETID, ESD_NAME_MAX               , _NAME("SAMPLE_GETID"), _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_STREAM_FILT,  ESD_NAME_MAX + 2 * _INTSIZE, _NAME("STREAM_FILT"),  emul_esd_on_stream},
- {ESD_PROTO_SERVER_INFO,                     _INTSIZE, _NAME("SERVER_INFO"),  emul_esd_on_server_info},
- {ESD_PROTO_ALL_INFO,                        _INTSIZE, _NAME("ALL_INFO"),     emul_esd_on_all_info},
- {ESD_PROTO_SUBSCRIBE,    0                          , _NAME("SUBSCRIBE"),    _UNIMPLEMNTED_IN_ESD},
- {ESD_PROTO_UNSUBSCRIBE,  0                          , _NAME("UNSUBSCRIBE"),  _UNIMPLEMNTED_IN_ESD},
- {ESD_PROTO_STREAM_PAN,                  3 * _INTSIZE, _NAME("STREAM_PAN"),   emul_esd_on_stream_pan},
- {ESD_PROTO_SAMPLE_PAN,                  3 * _INTSIZE, _NAME("SAMPLE_PAN"),   _NEED_SAMPLE_SUPPORT},
- {ESD_PROTO_STANDBY_MODE,                    _INTSIZE, _NAME("STANDBY_MODE"), emul_esd_on_standbymode},
- {ESD_PROTO_LATENCY,      0                          , _NAME("LATENCY"),      emul_esd_on_latency},
- {ESD_PROTO_MAX,          0                          , _NAME("MAX"),          _NOT_TO_IMPLEMENT},
- {-1, 0, _NAME("END OF LIST"), _NOT_TO_IMPLEMENT}
-};
-
-// command handling:
-static int emul_esd_exec_command(int client, int cmd, struct roar_vio_calls * vio) {
- struct emul_esd_command * cur;
- void * data = NULL;
- ssize_t ret;
- size_t  done = 0;
- int r;
- int i;
-
- ROAR_DBG("emul_esd_exec_command(*) = ?");
-
- if ( client == -1 || cmd < ESD_PROTO_CONNECT || cmd > ESD_PROTO_MAX || vio == NULL )
-  return -1;
-
- ROAR_DBG("emul_esd_exec_command(*) = ?");
-
- for (i = 0; (cur = &(g_emul_esd_commands[i]))->cmd != -1; i++) {
-  if ( cur->cmd == cmd ) {
-   if ( cur->datalen > 0 ) {
-    if ( (data = roar_mm_malloc(cur->datalen)) == NULL ) {
-     // we will do a protocol error in case we do not drop the client
-     return -1;
-    }
-
-    while ( done < cur->datalen ) {
-     ret = roar_vio_read(vio, data+done, cur->datalen-done);
-
-     if ( ret < 1 ) {
-      roar_mm_free(data);
-      return -1;
-     } else {
-      done += ret;
-     }
-    }
-   }
-
-   if ( cur->handler == NULL ) {
-    ROAR_WARN("emul_esd_exec_command(client=%i, cmd=%s(%i), vio=%p): client uses unimplemted command",
-               client, cur->name, cmd, vio
-             );
-    r = -1;
-   } else {
-    r = cur->handler(client, cur, data, vio);
-   }
-
-   if ( data != NULL )
-    roar_mm_free(data);
-
-   return r;
-  }
- }
-
- return -1;
-}
-
-static int emul_esd_set_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
-
- (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( emul_esd_exec_command(client, ESD_PROTO_CONNECT, vio) == -1 )
-  return -1;
-
- return 0;
-}
-
-static int emul_esd_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- _cmd_t cmd;
-
- (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( client == -1 )
-  return -1;
-
- if ( roar_vio_read(vio, &cmd, _INTSIZE) != _INTSIZE ) {
-  // really bad protocol error
-  return -1;
- }
-
- return emul_esd_exec_command(client, cmd, vio);
-}
-
-// porto lib:
-int emul_esd_int_read_buf  (int client, int * data, void * buf) {
- _cmd_t d;
-
- (void)client;
-
- if ( data == NULL || buf == NULL )
-  return -1;
-
- d = *(_cmd_t*)buf;
-
- *data = d;
-
- return 0;
-}
-
-static int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio) {
- _cmd_t d = data;
-
- (void)client;
-
- return roar_vio_write(vio, &d, _INTSIZE) == _INTSIZE ? 0 : -1;
-}
-
-static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio) {
- // accept all clients for the moment.
-
- (void)data;
-
- return emul_esd_int_write(client, 1, vio);
-}
-
-static int emul_esd_test_byteorder(int client, void * data) {
- struct roar_client * c;
-
- if ( clients_get(client, &c) == -1 )
-  return -1;
-
-// "NDNE";
-
- if ( !memcmp(data, "NDNE", 4) ) {
-  c->byteorder = ROAR_BYTEORDER_LE;
- } else if ( !memcmp(data, "ENDE", 4) ) {
-  c->byteorder = ROAR_BYTEORDER_BE;
- } else if ( !memcmp(data, "NEED", 4) ) {
-  c->byteorder = ROAR_BYTEORDER_PDP;
- } else {
-  return -1;
- }
-
- return 0;
-}
-
-// handler:
-static int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
-
- (void)cmd;
-
- ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio);
-
- if ( client == -1 || data == NULL || vio == NULL )
-  return -1;
-
- ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio);
-
- if ( emul_esd_test_auth(client, data, vio) == -1 )
-  return -1;
-
- ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio);
-
- if ( emul_esd_test_byteorder(client, data+ESD_KEY_LEN) == -1 )
-  return -1;
-
- ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio);
-
- return 0;
-}
-
-static int emul_esd_on_stream     (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- struct roar_stream_server * ss;
- struct roar_stream        *  s;
- struct roar_client        *  c;
- int stream;
- int dir = -1;
- int esdformat;
- int rate = 0;
-
- if ( client == -1 || cmd == NULL || data == NULL || vio == NULL )
-  return -1;
-
- switch (cmd->cmd) {
-  case ESD_PROTO_STREAM_PLAY: dir = ROAR_DIR_PLAY;    break;
-  case ESD_PROTO_STREAM_REC:  dir = ROAR_DIR_RECORD;  break;
-  case ESD_PROTO_STREAM_MON:  dir = ROAR_DIR_MONITOR; break;
-  case ESD_PROTO_STREAM_FILT: dir = ROAR_DIR_FILTER;  break;
-  default:
-    return -1;
- }
-
- if ( clients_get(client, &c) == -1 ) {
-  return -1;
- }
-
- ROAR_DBG("emul_esd_on_stream(client=%i, ...): creating stream...", client);
- if ((stream = streams_new()) == -1 ) {
-  return -1;
- }
-
- ROAR_DBG("emul_esd_on_stream(client=%i, ...): getting stream...", client);
- if ( streams_get(stream, &ss) == -1 ) {
-  streams_delete(stream);
-  return -1;
- }
-
- s = ROAR_STREAM(ss);
-
- ROAR_DBG("emul_esd_on_stream(client=%i, ...): set client of stream...", client);
- if ( client_stream_add(client, stream) == -1 ) {
-  streams_delete(stream);
-  return -1;
- }
-
- emul_esd_int_read_buf(client, &esdformat, data);
- emul_esd_int_read_buf(client, &rate,      data+_INTSIZE);
-
- strncpy(c->name, data + 2*_INTSIZE, ROAR_BUFFER_NAME > ESD_NAME_MAX ? ESD_NAME_MAX : ROAR_BUFFER_NAME);
- c->name[ROAR_BUFFER_NAME-1] = 0;
-
- ROAR_DBG("emul_esd_on_stream(*): esdformat=0x%.8X, rate=%i", esdformat, rate);
-
- s->info.rate = rate;
-
- switch (esdformat & ESD_MASK_BITS) {
-  case ESD_BITS8:  s->info.bits =  8; s->info.codec = ROAR_CODEC_PCM_U_LE; break;
-  case ESD_BITS16: s->info.bits = 16; s->info.codec = ROAR_CODEC_DEFAULT;  break;
-  default:
-    streams_delete(stream);
-    return -1;
- }
-
- switch (esdformat & ESD_MASK_CHAN) {
-  case ESD_MONO:   s->info.channels = 1; break;
-  case ESD_STEREO: s->info.channels = 2; break;
-  default:
-    streams_delete(stream);
-    return -1;
- }
-
- ss->codec_orgi = s->info.codec;
-
- ROAR_DBG("emul_esd_on_stream(*): s->info = {.rate=%i, .bits=%i, .channels=%i, .codec=%i}", s->info.rate, s->info.bits, s->info.channels, s->info.codec);
-
- if ( streams_set_dir(stream, dir, 1) == -1 ) {
-  return -1;
- }
-
- if ( client_stream_exec(client, stream) == -1 ) {
-  return -1;
- }
-
- return 0;
-}
-
-static int emul_esd_on_latency    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- int lag = ROAR_OUTPUT_CFREQ;
-
- (void)cmd, (void)data;
-
- lag *= 2.0 * 44100.0 / (float)g_sa->rate;
- 
- return emul_esd_int_write(client, lag, vio);
-}
-
-static int emul_esd_on_standby    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- int ok = 0;
-
- if ( emul_esd_test_auth(client, data, vio) == -1 ) {
-  return emul_esd_int_write(client, ok, vio);
- }
-
- ok = 1;
-
- if (cmd->cmd == ESD_PROTO_STANDBY) {
-  g_standby = 1;
- } else {
-  g_standby = 0;
- }
-
-
- return emul_esd_int_write(client, ok, vio);
-}
-
-static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- int mode = ESM_ERROR;
-
- (void)cmd, (void)data;
-
- if ( g_standby ) {
-  if ( g_autostandby ) {
-   mode = ESM_ON_AUTOSTANDBY;
-  } else {
-   mode = ESM_ON_STANDBY;
-  }
- } else {
-  mode = ESM_RUNNING;
- }
-
- return emul_esd_int_write(client, mode, vio);
-}
-
-static int emul_esd_on_stream_pan (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- struct roar_stream_server * ss;
- int stream = -1;
- int left = 256, right = 256;
- int ok = 0;
-
- (void)cmd;
-
- emul_esd_int_read_buf(client, &stream, data + 0*_INTSIZE);
- emul_esd_int_read_buf(client, &left,   data + 1*_INTSIZE);
- emul_esd_int_read_buf(client, &right,  data + 2*_INTSIZE);
-
- stream = _ESD2ROAR(stream);
-
- if ( streams_get(stream, &ss) != -1 ) {
-  ss->mixer.scale    = 256;
-  ss->mixer.mixer[0] = left;
-  ss->mixer.mixer[1] = right;
-  if ( streams_set_mixer(stream) != -1 )
-   ok = 1;
- }
-
- return emul_esd_int_write(client, ok, vio);
-}
-
-static int emul_esd_on_server_info(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- int version = 0;
- int rate    = g_sa->rate;
- int format  = 0;
-
- (void)cmd, (void)data;
-
- switch (g_sa->bits) {
-  case  8: format |= ESD_BITS8;  break;
-  case 16: format |= ESD_BITS16; break;
- }
-
- switch (g_sa->channels) {
-  case  1: format |= ESD_MONO;   break;
-  case  2: format |= ESD_STEREO; break;
- }
-
- if ( emul_esd_int_write(client, version, vio) == -1 )
-  return -1;
-
- if ( emul_esd_int_write(client, rate, vio) == -1 )
-  return -1;
-
- if ( emul_esd_int_write(client, format, vio) == -1 )
-  return -1;
-
- return 0;
-}
-
-static int emul_esd_on_all_info   (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
- struct roar_stream_server *   ss;
- struct roar_audio_info    * info;
- struct roar_client        *    c;
- char name[ESD_NAME_MAX];
- char * sname;
- int id, rate, left, right, format;
- int i;
-
- if ( emul_esd_on_server_info(client, cmd, data, vio) == -1 )
-  return -1;
-
- for (i = 0; i < (ROAR_STREAMS_MAX+2); i++) {
-  memset(name, 0, sizeof(name));
-
-  id   = rate  = format = 0;
-  left = right = 0;
-
-  if ( i >= ROAR_STREAMS_MAX ) {
-   id = -1;
-  } else {
-   if ( streams_get(i, &ss) == -1 )
-    continue;
-
-   switch (streams_get_dir(i)) {
-    case ROAR_DIR_PLAY:    format |= ESD_PLAY;    break;
-    case ROAR_DIR_MONITOR: format |= ESD_MONITOR; break;
-    case ROAR_DIR_RECORD:  format |= ESD_RECORD;  break;
-    default:               continue;              break;
-   }
-
-   info = &(ROAR_STREAM(ss)->info);
-
-   id = i;
-   rate = info->rate;
-
-   switch (info->bits) {
-    case  8: format |= ESD_BITS8;  break;
-    case 16: format |= ESD_BITS16; break;
-   }
-
-   switch (info->channels) {
-    case  1:
-      if ( ss->mixer.mixer[0] == ss->mixer.scale ) {
-       left = right = 256;
-      } else {
-       left = right = ss->mixer.mixer[0] * 256 / ss->mixer.scale;
-      }
-      format |= ESD_MONO;
-     break;
-    case  2:
-      if ( ss->mixer.mixer[0] == ss->mixer.scale ) {
-       left = 256;
-      } else {
-       left = ss->mixer.mixer[0] * 256 / ss->mixer.scale;
-      }
-
-      if ( ss->mixer.mixer[1] == ss->mixer.scale ) {
-       right = 256;
-      } else {
-       right = ss->mixer.mixer[1] * 256 / ss->mixer.scale;
-      }
-
-      format |= ESD_STEREO;
-     break;
-    default:
-      left = right = 0;
-   }
-
-   sname = streams_get_name(id);
-
-   if ( sname == NULL || sname[0] == 0 ) {
-    if ( clients_get(streams_get_client(id), &c) != -1 ) {
-     sname = c->name;
-    }
-   }
-
-   if ( sname == NULL || sname[0] == 0 )
-    sname = "(unknown)";
-
-   strncpy(name, sname, sizeof(name) > ROAR_BUFFER_NAME ? ROAR_BUFFER_NAME : sizeof(name));
-   name[sizeof(name)-1] = 0;
-
-  }
-
-  id = _ROAR2ESD(id);
-
-  if ( emul_esd_int_write(client, id, vio) == -1 )
-   return -1;
-  if ( roar_vio_write(vio, name, sizeof(name)) != sizeof(name) )
-   return -1;
-  if ( emul_esd_int_write(client, rate, vio) == -1 )
-   return -1;
-  if ( emul_esd_int_write(client, left, vio) == -1 )
-   return -1;
-  if ( emul_esd_int_write(client, right, vio) == -1 )
-   return -1;
-  if ( emul_esd_int_write(client, format, vio) == -1 )
-   return -1;
-
-  if ( i == ROAR_STREAMS_MAX+1) {
-   // write 'length'...
-   if ( emul_esd_int_write(client, id, vio) == -1 )
-    return -1;
-  }
- }
-
- return 0;
-}
-
-static struct roar_dl_proto __proto_common_esd = {
- .proto = ROAR_PROTO_ESOUND,
- .description = "EsounD emulation",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = emul_esd_set_proto,
- .handle = emul_esd_check_client
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_esd, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_esd) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-esd", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of the Enlightened Sound Daemon's protocol");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-#endif
-#endif
-
-//ll
Index: plugins/roard/protocol-gopher.c
===================================================================
--- plugins/roard/protocol-gopher.c	(revision 6052)
+++ 	(revision )
@@ -1,810 +1,0 @@
-//emul_gopher.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-#ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER
-#include <roaraudio/proto_gopher.h>
-
-#define _INFO  ROAR_GOPHER_TYPE_INFO
-#define _DIR   ROAR_GOPHER_TYPE_DIR
-#define _FILE  ROAR_GOPHER_TYPE_FILE
-#define _SOUND ROAR_GOPHER_TYPE_SOUND
-
-struct item;
-
-static int scb_status_txt (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_test       (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_clients    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_streams    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_client_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_stream_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_listen_menu(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-static int scb_listen     (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-
-static struct roar_gopher_menu_item g_gopher_root_menu[] = {
- {.type = _INFO, .name = "roard Root Menu"},
- {.type = _FILE, .name = "Server Info",   .selector = "/info.txt",   .host = NULL, .port = 0},
- {.type = _FILE, .name = "Server Status", .selector = "/status.txt", .host = NULL, .port = 0},
- {.type = _DIR,  .name = "Clients",       .selector = "/clients/",   .host = NULL, .port = 0},
- {.type = _DIR,  .name = "Streams",       .selector = "/streams/",   .host = NULL, .port = 0},
- {.type = _DIR,  .name = "Listen!",       .selector = "/listen/",    .host = NULL, .port = 0},
-};
-
-// need a true constant string.
-#define info_text \
- "This server is RoarAudio server (roard) with a small status gopher server\n" \
- "integrated. (For version and stuff see /status.txt.)\n" \
- "RoarAudio is a modern, multi OS, networed sound system.\n" \
- "For more information see http://roaraudio.keep-cool.org/\n"
-
-static struct item {
- const char * selector;
- char type;
- struct roar_gopher_menu menu;
- struct roar_audio_info  info;
- int dir;
- const char * text;
- int (*cb)(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
-} g_gopher_items[] = {
- {.selector = "", .type = _DIR,
-  .menu = {.items = g_gopher_root_menu, .items_len = sizeof(g_gopher_root_menu)/sizeof(*g_gopher_root_menu)},
-  .cb = NULL
- },
- // and again as selector '/' as some clients seems to require it:
- {.selector = "/", .type = _DIR,
-  .menu = {.items = g_gopher_root_menu, .items_len = sizeof(g_gopher_root_menu)/sizeof(*g_gopher_root_menu)},
-  .cb = NULL
- },
- {.selector = "/info.txt",   .type = _FILE, .text = info_text, .cb = NULL},
- {.selector = "/status.txt", .type = _FILE, .cb = scb_status_txt},
- {.selector = "/test/*",     .type = _FILE, .cb = scb_test},
- {.selector = "/clients/",   .type = _DIR,  .cb = scb_clients},
- {.selector = "/streams/",   .type = _DIR,  .cb = scb_streams},
- {.selector = "/clients/*/", .type = _DIR,  .cb = scb_client_info},
- {.selector = "/streams/*/", .type = _DIR,  .cb = scb_stream_info},
- {.selector = "/listen/",    .type = _DIR,  .cb = scb_listen_menu},
- {.selector = "/listen/*/*/*/*/*", .type = _FILE,  .cb = scb_listen}
-};
-
-static char * _aprintf(size_t sizehint, const char * format, ...);
-
-static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio, struct roar_buffer ** obuffer);
-static int send_text (const char * text, struct roar_buffer ** obuffer);
-
-
-// SCBs:
-static int scb_status_txt (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- const size_t len = 1024;
-
- (void)client, (void)vio, (void)selector, (void)text, (void)sitem, (void)obuffer;
-
- *text = roar_mm_malloc(len);
- if ( *text == NULL )
-  return -1;
-
- **text = 0;
-
- snprintf(*text, len,
-          "Host application:   %s\r\n"
-          "Host ABI:           %s\r\n"
-          "Server location:    %s\r\n"
-          "Server description: %s\r\n"
-          "\r\n"
-          "Counters current:   %" LIBROAR__ll "u clients, %" LIBROAR__ll "u streams\r\n"
-          "Counters sum:       %" LIBROAR__ll "u clients, %" LIBROAR__ll "u streams\r\n",
-          pluginpara->appname    == NULL ? "***unknown***" : pluginpara->appname,
-          pluginpara->abiversion == NULL ? "***unknown***" : pluginpara->abiversion,
-          g_config->location,
-          g_config->description,
-          (LIBROAR__longlong unsigned int)g_counters.cur.clients,
-          (LIBROAR__longlong unsigned int)g_counters.cur.streams,
-          (LIBROAR__longlong unsigned int)g_counters.sum.clients,
-          (LIBROAR__longlong unsigned int)g_counters.sum.streams
-         );
-
- (*text)[len-1] = 0;
- return 0;
-}
-
-static int scb_test(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- ssize_t toks;
- char * tok;
- size_t len;
-
- (void)client, (void)vio, (void)obuffer, (void)pluginpara;
-
- toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1);
-
- if ( toks == -1 )
-  return -1;
-
- len  = strlen(tok);
- len += 64;
-
- *text = roar_mm_malloc(len);
- if ( *text == NULL )
-  return -1;
-
- **text = 0;
-
- snprintf(*text, len, "Your text was: %s", tok);
-
- (*text)[len-1] = 0;
-
- return 0;
-}
-
-static int scb_clients    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- struct roar_gopher_menu_item items[ROAR_CLIENTS_MAX];
- struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
- struct roar_gopher_menu_item * item;
- struct roar_client_server * cs;
- struct roar_client        * c;
- const size_t len = 80;
- char * d;
- size_t i;
- int ret;
-
- (void)selector, (void)text, (void)sitem, (void)pluginpara;
-
- memset(items, 0, sizeof(items));
-
- for (i = 0; i < ROAR_CLIENTS_MAX; i++) {
-  if ( (c = ROAR_CLIENT((cs = g_clients[i]))) != NULL ) {
-   item = &(items[menu.items_len++]);
-   item->type = _DIR;
-   d = roar_mm_malloc(len);
-   if ( d == NULL ) {
-    menu.items_len--;
-    continue;
-   }
-   if ( c->name != NULL && c->name[0] != 0 ) {
-    snprintf(d, len, "Client %i: %s", (int)i, c->name);
-   } else {
-    snprintf(d, len, "Client %i", (int)i);
-   }
-   item->name = d;
-
-   d = roar_mm_malloc(len);
-   if ( d == NULL ) {
-    if ( item->name != NULL )
-     roar_mm_free((void*)item->name);
-    menu.items_len--;
-    continue;
-   }
-
-   snprintf(d, len, "/clients/%i/", (int)i);
-   item->selector = d;
-  }
- }
-
- ret = send_menu(client, &menu, vio, obuffer);
-
- for (i = 0; i < menu.items_len; i++) {
-  if ( items[i].name != NULL )
-   roar_mm_free((void*)items[i].name);
-  if ( items[i].selector != NULL )
-   roar_mm_free((void*)items[i].selector);
- }
-
- return ret;
-}
-
-static int scb_streams    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- struct roar_gopher_menu_item items[ROAR_STREAMS_MAX];
- struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
- struct roar_gopher_menu_item * item;
- struct roar_stream_server * ss;
- struct roar_stream        * s;
- const size_t len = 80;
- char * d;
- size_t i;
- int ret;
-
- (void)selector, (void)text, (void)sitem, (void)pluginpara;
-
- memset(items, 0, sizeof(items));
-
- for (i = 0; i < ROAR_STREAMS_MAX; i++) {
-  if ( (s = ROAR_STREAM((ss = g_streams[i]))) != NULL ) {
-   item = &(items[menu.items_len++]);
-   item->type = _DIR;
-   d = roar_mm_malloc(len);
-   if ( d == NULL ) {
-    menu.items_len--;
-    continue;
-   }
-   if ( ss->name != NULL && ss->name[0] != 0 ) {
-    snprintf(d, len, "Stream %i: %s", (int)i, ss->name);
-   } else {
-    snprintf(d, len, "Stream %i", (int)i);
-   }
-   item->name = d;
-
-   d = roar_mm_malloc(len);
-   if ( d == NULL ) {
-    if ( item->name != NULL )
-     roar_mm_free((void*)item->name);
-    menu.items_len--;
-    continue;
-   }
-
-   snprintf(d, len, "/streams/%i/", (int)i);
-   item->selector = d;
-  }
- }
-
- ret = send_menu(client, &menu, vio, obuffer);
-
- for (i = 0; i < menu.items_len; i++) {
-  if ( items[i].name != NULL )
-   roar_mm_free((void*)items[i].name);
-  if ( items[i].selector != NULL )
-   roar_mm_free((void*)items[i].selector);
- }
-
- return ret;
-}
-
-static int scb_client_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
-#define _MAX_ITEMS (16 + ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT)
- struct roar_gopher_menu_item items[_MAX_ITEMS];
- struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
- struct roar_gopher_menu_item * item;
- struct roar_client_server * cs;
- struct roar_client        * c;
- size_t i;
- int ret;
- ssize_t toks;
- char * tok;
- int id;
- char tmp[80];
-
- (void)text, (void)pluginpara;
-
- memset(items, 0, sizeof(items));
-
- toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1);
- if ( toks == -1 )
-  return -1;
-
- id = atoi(tok);
-
- if ( clients_get_server(id, &cs) == -1 )
-  return -1;
-
- c = ROAR_CLIENT(cs);
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- if ( c->name != NULL && c->name[0] != 0 ) {
-  item->name = _aprintf(64, "Client %i: %s", id, c->name);
- } else {
-  item->name = _aprintf(64, "Client %i", id);
- }
-
- if ( roar_nnode_get_socktype(&(c->nnode)) != ROAR_SOCKET_TYPE_UNKNOWN ) {
-  if ( roar_nnode_to_str(&(c->nnode), tmp, sizeof(tmp)) == 0 ) {
-   item = &(items[menu.items_len++]);
-   item->type = _INFO;
-   item->name = _aprintf(64, "Network node: %s", tmp);
-  }
- }
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- item->name = _aprintf(64, "Protocol: %s", roar_proto2str(c->proto));
-
- if ( c->execed != -1 ) {
-  item = &(items[menu.items_len++]);
-  item->type = _DIR;
-  item->name = _aprintf(64, "Exected Stream: %i", c->execed);
-  item->selector = _aprintf(64, "/streams/%i/", c->execed);
- }
-
- for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) {
-  if ( c->streams[i] != -1 ) {
-   item = &(items[menu.items_len++]);
-   item->type = _DIR;
-   item->name = _aprintf(64, "Stream: %i", c->streams[i]);
-   item->selector = _aprintf(64, "/streams/%i/", c->streams[i]);
-  }
- }
-
- ret = send_menu(client, &menu, vio, obuffer);
-
- for (i = 0; i < menu.items_len; i++) {
-  if ( items[i].name != NULL )
-   roar_mm_free((void*)items[i].name);
-  if ( items[i].selector != NULL )
-   roar_mm_free((void*)items[i].selector);
- }
-
-#undef _MAX_ITEMS
- return ret;
-}
-
-static int scb_stream_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
-#define _MAX_ITEMS 12
- struct roar_gopher_menu_item items[_MAX_ITEMS];
- struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
- struct roar_gopher_menu_item * item;
- struct roar_stream_server * ss;
- struct roar_stream        * s;
- size_t i;
- int ret;
- ssize_t toks;
- char * tok;
- int id;
-
- (void)text, (void)pluginpara;
-
- memset(items, 0, sizeof(items));
-
- toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1);
- if ( toks == -1 )
-  return -1;
-
- id = atoi(tok);
-
- if ( streams_get(id, &ss) == -1 )
-  return -1;
-
- s = ROAR_STREAM(ss);
-
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- if ( ss->name != NULL && ss->name[0] != 0 ) {
-  item->name = _aprintf(64, "Stream %i: %s", id, ss->name);
- } else {
-  item->name = _aprintf(64, "Stream %i", id);
- }
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- item->name = _aprintf(64, "Stream state: %s", roar_streamstate2str(ss->state));
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- item->name = _aprintf(64, "Stream direction: %s", roar_dir2str(s->dir));
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- item->name = _aprintf(128, "Signal info: rate:%iHz bits:%i channels:%i codec:%s",
-                            s->info.rate, s->info.bits, s->info.channels, roar_codec2str(s->info.codec));
-
- if ( ss->codec_orgi != ROAR_AUDIO_INFO_INVALID && ss->codec_orgi != s->info.codec ) {
-  item = &(items[menu.items_len++]);
-  item->type = _INFO;
-  item->name = _aprintf(64, "Streamed codec: %s", roar_codec2str(ss->codec_orgi));
- }
-
- if ( ss->role != -1 ) {
-  item = &(items[menu.items_len++]);
-  item->type = _INFO;
-  item->name = _aprintf(64, "Stream role: %s", roar_role2str(ss->role));
- }
-
- item = &(items[menu.items_len++]);
- item->type = _DIR;
- item->name = _aprintf(64, "Client: %i", ss->client);
- item->selector = _aprintf(64, "/clients/%i/", ss->client);
-
- ret = send_menu(client, &menu, vio, obuffer);
-
- for (i = 0; i < menu.items_len; i++) {
-  if ( items[i].name != NULL )
-   roar_mm_free((void*)items[i].name);
-  if ( items[i].selector != NULL )
-   roar_mm_free((void*)items[i].selector);
- }
-
-#undef _MAX_ITEMS
- return ret;
-}
-
-static int scb_listen_menu(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
-#define _MAX_ITEMS 12
- struct roar_gopher_menu_item items[_MAX_ITEMS];
- struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
- struct roar_gopher_menu_item * item;
- const char * codec;
- int ret;
- int codecs[] = {ROAR_CODEC_DEFAULT, ROAR_CODEC_RIFF_WAVE, ROAR_CODEC_AU, ROAR_CODEC_OGG_VORBIS};
- size_t i;
-
- (void)selector, (void)text, (void)sitem, (void)pluginpara;
-
- memset(items, 0, sizeof(items));
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- item->name = roar_mm_strdup("Select a format you want to listen in:");
-
- item = &(items[menu.items_len++]);
- item->type = _INFO;
- item->name = NULL; // empty lion
-
- for (i = 0; i < (sizeof(codecs)/sizeof(*codecs)); i++) {
-  item = &(items[menu.items_len++]);
-  item->type = _SOUND;
-  codec = roar_codec2str(codecs[i]);
-  item->name = _aprintf(64, "%u channels with %u bits at %uHz, %s",
-                            g_sa->channels, g_sa->bits, g_sa->rate, codec);
-  item->selector = _aprintf(64, "/listen/monitor/%u/%u/%u/%s", g_sa->rate, g_sa->bits, g_sa->channels, codec);
- }
-
- ret = send_menu(client, &menu, vio, obuffer);
-
- for (i = 0; i < menu.items_len; i++) {
-  if ( items[i].name != NULL )
-   roar_mm_free((void*)items[i].name);
-  if ( items[i].selector != NULL )
-   roar_mm_free((void*)items[i].selector);
- }
-
-#undef _MAX_ITEMS
- return ret;
-}
-
-static int scb_listen     (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- struct roar_stream_server * ss;
- struct roar_stream        * s;
- struct roar_audio_info info;
- int dir = -1;
- ssize_t toks;
- char * tok[5];
- int stream = -1;
-
- (void)vio, (void)text, (void)obuffer, (void)pluginpara;
-
- toks = roar_mm_strseltok(sitem->selector, selector, tok, 5);
-
- if ( toks != 5 )
-  return -1;
-
- memset(&info, 0, sizeof(info));
-
- if ( (dir = roar_str2dir(tok[0])) == -1 )
-  return -1;
-
- // test for unsupported dirs:
- switch (dir) {
-  case ROAR_DIR_THRU:
-  case ROAR_DIR_RAW_IN:
-  case ROAR_DIR_FILTER:
-    return -1;
-   break;
- }
-
- info.rate     = atoi(tok[1]);
- info.bits     = atoi(tok[2]);
- info.channels = atoi(tok[3]);
- info.codec    = roar_str2codec(tok[4]);
-
- if ( info.codec == ROAR_AUDIO_INFO_INVALID )
-  return -1;
-
- if ((stream = streams_new()) == -1 )
-  return -1;
-
- if ( streams_get(stream, &ss) == -1 ) {
-  streams_delete(stream);
-  return -1;
- }
-
- s = ROAR_STREAM(ss);
-
- if ( client_stream_add(client, stream) == -1 ) {
-  streams_delete(stream);
-  return -1;
- }
-
- memcpy(&(s->info), &info, sizeof(info));
- ss->codec_orgi = info.codec;
-
- if ( streams_set_dir(stream, dir, 1) == -1 ) {
-  streams_delete(stream);
-  return -1;
- }
-
- if ( client_stream_exec(client, stream) == -1 ) {
-  streams_delete(stream);
-  return -1;
- }
-
- return 0;
-}
-
-// other code:
-static int strip_nl (char * str) {
- register char c;
-
- for (; (c = *str) != 0; str++) {
-  if ( c == '\r' || c == '\n' ) {
-   *str = 0;
-   return 1;
-  }
- }
-
- return 0;
-}
-
-static char * _aprintf(size_t sizehint, const char * format, ...) {
- va_list ap;
- char * buf;
- int ret;
-
- sizehint += 128;
-
- if ( (buf = roar_mm_malloc(sizehint)) == NULL )
-  return NULL;
-
- va_start(ap, format);
- ret = vsnprintf(buf, sizehint, format, ap);
- va_end(ap);
-
- buf[sizehint-1] = 0;
-
- return buf;
-}
-
-static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio, struct roar_buffer ** obuffer) {
- struct roar_buffer * buf;
- struct roar_gopher_menu_item * item;
- const size_t len = 256;
- size_t i;
- void * data;
- char * chardata;
- const char * host;
- unsigned int port;
- struct roar_sockname sockaddr;
-
- (void)client;
-
- if ( roar_vio_ctl(vio, ROAR_VIO_CTL_GET_SOCKNAME, &sockaddr) == -1 ) {
-  memset(&sockaddr, 0, sizeof(sockaddr));
- }
-
- for (i = 0; i < menu->items_len; i++) {
-  item = &(menu->items[i]);
-  if ( roar_buffer_new_data(&buf, len, &data) == -1 ) {
-   if ( sockaddr.addr != NULL )
-    roar_mm_free(sockaddr.addr);
-   return -1;
-  } 
-
-  chardata = data;
-
-  switch (item->type) {
-   case _INFO:
-     snprintf(data, len-1, "i%s\tfake\t(NULL)\t0\r\n", item->name == NULL ? "" : item->name);
-    break;
-   default:
-     host = item->host == NULL ?               sockaddr.addr : item->host;
-     port = item->port ==    0 ? (unsigned int)sockaddr.port : item->port;
-     snprintf(data, len-1, "%c%s\t%s\t%s\t%u\r\n", item->type, item->name, item->selector, host, port);
-    break;
-  }
-
-  chardata[len-1] = 0;
-
-  if ( roar_buffer_set_len(buf, strlen(data)) == -1 ) {
-   roar_buffer_free(buf);
-   if ( sockaddr.addr != NULL )
-    roar_mm_free(sockaddr.addr);
-   return -1;
-  }
-
-  if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 ) {
-   roar_buffer_free(buf);
-   if ( sockaddr.addr != NULL )
-    roar_mm_free(sockaddr.addr);
-   return -1;
-  }
- }
-
- if ( sockaddr.addr != NULL )
-  roar_mm_free(sockaddr.addr);
-
- return 0;
-}
-
-static int send_text (const char * text, struct roar_buffer ** obuffer) {
- struct roar_buffer * buf;
- void * data;
- size_t len = strlen(text);
-
- if ( roar_buffer_new_data(&buf, len+6, &data) == -1 )
-  return -1;
-
- memcpy(data, text, len);
- //memcpy(data+len, "\r\n.\r\n\0", 6);
- memcpy(data+len, "\0", 1);
- if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 )
-  return -1;
-
- return 0;
-}
-
-static int emul_gopher_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct roar_client_server * cs;
- struct item * c = NULL;
- char inbuf[1024];
- ssize_t ret;
- size_t i;
- int funcret = -1;
- size_t len = 0;
- void * data;
- char * text;
-
- (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- if ( clients_get_server(client, &cs) == -1 ) {
-  return -1;
- }
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- if ( cs->inbuf != NULL ) {
-  len = sizeof(inbuf)-1;
-  if ( roar_buffer_shift_out(&(cs->inbuf), inbuf, &len) == -1 ) {
-   return -1;
-  }
-
-  if ( cs->inbuf != NULL ) {
-   roar_buffer_free(cs->inbuf);
-   return -1;
-  }
-
-  // test if we have still buffer space left.
-  if ( len == (sizeof(inbuf)-1) ) {
-   return -1;
-  }
- }
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- ret = roar_vio_read(vio, inbuf+len, sizeof(inbuf)-len-1);
- if ( ret < 1 ) {
-  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio);
-  return -1;
- }
-
- ret += len;
-
- inbuf[ret] = 0;
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- if ( !strip_nl(inbuf) ) {
-  if ( roar_buffer_new_data(&(cs->inbuf), ret, &data) == -1 ) {
-   ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio);
-   return -1;
-  }
-
-  memcpy(data, inbuf, ret);
-
-  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = 0", client, vio);
-
-  return 0;
- }
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- for (i = 0; i < sizeof(g_gopher_items)/sizeof(*g_gopher_items); i++) {
-//  if ( !roar_mm_strselcmp(g_gopher_items[i].selector, inbuf) ) {
-  if ( !roar_mm_strselcmp(g_gopher_items[i].selector, inbuf) ) {
-   c = &(g_gopher_items[i]);
-   break;
-  }
- }
-
- if ( c == NULL ) {
-  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio);
-  return -1;
- }
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- if ( c->cb != NULL ) {
-  text = NULL;
-  funcret = c->cb(client, vio, inbuf, &text, c, obuffer, pluginpara);
-
-  if ( funcret == 0 && text != NULL )
-   funcret = send_text(text, obuffer);
-
-  if ( text != NULL )
-   roar_mm_free(text);
- } else {
-  switch (c->type) {
-   case _DIR:
-     funcret = send_menu(client, &(c->menu), vio, obuffer);
-    break;
-   case _FILE:
-     funcret = send_text(c->text, obuffer);
-    break;
-   default:
-     funcret = -1;
-    break;
-  }
- }
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
-
- if ( funcret == -1 ) {
-  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio);
-  return -1;
- }
-
- ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = 0", client, vio);
-
- return 0;
-}
-
-static int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
-
- (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio);
-
- return -1;
-}
-
-static struct roar_dl_proto __proto_common_gopher = {
- .proto = ROAR_PROTO_GOPHER,
- .description = "The Internet Gopher Protocol",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .handle = emul_gopher_check_client,
- .flushed = emul_gopher_flushed_client
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_gopher, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_gopher) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-gopher", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet Gopher protocol");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-#endif
-
-//ll
Index: plugins/roard/protocol-irc.c
===================================================================
--- plugins/roard/protocol-irc.c	(revision 6052)
+++ 	(revision )
@@ -1,902 +1,0 @@
-//irc.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-#include <ctype.h>
-
-#define MAX_CHANNELS 8
-
-struct channel {
- char * name;
- struct {
-  char * text;
-  char * user;
-  time_t ts;
- } topic;
- size_t client_count;
- int clients[ROAR_CLIENTS_MAX];
-};
-
-struct state {
- const char * server_name;
- const char * server_fullname;
- const char * quit_msg;
- struct roar_subscriber * subscription_client_delete;
- struct channel g_channels[MAX_CHANNELS];
-};
-
-static struct state   g_state_init = {
- .server_name = "irc.roard",
- .server_fullname = "RoarAudio roard IRC Server plugin",
- .quit_msg = NULL,
- .subscription_client_delete = NULL
-};
-
-static struct state * g_state = &g_state_init;
-
-static const struct command {
- const char * name;
- int (*func)(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text);
-} g_commands[];
-
-static int is_valid_name (const char * name) {
- register char c;
-
- for (; (c = *name) != 0; name++) {
-  if ( !(isalnum(c) || c == '-' || c == '_') )
-   return 0;
- }
-
- return 1;
-}
-
-static void strip_nl(char * str) {
- register char c;
-
- for (; (c = *str) != 0; str++) {
-  if ( c == '\r' || c == '\n' ) {
-   *str = 0;
-   return;
-  }
- }
-}
-
-static char * get_nick(int client) {
- struct roar_client * c;
- clients_get(client, &c);
- return c->name;
-}
-
-static const char * get_ident(int client) {
- static char buf[80];
- struct roar_client * c;
- clients_get(client, &c);
-
- if ( c->uid == -1 ) {
-  buf[0] = '~';
-  buf[1] = 0;
- } else {
-  snprintf(buf, sizeof(buf)-1, "uid%i~", c->uid);
-  buf[sizeof(buf)-1] = 0;
- }
-
- return buf;
-}
-
-static const char * get_node(int client) {
- struct roar_client * c;
- static char buf_nnode[80];
- char * nnode;
-
- clients_get(client, &c);
-
- roar_nnode_to_str(&(c->nnode), buf_nnode, sizeof(buf_nnode));
-
- nnode  = strstr(buf_nnode, ": ");
- if ( nnode == NULL ) {
-  nnode  = "unknown~";
- } else {
-  nnode += 2;
- }
-
- return nnode;
-}
-
-static const char * get_ufull(int client) {
- struct roar_client * c;
- static char buf[80];
- const char * ident = get_ident(client);
- const char * nnode = get_node(client);
-
- clients_get(client, &c);
-
- snprintf(buf, sizeof(buf)-1, "%s!%s@%s", c->name, ident, nnode);
-
- buf[sizeof(buf)-1] = 0;
-
- return buf;
-}
-
-static const char * get_realname(int client) {
- (void)client;
- return "(no realname)";
-}
-
-static int get_client_by_nick(const char * nick) {
- struct roar_client * c;
- int i;
-
- for (i = 0; i < ROAR_CLIENTS_MAX; i++) {
-  if ( clients_get(i, &c) != 0 )
-   continue;
-
-  if ( !!strcasecmp(c->name, nick) )
-   continue;
-
-  return i;
- }
-
- return -1;
-}
-
-static struct channel * get_channel(const char * name) {
- struct channel * c;
- size_t i;
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  c = &(g_state->g_channels[i]);
-
-  if ( !c->client_count )
-   continue;
-
-  if ( !!strcasecmp(c->name, name) )
-   continue;
-
-  return c;
- }
-
- return NULL;
-}
-
-static size_t get_listener_list(int client, const char * channel, int ** listener) {
- struct channel * c;
- static int clients[ROAR_CLIENTS_MAX];
- size_t ret = 0;
- size_t i, k;
- int j;
- int found;
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  c = &(g_state->g_channels[i]);
-
-  if ( !c->client_count )
-   continue;
-
-  if ( c->clients[client] < 1 )
-   continue;
-
-  if ( channel != NULL && !!strcasecmp(c->name, channel) )
-   continue;
-
-  for (j = 0; j < ROAR_CLIENTS_MAX; j++) {
-   if ( c->clients[j] > 0 ) {
-    found = 0;
-    for (k = 0; k < ret; k++) {
-     if ( clients[k] == j ) {
-      found = 1;
-     }
-    }
-    if ( !found ) {
-     clients[ret] = j;
-     ret++;
-    }
-   }
-  }
- }
-
- *listener = clients;
-
- return ret;
-}
-
-static void put_printf(int client, struct roar_buffer ** obuffer, const char *format, ...) {
- va_list ap;
- struct roar_buffer * buf;
- size_t len = 2048;
- void * data;
- int ret;
-
- if ( roar_buffer_new_data(&buf, len, &data) == -1 )
-  return;
-
- va_start(ap, format);
- ret = vsnprintf(data, len-1, format, ap);
- va_end(ap);
-
- if ( roar_buffer_set_len(buf, strlen(data)) == -1 ) {
-  roar_buffer_free(buf);
-  return;
- }
-
- if ( obuffer == NULL ) {
-  // TODO: FIXME: find a better way to to this.
-  clients_add_output(client, &buf);
- } else {
-  if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 )
-   roar_buffer_free(buf);
- }
-}
-
-static int do_join(int client, const char * channel) {
- struct channel * c = NULL;
- size_t i;
-
- if ( channel[0] != '#' )
-  return -1;
-
- if ( !is_valid_name(channel+1) )
-  return -1;
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  if ( !g_state->g_channels[i].client_count )
-   continue;
-
-  if ( !!strcasecmp(g_state->g_channels[i].name, channel) )
-   continue;
-
-  c = &(g_state->g_channels[i]);
-  break;
- }
-
- if ( c == NULL ) {
-  for (i = 0; i < MAX_CHANNELS; i++) {
-   if ( g_state->g_channels[i].client_count )
-    continue;
-
-   c = &(g_state->g_channels[i]);
-   break;
-  }
-
-  if ( c == NULL )
-   return -1;
-
-  memset(c, 0, sizeof(*c));
-
-  c->name = roar_mm_strdup(channel);
- }
-
- if ( c->clients[client] )
-  return -1;
-
- c->clients[client] = 1;
- c->client_count++;
-
- return 0;
-}
-
-static int do_part(int client, const char * channel) {
- struct channel * c = NULL;
- size_t i;
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  if ( !g_state->g_channels[i].client_count )
-   continue;
-
-  if ( !!strcasecmp(g_state->g_channels[i].name, channel) )
-   continue;
-
-  if ( !g_state->g_channels[i].clients[client] )
-   return -1;
-
-  c = &(g_state->g_channels[i]);
-  break;
- }
-
- c->clients[client] = 0;
- c->client_count--;
-
- if ( !c->client_count ) {
-  roar_mm_free(c->name);
-
-  if ( c->topic.text != NULL )
-   roar_mm_free(c->topic.text);
-  if ( c->topic.user != NULL )
-   roar_mm_free(c->topic.user);
- }
-
- return 0;
-}
-
-static int do_names(int client, struct roar_buffer ** obuffer, const char * channel) {
- const char * nick = get_nick(client);
- size_t i;
- char buf[256];
- size_t len, offset;
- char * c_nick;
- int j;
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  if ( !g_state->g_channels[i].client_count )
-   continue;
-
-  if ( !!strcasecmp(g_state->g_channels[i].name, channel) )
-   continue;
-
-  offset = 0;
-
-  for (j = 0; j < ROAR_CLIENTS_MAX; j++) {
-   if ( g_state->g_channels[i].clients[j] == 0 )
-    continue;
-
-   c_nick = get_nick(j);
-   len = strlen(c_nick);
-   if ( (offset + len + 3) > sizeof(buf) ) {
-    buf[offset] = 0;
-    put_printf(client, obuffer, ":%s 353 %s = %s :%s\n", g_state->server_name, nick, channel, buf);
-    offset = 0;
-   }
-
-   memcpy(buf + offset, c_nick, len);
-   offset += len;
-   buf[offset] = ' ';
-   offset++;
-   buf[offset] = 0;
-  }
-
-  if ( offset ) {
-   buf[offset] = 0;
-   put_printf(client, obuffer, ":%s 353 %s = %s :%s\n", g_state->server_name, nick, channel, buf);
-  }
-  put_printf(client, obuffer, ":%s 366 %s %s :End of /NAMES list.\n", g_state->server_name, nick, channel);
-
-  return 0;
- }
-
- return -1;
-}
-
-static int __run_command(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- size_t i;
- int found = 0;
-
- for (i = 0; g_commands[i].name != NULL; i++) {
-  if ( !strcasecmp(g_commands[i].name, cmd) ) {
-   found = 1;
-   g_commands[i].func(client, obuffer, cmd, args, text);
-  }
- }
-
- if ( !found ) {
-  put_printf(client, obuffer, ":%s 421 %s %s :Unknown command\n", g_state->server_name, get_nick(client), cmd);
- }
-
- return 0;
-}
-
-static void cb_client_delete(struct roar_notify_core * core, struct roar_event * event, void * userdata) {
- int * listener;
- size_t count;
- struct channel * c;
- const char * text = g_state->quit_msg;
- int client = event->target;
- const char * ufull = get_ufull(client);
- size_t i;
-
- (void)core, (void)userdata;
-
- if ( text == NULL )
-  text = "Client deleted. Died, kicked or internal error.";
-
- if ( g_state->quit_msg != NULL )
-  put_printf(client, NULL, "ERROR :Closing Link: %s (Quit: %s)\n", ufull, text);
-
- count = get_listener_list(client, NULL, &listener);
- for (; count; count--, listener++)
-  put_printf(*listener, NULL, ":%s QUIT :Quit: %s\n", ufull, text);
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  c = &(g_state->g_channels[i]);
-
-  if ( !c->client_count )
-   continue;
-
-  if ( !c->clients[client] )
-   continue;
-
-  c->clients[client] = 0;
-  c->client_count--;
-
-  if ( !c->client_count ) {
-   roar_mm_free(c->name);
-
-   if ( c->topic.text != NULL )
-    roar_mm_free(c->topic.text);
-   if ( c->topic.user != NULL )
-    roar_mm_free(c->topic.user);
-  }
- }
-
- clients_flush(client);
-}
-
-static int set_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct roar_client_server * cs;
- char * name;
-
- (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- clients_get_server(client, &cs);
-
- name = ROAR_CLIENT(cs)->name;
- snprintf(name, sizeof(ROAR_CLIENT(cs)->name), "Client%i~", client);
-
-/*
-:ph7.ph.sft NOTICE AUTH :*** Looking up your hostname...
-:ph7.ph.sft NOTICE AUTH :*** Couldn't resolve your hostname; using your IP address instead
-NICK nick
-USER A B C D
-:ph7.ph.sft NOTICE AUTH :*** Couldn't resolve your hostname; using your IP address instead
-:ph7.ph.sft 002 nick :Your host is ph7.ph.sft, running version Unreal3.2.7
-:ph7.ph.sft 003 nick :This server was created Tue Aug 28 2007 at 10:02:00 CEST
-:ph7.ph.sft 004 nick ph7.ph.sft Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
-:ph7.ph.sft 005 nick NAMESX SAFELIST HCN MAXCHANNELS=10 CHANLIMIT=#:10 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 WALLCHOPS :are supported by this server
-:ph7.ph.sft 005 nick WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(ohv)@%+ CHANMODES=beIqa,kfL,lj,psmntirRcOAQKVCuzNSMTG NETWORK=PH2 CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=@%+ EXCEPTS INVEX :are supported by this server
-:ph7.ph.sft 005 nick CMDS=KNOCK,MAP,DCCALLOW,USERIP :are supported by this server
-*/
-
- put_printf(client, obuffer,
-      ":%s 001 %s :Welcome to the roard based IRC server.\n"
-      ":%s 375 %s :- %s Message of the Day -\n"
-      ":%s 372 %s :- MotD goes here...\n"
-      ":%s 376 %s :End of /MOTD command.\n",
-   g_state->server_name, name,
-   g_state->server_name, name, g_state->server_name,
-   g_state->server_name, name,
-   g_state->server_name, name
- );
-
- __run_command(client, obuffer, "LUSERS", NULL, NULL);
-
- return 0;
-}
-
-static int check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- char cmd[1024*2];
- char * args;
- char * text;
- ssize_t len;
-
- (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- len = roar_vio_read(vio, cmd, sizeof(cmd)-1);
- if ( len < 1 ) {
-  clients_delete(client);
-  return -1;
- }
-
- cmd[len] = 0;
-
- strip_nl(cmd);
-
- ROAR_DBG("check_client(client=%i, vio=?): cmd=\"%s\"", client, cmd);
-
- if ( cmd[0] == 0 )
-  return 0;
-
- args = strstr(cmd, " ");
-
- if ( args != NULL ) {
-  *args = 0;
-  args++;
-  if ( *args == ':' ) {
-   text = args + 1;
-   args = NULL;
-  } else {
-   text = strstr(args, " :");
-   if ( text != NULL ) {
-    *text = 0;
-    text += 2;
-   }
-  }
- } else {
-  text = NULL;
- }
-
- __run_command(client, obuffer, cmd, args, text);
-
- return 0;
-}
-
-// commands:
-static int on_nick(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- char * nick = get_nick(client);
- int * listener;
- size_t count;
- const char * ufull;
-
- (void)cmd, (void)text;
-
- if ( args != NULL && args[0] != 0 && is_valid_name(args) && strlen(args) < ROAR_BUFFER_NAME ) {
-  if ( get_client_by_nick(args) != -1 ) {
-   put_printf(client, obuffer, ":%s 433 %s %s :Nickname is already in use.\n", g_state->server_name, nick, args);
-  } else {
-   ufull = get_ufull(client);
-   put_printf(client, obuffer, ":%s NICK :%s\n", ufull, args);
-   count = get_listener_list(client, NULL, &listener);
-   for (; count; count--, listener++)
-    if ( *listener != client )
-     put_printf(*listener, NULL, ":%s NICK :%s\n", ufull, args);
-
-   strcpy(nick, args);
-  }
- } else {
-  put_printf(client, obuffer, ":%s 432 %s %s :Erroneous Nickname: Illegal characters\n", g_state->server_name, nick, args);
- }
-
- return 0;
-}
-
-static int on_user(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- (void)client, (void)obuffer, (void)cmd, (void)args, (void)text;
- return 0;
-}
-
-static int on_quit(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- int ret;
-
- (void)obuffer, (void)cmd, (void)args;
-
- if ( text == NULL )
-  text = "... have a cuddle ...";
-
- g_state->quit_msg = text;
- ret = clients_delete(client);
- g_state->quit_msg = NULL;
-
- return ret;
-}
-
-static int on_ping(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- (void)cmd, (void)args;
-
- put_printf(client, obuffer, "PONG :%s\n", text);
-
- return 0;
-}
-
-static int on_lusers(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- const char * clientnick = get_nick(client);
- size_t i;
- size_t numchans = 0;
-
- (void)cmd, (void)args, (void)text;
-
-/*
-:v0.fellig.org 251 nick :There are 9 users and 11 invisible on 1 servers
-
-:v0.fellig.org 252 nick 1 :operator(s) online
-
-:v0.fellig.org 254 nick 16 :channels formed
-:v0.fellig.org 255 nick :I have 20 clients and 0 servers
-:v0.fellig.org 265 nick :Current Local Users: 20  Max: 52
-:v0.fellig.org 266 nick :Current Global Users: 20  Max: 22
-*/
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  if ( !g_state->g_channels[i].client_count )
-   continue;
-  numchans++;
- }
-
- put_printf(client, obuffer, ":%s 251 %s :There are %zu users and 0 invisible on 1 servers\n",
-            g_state->server_name, clientnick, counters_get(cur, clients));
- put_printf(client, obuffer, ":%s 254 %s %zu :channels formed\n",
-            g_state->server_name, clientnick, numchans);
- put_printf(client, obuffer, ":%s 255 %s :I have %zu clients and 0 servers\n",
-            g_state->server_name, clientnick, counters_get(cur, clients));
- put_printf(client, obuffer, ":%s 265 %s :Current Local Users: %zu  Max: <unknown>\n",
-            g_state->server_name, clientnick, counters_get(cur, clients));
- put_printf(client, obuffer, ":%s 266 %s :Current Global Users: %zu  Max: <unknown>\n",
-            g_state->server_name, clientnick, counters_get(cur, clients));
-
- return 0;
-}
-
-static int on_whois(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- const char * clientnick = get_nick(client);
- const char * tnick = args;
- int tclient;
-
- (void)cmd, (void)text;
-
-/*
-:ph7.ph.sft 317 nick phi 131 1322456381 :seconds idle, signon time
-*/
-
- if ( (tclient = get_client_by_nick(tnick)) == -1 ) {
-  put_printf(client, obuffer, ":%s 401 %s %s :No such nick/channel\n", g_state->server_name, clientnick, tnick);
- } else {
-  put_printf(client, obuffer, ":%s 311 %s %s %s %s * :%s\n", g_state->server_name, clientnick, tnick,
-             get_ident(tclient), get_node(tclient), get_realname(tclient));
-  put_printf(client, obuffer, ":%s 312 %s %s %s :%s\n", g_state->server_name, clientnick, tnick, g_state->server_name, g_state->server_fullname);
- }
- put_printf(client, obuffer, ":%s 318 %s %s :End of /WHOIS list.\n", g_state->server_name, clientnick, tnick);
-
- return 0;
-}
-
-static int on_privmsg(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- const char * ufull = get_ufull(client);
- int * listener;
- size_t count;
- char * next;
- int tmp;
-
- if ( args == NULL || text == NULL )
-  return -1;
-
- if ( text[0] == 0 )
-  return 0;
-
- while (args != NULL) {
-  next = strstr(args, ",");
-  if ( next != NULL ) {
-   *next = 0;
-   next++;
-  }
-
-  if ( args[0] == '#' ) {
-   count = get_listener_list(client, args, &listener);
-   for (; count; count--, listener++)
-    if ( *listener != client )
-     put_printf(*listener, NULL, ":%s %s %s :%s\n", ufull, cmd, args, text);
-  } else {
-   if ( (tmp = get_client_by_nick(args)) == -1 ) {
-    put_printf(client, obuffer, ":%s 401 %s %s :No such nick/channel\n", g_state->server_name, get_nick(client), args);
-   } else {
-    put_printf(tmp, NULL, ":%s %s %s :%s\n", ufull, cmd, args, text);
-   }
-  }
-
-  args = next;
- }
-
- return 0;
-}
-
-
-static int on_list(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- const char * clientnick = get_nick(client);
- struct channel * c;
- size_t i;
-
- (void)cmd, (void)args, (void)text;
-
- put_printf(client, obuffer, ":%s 321 %s Channel :Users  Name\n", g_state->server_name, clientnick);
-
- for (i = 0; i < MAX_CHANNELS; i++) {
-  c = &(g_state->g_channels[i]);
-  if ( !c->client_count )
-   continue;
-
-  put_printf(client, obuffer, ":%s 322 %s %s %zu :[+] %s\n",
-             g_state->server_name, clientnick, c->name, c->client_count, c->topic.text == NULL ? "" : c->topic.text);
- }
-
- put_printf(client, obuffer, ":%s 323 %s :End of /LIST\n", g_state->server_name, clientnick);
-
- return 0;
-}
-
-static int on_join(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- struct channel * c;
- const char * ufull = get_ufull(client);
- int * listener;
- size_t count;
- const char * nick;
-
- (void)cmd, (void)text;
-
- if ( args == NULL )
-  return -1;
-
- if ( do_join(client, args) != 0 ) {
-  return -1;
- }
-
- count = get_listener_list(client, args, &listener);
- for (; count; count--, listener++)
-  put_printf(*listener, NULL, ":%s JOIN :%s\n", ufull, args);
-
- c = get_channel(args);
-
- if ( c->topic.text != NULL ) {
-  nick = get_nick(client);
-  put_printf(client, obuffer, ":%s 332 %s %s :%s\n"
-                     ":%s 333 %s %s %s %li\n",
-         g_state->server_name, nick, c->name, c->topic.text,
-         g_state->server_name, nick, c->name, c->topic.user, (long int)c->topic.ts
-  );
- }
-
- do_names(client, obuffer, args);
-
- return 0;
-}
-
-static int on_part(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- const char * ufull = get_ufull(client);
- int * listener;
- size_t count;
-
- (void)obuffer, (void)cmd;
-
- if ( args == NULL )
-  return -1;
-
- if ( text == NULL )
-  text = "Dejoined.";
-
- count = get_listener_list(client, args, &listener);
- for (; count; count--, listener++)
-  put_printf(*listener, NULL, ":%s PART %s :%s\n", ufull, args, text);
-
- do_part(client, args);
-
- return 0;
-}
-
-static int on_names(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- (void)cmd, (void)text;
-
- if ( args == NULL )
-  return -1;
-
- return do_names(client, obuffer, args);
-}
-
-static int on_topic(int client, struct roar_buffer ** obuffer, const char * cmd, char * args, char * text) {
- struct channel * c;
- const char * ufull = get_ufull(client);
- int * listener;
- size_t count;
- char * nick = get_nick(client);
-
- (void)obuffer, (void)cmd;
-
- if ( args == NULL )
-  return -1;
-
- c = get_channel(args);
-
- if ( c == NULL )
-  return -1;
-
- if ( !c->clients[client] ) {
-  return -1;
- }
-
- if ( c->topic.text != NULL )
-  roar_mm_free(c->topic.text);
- if ( c->topic.user != NULL )
-  roar_mm_free(c->topic.user);
-
- c->topic.text = NULL;
- c->topic.user = roar_mm_strdup(nick);
- c->topic.ts   = time(NULL);
-
- if ( text != NULL )
-  c->topic.text = roar_mm_strdup(text);
-
- if ( text == NULL )
-  text = "";
-
- count = get_listener_list(client, c->name, &listener);
- for (; count; count--, listener++)
-  put_printf(*listener, NULL, ":%s TOPIC %s :%s\n", ufull, c->name, text);
-
- return 0;
-}
-
-static const struct command g_commands[] = {
- {"NICK", on_nick},
- {"USER", on_user},
- {"QUIT", on_quit},
- {"PING", on_ping},
- {"LUSERS", on_lusers},
- {"WHOIS", on_whois},
- {"PRIVMSG", on_privmsg},
- {"NOTICE", on_privmsg},
- {"LIST", on_list},
- {"JOIN", on_join},
- {"PART", on_part},
- {"NAMES", on_names},
- {"TOPIC", on_topic},
- {NULL, NULL}
-};
-
-// plugin handling suff:
-static int init(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- struct roar_event event;
-
- (void)para, (void)lib;
-
- memset(&event, 0, sizeof(event));
-
- event.event = ROAR_OE_BASICS_DELETE;
-
- event.emitter = -1;
- event.target = -1;
- event.target_type = ROAR_OT_CLIENT;
-
- memset(g_state->g_channels, 0, sizeof(g_state->g_channels));
-
- g_state->subscription_client_delete = roar_notify_core_subscribe(NULL, &event, cb_client_delete, NULL);
-
- return 0;
-}
-
-static int unload(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
-
- roar_notify_core_unsubscribe(NULL, g_state->subscription_client_delete);
-
- return 0;
-}
-
-static const struct roar_dl_proto proto = {
- .proto = ROAR_PROTO_IRC,
- .description = "Internet Relay Chat",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = set_proto,
- .unset_proto = NULL,
- .handle = check_client,
- .flush = NULL,
- .flushed = NULL,
- .status = NULL
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, proto, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_irc) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-irc", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet Relay Chat (IRC)");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_INIT, init);
- ROAR_DL_PLUGIN_REG_UNLOAD(unload);
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(g_state, g_state_init);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/roard/protocol-rplay.c
===================================================================
--- plugins/roard/protocol-rplay.c	(revision 6052)
+++ 	(revision )
@@ -1,548 +1,0 @@
-//emul_rplay.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY
-
-struct emul_rplay_command {
- const char * name;
- const char * usage;
- ssize_t      min_args;
- ssize_t      max_args;
- int (*handler)(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-};
-
-static int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command);
-
-static int emul_rplay_send_error    (int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen, const char * msg);
-
-static int emul_rplay_on_status(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-static int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-static int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-
-// things we need to implent soon:
-static int emul_rplay_on_play(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-static int emul_rplay_on_put(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-//static int emul_rplay_on_set(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-//static int emul_rplay_on_modify(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-static int emul_rplay_on_pause(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-static int emul_rplay_on_continue(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-//static int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-
-static struct emul_rplay_command emul_rplay_commands[] = {
- {"access",      NULL, -1, -1, NULL},
- {"application", NULL,  1, -1, NULL},
- {"continue",    NULL,  1, -1, emul_rplay_on_continue},
- {"die",         NULL,  1, -1, NULL},
- {"done",        NULL,  1, -1, NULL}, // #ifdef DEBUG
- {"find",        NULL,  1,  1, NULL},
- {"get",         NULL,  1,  1, NULL},
- {"help",        NULL, -1, -1, emul_rplay_on_help},
- {"info",        NULL,  1,  1, NULL},
- {"list",        NULL,  0,  1, NULL},
- {"modify",      NULL,  2, -1, NULL},
- {"monitor",     NULL,  1, -1, NULL},
- {"pause",       NULL,  1, -1, emul_rplay_on_pause},
- {"play",        NULL,  1, -1, emul_rplay_on_play},
- {"put",         NULL,  2, -1, emul_rplay_on_put},
- {"quit",        NULL,  0,  0, emul_rplay_on_quit},
- {"reset",       NULL,  0,  0, NULL},
- {"set",         NULL,  1, -1, NULL},
- {"skip",        NULL,  1,  1, NULL},
- {"status",      NULL,  0,  0, emul_rplay_on_status},
- {"stop",        NULL,  1, -1, NULL},
- {"version",     NULL,  0,  0, NULL},
- {"volume",      NULL,  0,  1, NULL},
- {"wait",        NULL, -1, -1, NULL},
- {NULL, NULL, -1, -1, NULL}
-};
-
-static inline int is_true(const char * str) {
- const char * ts[] = {"true", "t", "1", "yes", "y", "on"};
- size_t i;
-
- for (i = 0; i < (sizeof(ts)/sizeof(*ts)); i++)
-  if ( !strcasecmp(str, ts[i]) )
-   return 1;
-
- return 0;
-}
-
-static inline int is_false(const char * str) {
- return !is_true(str);
-}
-
-static int format_to_codec(const char * str, const int bo) {
-
- if ( !strcasecmp(str, "ulaw") || !strcasecmp(str, "u_law") || !strcasecmp(str, "u-law") )
-  return ROAR_CODEC_MULAW;
-
- if ( !strncasecmp(str, "ulinear", 7) ) {
-  switch (bo) {
-   case ROAR_BYTEORDER_LE:
-     return ROAR_CODEC_PCM_U_LE;
-    break;
-   case ROAR_BYTEORDER_BE:
-     return ROAR_CODEC_PCM_U_BE;
-    break;
-   case ROAR_BYTEORDER_PDP:
-     return ROAR_CODEC_PCM_U_PDP;
-    break;
-   default:
-     return -1;
-    break;
-  }
- } else if ( !strncasecmp(str, "linear", 6) ) {
-  switch (bo) {
-   case ROAR_BYTEORDER_LE:
-     return ROAR_CODEC_PCM_S_LE;
-    break;
-   case ROAR_BYTEORDER_BE:
-     return ROAR_CODEC_PCM_S_BE;
-    break;
-   case ROAR_BYTEORDER_PDP:
-     return ROAR_CODEC_PCM_S_PDP;
-    break;
-   default:
-     return -1;
-    break;
-  }
- }
-
- return -1;
-}
-
-static int emul_rplay_set_proto  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
-
- (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( emul_rplay_on_status(client, NULL, vio, NULL, 0) == -1 )
-  return -1;
-
- return 0;
-}
-
-static int emul_rplay_check_client  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- char buf[1024];
- ssize_t len;
-
- (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( client == -1 )
-  return -1;
-
- if ( (len = roar_vio_read(vio, buf, sizeof(buf)-1)) <= 0 ) {
-  // really bad protocol error
-  return -1;
- }
-
- for (; buf[len-1] == '\r' || buf[len-1] == '\n'; len--);
-
- buf[len] = 0;
-
- return emul_rplay_exec_command(client, vio, buf);
-}
-
-int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command) {
- struct emul_rplay_command * cmd;
- struct roar_keyval * kv;
- ssize_t kvlen;
- char * para = NULL;
- char * c;
- int last_was_space = 0;
-
- for (c = command; *c != 0; c++) {
-  if ( *c == ' ' || *c == '\t' ) {
-   last_was_space = 1;
-   *c = 0;
-  } else {
-   if ( last_was_space ) {
-    para = c;
-    break;
-   }
-  }
- }
-
- if ( para == NULL ) {
-  kv = NULL; 
-  kvlen = 0;
- } else {
-  kvlen = roar_keyval_split(&kv, para, " \t", "=", 0);
-  if ( kvlen == -1 )
-   return emul_rplay_send_error(client, NULL, vio, NULL, 0, "Can not parse parameter list");
- }
-
- for (cmd = emul_rplay_commands; cmd->name != NULL; cmd++) {
-  if ( !strcasecmp(cmd->name, command) )
-   break;
- }
-
- if ( cmd->name == NULL )
-  return emul_rplay_send_error(client, NULL, vio, kv, kvlen, "unknown command");
-
- if ( cmd->handler == NULL )
-  return emul_rplay_send_error(client, cmd, vio, kv, kvlen, "unsupported command");
-
- return cmd->handler(client, cmd, vio, kv, kvlen);
-}
-
-int emul_rplay_send_error    (int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen, const char * msg) {
- struct roar_keyval * kvr;
- const char * command;
- const char * cd = NULL;
-
- (void)client;
-
- if ( cmd != NULL ) {
-  command = cmd->name;
- } else {
-  command = "(unknown)";
- }
-
- if ( kv != NULL ) {
-  kvr = roar_keyval_lookup(kv, "client-data", kvlen, 0);
-  if ( kvr != NULL )
-   cd = kvr->value;
- }
-
- if ( cd == NULL )
-  cd = "";
-
- return roar_vio_printf(vio, "-error=\"%s\" command=\"%s\" client-data=\"%s\"\n", msg, command, cd) <= 0 ? -1 : 0;
-}
-
-
-int emul_rplay_on_status(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
- const char * hostname  = "localhost";
- const char * version   = "RoarAudio";
-       char   uptime[16];
- const char * byteorder = "native";
-       int    fragsize  = ROAR_OUTPUT_CALC_OUTBUFSIZE(g_sa);
-       int    h, m, s;
-
- (void)client, (void)cmd, (void)kv, (void)kvlen;
-
- s  = g_pos / g_sa->rate / g_sa->channels;
- h  = s / 3600;
- s -= h * 3600;
- m  = s / 60;
- s -= m * 60;
-
- snprintf(uptime, sizeof(uptime)-1, "%.2i:%.2i:%.2i", h, m, s);
- uptime[sizeof(uptime)-1] = 0;
-
- switch (ROAR_CODEC_BYTE_ORDER(g_sa->codec)) {
-  case ROAR_CODEC_LE:
-    byteorder = "little-endian";
-   break;
-  case ROAR_CODEC_BE:
-    byteorder = "big-endian";
-   break;
-  case ROAR_CODEC_PDP:
-    byteorder = "pdp-endian";
-   break;
- }
-
- roar_vio_printf(vio,
-                 "+host=%s version=%s uptime=%s "
-                 "audio-bits=%i audio-byte-order=%s audio-channels=%i "
-                 "audio-device=internal-mixer "
-                 "audio-format=linear-%i "
-                 "audio-fragsize=%i "
-                 "audio-port=speaker,headphone,lineout audio-rate=10 "
-                 "audio-sample-rate=%i "
-                 "volume=254 "
-                 "curr-rate=10 priority-threshold=0 audio-close=0 audio-device-status=open"
-                 "\n",
-                      hostname, version, uptime,
-                      g_sa->bits, byteorder, g_sa->channels,
-                      g_sa->bits,
-                      fragsize,
-                      g_sa->rate
-                );
-
- return 0;
-}
-
-
-static int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
-
- (void)client, (void)cmd, (void)vio, (void)kv, (void)kvlen;
-
- return -1;
-}
-
-static int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
- struct emul_rplay_command * c;
-
- (void)client, (void)cmd, (void)kv, (void)kvlen;
-
- roar_vio_printf(vio, "+message=\"command summary\" command=help\n");
-
- for (c = emul_rplay_commands; c->name != NULL; c++) {
-  roar_vio_printf(vio, "%-8s %s\n", c->name, c->usage == NULL ? "" : c->usage);
- }
-
- roar_vio_printf(vio, ".\n");
-
- return -1;
-}
-
-
-static int emul_rplay_on_play(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
- struct roar_keyval        * kvr, * rate, * bits, * channels, * format, * byteorder;
- struct roar_audio_info      info;
- struct roar_stream_server * ss;
- struct roar_stream        *  s;
- int stream;
- int bo = -1;
- char * cd = NULL;
-
- if ( (kvr = roar_keyval_lookup(kv, "input", kvlen, 0)) == NULL ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "no input parameter");
-  return -1;
- }
-
- if ( !!strcasecmp(kvr->value, "flow") ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "non-flow input not supported");
-  return -1;
- }
-
-/*
-               "input-format=%s input-sample-rate=%d input-bits=%d "
-               "input-channels=%d input-byte-order=%s",
-*/
-
- rate      = roar_keyval_lookup(kv, "input-sample-rate", kvlen, 0);
- bits      = roar_keyval_lookup(kv, "input-bits",        kvlen, 0);
- channels  = roar_keyval_lookup(kv, "input-channels",    kvlen, 0);
- format    = roar_keyval_lookup(kv, "input-format",      kvlen, 0);
- byteorder = roar_keyval_lookup(kv, "input-byte-order",  kvlen, 0);
-
- if ( rate == NULL || bits == NULL || channels == NULL || format == NULL || byteorder == NULL ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "missing audio parameter");
-  return -1;
- }
-
- info.rate     = atoi(rate->value);
- info.bits     = atoi(bits->value);
- info.channels = atoi(channels->value);
-
- if ( !strcasecmp(byteorder->value, "big-endian") || !strcasecmp(byteorder->value, "big") ) {
-  bo = ROAR_BYTEORDER_BE;
- } else if ( !strcasecmp(byteorder->value, "little-endian") || !strcasecmp(byteorder->value, "little") ) {
-  bo = ROAR_BYTEORDER_LE;
- } else if ( !strcasecmp(byteorder->value, "pdp-endian") || !strcasecmp(byteorder->value, "pdp") ) {
-  bo = ROAR_BYTEORDER_PDP;
- } else {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "unknown byte order");
-  return -1;
- }
-
- info.codec = format_to_codec(format->value, bo);
-
- if ((stream = streams_new()) == -1 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not create new stream");
-  return -1;
- }
-
- if ( streams_get(stream, &ss) == -1 ) {
-  streams_delete(stream);
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not get stream object");
-  return -1;
- }
-
- s = ROAR_STREAM(ss);
-
- if ( client_stream_add(client, stream) == -1 ) {
-  streams_delete(stream);
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not add stream to client");
-  return -1;
- }
-
- memcpy(&(s->info), &info, sizeof(info));
- ss->codec_orgi = s->info.codec;
-
- if ( streams_set_dir(stream, ROAR_DIR_PLAY, 1) == -1 ) {
-  streams_delete(stream);
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not set dir on stream");
-  return -1;
- }
-
- if ( (kvr = roar_keyval_lookup(kv, "client-data", kvlen, 0)) != NULL ) {
-  cd = kvr->value;
- }
-
- if ( cd == NULL )
-  cd = "";
-
-//        connection_reply(c, "%cid=#%d sound=\"%s\" command=%s client-data=\"%s\" list-name=\"%s\"",
-// roar_vio_printf(vio, "+id=#%i sound=\"%s\" command=%s client-data=\"%s\" list-name=\"%s\"");
- roar_vio_printf(vio, "+id=#%i command=%s client-data=\"%s\"\n", stream, "play", cd);
-
- return 0;
-}
-
-static int emul_rplay_on_put(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
- struct roar_keyval * kvr;
- int stream;
- size_t len;
- char * cd = NULL;
-
-//23:00 < ph3-der-loewe>   rptp_putline(flow_fd, "put id=#%d size=0", spool_id);
- if ( (kvr = roar_keyval_lookup(kv, "id", kvlen, 0)) == NULL ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "no id parameter");
-  return -1;
- }
-
- stream = atoi(kvr->value+1);
-
- if ( (kvr = roar_keyval_lookup(kv, "size", kvlen, 0)) == NULL ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "no size parameter");
-  return -1;
- }
-
- len = atoi(kvr->value);
-
- if ( len != 0 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "currently only zero size put supported");
-  return -1;
- }
-
- if ( client_stream_exec(client, stream) == -1 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not exec stream");
-  return -1;
- }
-
-
- if ( (kvr = roar_keyval_lookup(kv, "client-data", kvlen, 0)) != NULL ) {
-  cd = kvr->value;
- }
-
- if ( cd == NULL )
-  cd = "";
-
-/*
-        connection_reply(c, "%cid=#%d size=%d command=put client-data=\"%s\"",
-                         RPTP_OK, spool_id, sound_size, client_data);
-*/
- roar_vio_printf(vio, "+id=#%i command=%s client-data=\"%s\"\n", stream, "put", cd);
-
- return 0;
-}
-
-//static int emul_rplay_on_set(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-//static int emul_rplay_on_modify(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-
-static int emul_rplay_on_pause(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
- struct roar_keyval * kvr;
- int stream;
- char * cd = NULL;
-
- if ( kvlen < 1 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "no id parameter");
-  return -1;
- }
-
- stream = atoi(kv->key+1);
-
- if ( streams_set_flag(stream, ROAR_FLAG_PAUSE) == -1 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not set pause flag");
-  return -1;
- }
-
- if ( (kvr = roar_keyval_lookup(kv, "client-data", kvlen, 0)) != NULL ) {
-  cd = kvr->value;
- }
-
- if ( cd == NULL )
-  cd = "";
-
- roar_vio_printf(vio, "+id=#%i command=%s client-data=\"%s\"\n", stream, "pause", cd);
-
- return 0;
-}
-
-static int emul_rplay_on_continue(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
- struct roar_keyval * kvr;
- int stream;
- char * cd = NULL;
-
- if ( kvlen < 1 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "no id parameter");
-  return -1;
- }
-
- stream = atoi(kv->key+1);
-
- if ( streams_reset_flag(stream, ROAR_FLAG_PAUSE) == -1 ) {
-  emul_rplay_send_error(client, cmd, vio, kv, kvlen, "can not reset pause flag");
-  return -1;
- }
-
- if ( (kvr = roar_keyval_lookup(kv, "client-data", kvlen, 0)) != NULL ) {
-  cd = kvr->value;
- }
-
- if ( cd == NULL )
-  cd = "";
-
- roar_vio_printf(vio, "+id=#%i command=%s client-data=\"%s\"\n", stream, "coninue", cd);
-
- return 0;
-}
-
-//static int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
-
-static struct roar_dl_proto __proto_common_rplay = {
- .proto = ROAR_PROTO_RPLAY,
- .description = "RPlay emulation",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = emul_rplay_set_proto,
- .handle = emul_rplay_check_client
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_rplay, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_rplay) {
- ROARD_DL_CHECK_VERSIONS();
-
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-rplay", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of the RPlay protocol");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-#endif
-
-//ll
Index: plugins/roard/service-client.c
===================================================================
--- plugins/roard/service-client.c	(revision 6052)
+++ 	(revision )
@@ -1,192 +1,0 @@
-//service-about.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2013-2015
- *
- *  This file is part of roard 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 <roard/include/roard.h>
-
-static ssize_t __list(int * ids, size_t len) {
- struct roar_client * c;
- size_t i, j;
-
- if ( g_counters.cur.clients > len ) {
-  roar_err_set(ROAR_ERROR_NOSPC);
-  return -1;
- }
-
- for (j = i = 0; i < ROAR_CLIENTS_MAX && j < len; i++)
-  if ( clients_get(i, &c) == 0 )
-   ids[j++] = i;
-
- return j;
-}
-
-static ssize_t __num(enum roar_service_num what) {
- switch (what) {
-  case ROAR_SERVICE_NUM_DEFAULT:
-  case ROAR_SERVICE_NUM_CURRENT:
-    return g_counters.cur.clients;
-   break;
-  case ROAR_SERVICE_NUM_BUFFER:
-    if ( ((double)g_counters.cur.clients * 1.5) > ROAR_CLIENTS_MAX )
-     return ROAR_CLIENTS_MAX;
-    return (double)g_counters.cur.clients * 1.25;
-   break;
-#ifndef DEBUG
-  default: break;
-#endif
- }
- roar_err_set(ROAR_ERROR_NOTSUP);
- return -1;
-}
-
-static int __get(int id, struct roar_client * client) {
- struct roar_client * c;
-
- if ( client == NULL ) {
-  roar_err_set(ROAR_ERROR_FAULT);
-  return -1;
- }
-
- if ( clients_get(id, &c) == -1 )
-  return -1;
-
- memcpy(client, c, sizeof(struct roar_client));
- client->acl = NULL;
-
- return 0;
-}
-
-static int __status(int id) {
- struct roar_dl_librarypara * pluginpara;
- const struct roard_proto_handle * proto;
- struct roar_client_server * cs;
- struct roar_vio_calls vio;
- int ret, err;
-
- if ( clients_get_server(id, &cs) == -1 )
-  return -1;
-
- if ( (proto = clients_get_protohandle(ROAR_CLIENT(cs)->proto)) == NULL )
-  return -1;
-
- if ( proto->lhandle != NULL )
-  roar_dl_context_restore(proto->lhandle);
-
- pluginpara = roar_dl_getpara(proto->lhandle);
-
- switch (proto->type) {
-  case ROARD_PROTO_TYPE_COMMON:
-    if ( proto->impl.common->status == NULL ) {
-     ret = -1;
-     err = ROAR_ERROR_NOSYS;
-    } else {
-     roar_vio_open_fh_socket(&vio, clients_get_fh(id));
-     ret = proto->impl.common->status(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen, pluginpara);
-    }
-   break;
-  default:
-    ret = -1;
-    err = ROAR_ERROR_NOSYS;
-   break;
- }
-
- if ( pluginpara != NULL )
-  roar_dl_para_unref(pluginpara);
-
- if ( proto->lhandle != NULL )
-  roar_dl_context_store(proto->lhandle);
-
- roar_err_set(err);
- return ret;
-}
-
-static int __set_ids(int id, int clear, int pid, int uid, int gid) {
- struct roar_client * c;
-
- // just to check if the client exist.
- if ( clients_get(id, &c) == -1 )
-  return -1;
-
- // TODO: add proper error handling here.
-
- if ( pid != -1 || clear )
-  clients_set_pid(id, pid);
-
- if ( uid != -1 || clear )
-  clients_set_uid(id, uid);
-
- if ( gid != -1 || clear )
-  clients_set_gid(id, gid);
-
- return 0;
-}
-
-static int __set_proto(int id, int proto) {
- (void)id, (void)proto;
-
- roar_err_set(ROAR_ERROR_NOSYS);
- return -1;
-}
-
-
-static struct roar_service_client api = {
- .list = __list,
- .num  = __num,
- .get  = __get,
- .kick = (int(*)(int id, int error, const char * msg))clients_delete,
- .status = __status,
-
- .set_ids = __set_ids,
- .set_name = clients_set_name,
- .set_proto = __set_proto, /* dummy */
- .exec = client_stream_exec
-};
-
-ROAR_DL_PLUGIN_REG_SERVICES_GET_API(get_api, api)
-
-static const struct roar_dl_service service[1] = {
- {
-  .appname = NULL,
-  .appabi = NULL,
-  .servicename = ROAR_SERVICE_CLIENT_NAME,
-  .serviceabi = ROAR_SERVICE_CLIENT_ABI,
-  .description = "Access to client management",
-  .flags = ROAR_DL_SERVICE_FLAGS_NONE,
-  .userdata = NULL,
-  .get_api = get_api
- }
-};
-
-ROAR_DL_PLUGIN_REG_SERVICES(service);
-
-ROAR_DL_PLUGIN_START(service_client) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("service-client", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This plugin provides an interface to client control features of roard.");
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_SERVICE);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/Makefile
===================================================================
--- plugins/universal/Makefile	(revision 6019)
+++ 	(revision )
@@ -1,43 +1,0 @@
-include ../../Makefile.conf
-include ../../Makefile.inc
-
-TARGETS_PROTO=echo daytime discard http
-TARGETS_SLFI=helloworld chain alternative static file2filter channel2event trigger map random strobe calc
-TARGETS_SLFI_LIBM=fade
-TARGETS_SERVICE=about
-TARGETS_MISC=plugin-info helloworld debug-notify tic-tac-toe
-TARGETS_IO=piface
-TARGETS__NAMES=$(TARGETS_MISC) $(TARGETS_IO) $(foreach c,$(TARGETS_PROTO),protocol-$c) $(foreach c,$(TARGETS_SERVICE),service-$c) $(foreach c,$(TARGETS_SLFI),filter-slfi-$c)
-ifneq ($(lib_m),)
-TARGETS__NAMES+=$(foreach c,$(TARGETS_SLFI_LIBM),filter-slfi-$c)
-endif
-TARGETS       = $(foreach c,$(TARGETS__NAMES),$c$(SHARED_SUFFIX))
-
-#DEFINES        = -DDEBUG
-DEFINES+= -DROAR_DBG_PREFIX=\"'$(shell basename $+ .c)'\"
-INCLUDE = -I../../include -I../..
-CFLAGS += $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) $(DEFINES) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) $(SHARED) -L../../lib $(LDPATH)
-LIBS    = $(LIBROAR)
-
-all: ${TARGETS}
-clean:
-	rm -f ${TARGETS} *.o
-new: clean all
-
-install: all
-	cp $(cp_v) ${TARGETS} '$(DESTDIR)$(PREFIX_PLUGINS)/universal/universal/$(DEV_VENDOR)-$(DEV_VENDOR_NAME)/'
-semi-install: all
-	sh -c 'set -e; for file in *$(SHARED_SUFFIX); do ln -fs `pwd`/$$file '$(DESTDIR)$(PREFIX_PLUGINS)/universal/universal/$(DEV_VENDOR)-$(DEV_VENDOR_NAME)/'; done'
-
-%$(SHARED_SUFFIX): %.o
-	$(CC) $(LDFLAGS) -o $@ $+ $(LIBS)
-
-protocol-http$(SHARED_SUFFIX): protocol-http.o
-	$(CC) $(LDFLAGS) -o $@ $+ $(LIBS) $(lib_uste)
-
-# XXX: Very strange workaround:
-$(foreach c,$(TARGETS_SLFI),filter-slfi-$c$(SHARED_SUFFIX)): $(foreach c,$(TARGETS_SLFI),filter-slfi-$c.o)
-	$(CC) $(LDFLAGS) -o $@ $(shell basename $@ $(SHARED_SUFFIX)).o $(LIBS) $(LIBROARLIGHT)
-$(foreach c,$(TARGETS_SLFI_LIBM),filter-slfi-$c$(SHARED_SUFFIX)): $(foreach c,$(TARGETS_SLFI_LIBM),filter-slfi-$c.o)
-	$(CC) $(LDFLAGS) -o $@ $(shell basename $@ $(SHARED_SUFFIX)).o $(LIBS) $(LIBROARLIGHT) $(lib_m)
Index: plugins/universal/debug-notify.c
===================================================================
--- plugins/universal/debug-notify.c	(revision 6052)
+++ 	(revision )
@@ -1,235 +1,0 @@
-//debug-notify.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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 <ctype.h>
-
-static struct roar_subscriber * subscription_client_delete = NULL;
-
-static int command_get_name(int cmd, const char ** name) {
- static const struct {
-  const int cmd;
-  const char * name;
- } cmds[] = {
-  {ROAR_CMD_NOOP,                    "NOOP"},
-  {ROAR_CMD_IDENTIFY,                "IDENTIFY"},
-  {ROAR_CMD_AUTH,                    "AUTH"},
-  {ROAR_CMD_NEW_STREAM,              "NEW_STREAM"},
-  {ROAR_CMD_SET_META,                "SET_META"},
-  {ROAR_CMD_EXEC_STREAM,             "EXEC_STREAM"},
-  {ROAR_CMD_QUIT,                    "QUIT"},
-  {ROAR_CMD_GET_STANDBY,             "GET_STANDBY"},
-  {ROAR_CMD_SET_STANDBY,             "SET_STANDBY"},
-  {ROAR_CMD_SERVER_INFO,             "SERVER_INFO"},
-  {ROAR_CMD_SERVER_STATS,            "SERVER_STATS"},
-  {ROAR_CMD_SERVER_OINFO,            "SERVER_OINFO"},
-  {ROAR_CMD_ADD_DATA,                "ADD_DATA"},
-  {ROAR_CMD_EXIT,                    "EXIT"},
-  {ROAR_CMD_LIST_STREAMS,            "LIST_STREAMS"},
-  {ROAR_CMD_LIST_CLIENTS,            "LIST_CLIENTS"},
-  {ROAR_CMD_GET_CLIENT,              "GET_CLIENT"},
-  {ROAR_CMD_GET_STREAM,              "GET_STREAM"},
-  {ROAR_CMD_KICK,                    "KICK"},
-  {ROAR_CMD_SET_VOL,                 "SET_VOL"},
-  {ROAR_CMD_GET_VOL,                 "GET_VOL"},
-  {ROAR_CMD_CON_STREAM,              "CON_STREAM"},
-  {ROAR_CMD_GET_META,                "GET_META"},
-  {ROAR_CMD_LIST_META,               "LIST_META"},
-  {ROAR_CMD_BEEP,                    "BEEP"},
-  {ROAR_CMD_GET_STREAM_PARA,         "GET_STREAM_PARA"},
-  {ROAR_CMD_SET_STREAM_PARA,         "SET_STREAM_PARA"},
-  {ROAR_CMD_ATTACH,                  "ATTACH"},
-  {ROAR_CMD_DETACH,                  "DETACH"},
-  {ROAR_CMD_PASSFH,                  "PASSFH"},
-  {ROAR_CMD_GETTIMEOFDAY,            "GETTIMEOFDAY"},
-  {ROAR_CMD_WHOAMI,                  "WHOAMI"},
-  {ROAR_CMD_DEVCTL,                  "DEVCTL"},
-  {ROAR_CMD_CAPS,                    "CAPS"},
-  {ROAR_CMD_WAIT,                    "WAIT"},
-  {ROAR_CMD_NOTIFY,                  "NOTIFY"},
-  {ROAR_CMD_SEEK,                    "SEEK"},
-  {ROAR_CMD_CLIENTCTL,               "CLIENTCTL"},
-  {ROAR_CMD_LOOKUP,                  "LOOKUP"},
-  {ROAR_CMD_CONCTL,                  "CONCTL"},
-  {ROAR_CMD_SHIFT_DATA,              "SHIFT_DATA"},
-  {ROAR_CMD_RAUM_SEEKTABLE,          "RAUM_SEEKTABLE"},
-  {ROAR_CMD_RAUM_PICTURE,            "RAUM_PICTURE"},
-  {ROAR_CMD_RAUM_SYNC,               "RAUM_SYNC"},
-  {ROAR_CMD_EPERM,                   "EPERM"},
-  {ROAR_CMD_OK_STOP,                 "OK_STOP"},
-  {ROAR_CMD_OK,                      "OK"},
-  {ROAR_CMD_ERROR,                   "ERROR"},
-  {ROAR_CMD_EOL,                     "EOL"}
- };
- size_t i;
-
- for (i = 0; i < (sizeof(cmds)/sizeof(*cmds)); i++) {
-  if ( cmds[i].cmd == cmd ) {
-   *name = cmds[i].name;
-   return 0;
-  }
- }
-
- roar_err_set(ROAR_ERROR_NOENT);
- return -1;
-}
-
-static void dbg_notify_cb(struct roar_notify_core * core, struct roar_event * event, void * userdata) {
- char buf[1024] = "";
- char estr[1024] = "/* ROAR_??? */";
- char ttstr[1024] = "/* ROAR_OT_??? */";
- const char * ttname;
- uint32_t ev = ROAR_EVENT_GET_TYPE(event);
- int i;
-
- ttname = roar_ot2str(event->target_type);
- if ( ttname != NULL ) {
-  snprintf(ttstr, sizeof(ttstr)-1, "/* ROAR_OT_%s */", ttname);
-  buf[sizeof(ttstr)-1] = 0;
-  for (i = 0; ttstr[i] != 0; i++)
-   if ( islower(ttstr[i]) )
-    ttstr[i] = toupper(ttstr[i]);
- }
-
- if ( ev == ROAR_NOTIFY_SPECIAL ) {
-  snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_SPECIAL */");
- } else if ( ROAR_NOTIFY_IS_CMD(ev) ) {
-  if ( command_get_name(ROAR_NOTIFY_EVENT2CMD(ev), &ttname) == -1 ) {
-   snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_CMD2EVENT(%lu) */", (long unsigned int)ROAR_NOTIFY_EVENT2CMD(ev));
-  } else {
-   snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_CMD2EVENT(ROAR_CMD_%s) */", ttname);
-   for (i = 0; estr[i] != 0; i++)
-    if ( islower(estr[i]) )
-     estr[i] = toupper(estr[i]);
-  }
- } else if ( ROAR_NOTIFY_IS_EGRP(ev) ) {
-  snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_EGRP2EVENT(%lu) */", (long unsigned int)ROAR_NOTIFY_EVENT2EGRP(ev));
- } else if ( ROAR_NOTIFY_IS_OE(ev) ) {
-  switch (ev) {
-   // OE basics:
-   case ROAR_OE_BASICS_CHANGE_STATE:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_BASICS_CHANGE_STATE */");
-    break;
-   case ROAR_OE_BASICS_CHANGE_FLAGS:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_BASICS_CHANGE_FLAGS */");
-    break;
-   case ROAR_OE_BASICS_NEW:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_BASICS_NEW */");
-    break;
-   case ROAR_OE_BASICS_DELETE:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_BASICS_DELETE */");
-    break;
-   // OE Streams:
-   case ROAR_OE_STREAM_CHANGE_VOLUME:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_STREAM_CHANGE_VOLUME */");
-    break;
-   case ROAR_OE_STREAM_XRUN:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_STREAM_XRUN */");
-    break;
-   case ROAR_OE_STREAM_META_UPDATE:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_OE_STREAM_META_UPDATE */");
-    break;
-   // OE Default:
-   default:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_OE2EVENT(%lu) */", (long unsigned int)ROAR_NOTIFY_EVENT2OE(ev));
-    break;
-  }
- } else if ( ROAR_NOTIFY_IS_DATA(ev) ) {
-  switch (ev) {
-   case ROAR_DATA_DMX512_CHANNEL_UPDATE:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_DATA_DMX512_CHANNEL_UPDATE */");
-    break;
-   case ROAR_DATA_DMX512_EVENT:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_DATA_DMX512_EVENT */");
-    break;
-   // DATA Default:
-   default:
-     snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_EVENT2DATA(ROAR_DATA_GROUP(%s) + %lu) */", roar_dir2str(ROAR_DATA_EVENT2DIR(ROAR_NOTIFY_EVENT2DATA(ev))), (long unsigned int)ROAR_DATA_EVENT2EVENT(ROAR_NOTIFY_EVENT2DATA(ev)));
-    break;
-  }
- } else if ( ROAR_NOTIFY_IS_USER(ev) ) {
-  snprintf(estr, sizeof(estr)-1, "/* ROAR_NOTIFY_USER2EVENT(%lu) */", (long unsigned int)ROAR_NOTIFY_EVENT2USER(ev));
- }
-
- buf[sizeof(estr)-1] = 0;
-
- if ( event->flags & ROAR_EVENT_FLAG_PROXYEVENT ) {
-  snprintf(buf, sizeof(buf)-1, ".event_proxy=0x%.8x%s, ", (int)event->event_proxy, estr);
-  buf[sizeof(buf)-1] = 0;
- }
-
- roar_debug_msg(ROAR_DEBUG_TYPE_DEBUG, __LINE__, __FILE__, ROAR_DBG_PREFIX, "dbg_notify_cb(core=%p, event=%p{.flags=0x%.8x, event=0x%.8x%s, %s.emitter=%i, .target=%i, .target_type=%i%s, .arg0=%i, .arg1=%i, .arg2=%p}, userdata=%p) = (void)",
-           core, event,
-           (int)event->flags,
-           (int)event->event,
-           (event->flags & ROAR_EVENT_FLAG_PROXYEVENT ? "" : estr),
-           buf,
-           event->emitter,
-           event->target,
-           event->target_type,
-           ttstr,
-           event->arg0,
-           event->arg1,
-           event->arg2,
-           userdata);
-}
-
-static int init(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- struct roar_event event;
-
- (void)para, (void)lib;
-
- memset(&event, 0, sizeof(event));
-
- event.event = ROAR_EGRP_ANY_EVENT;
-
- event.emitter = -1;
- event.target = -1;
- event.target_type = -1;
-
- subscription_client_delete = roar_notify_core_subscribe(NULL, &event, dbg_notify_cb, NULL);
-
- return 0;
-}
-
-static int unload(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
-
- roar_notify_core_unsubscribe(NULL, subscription_client_delete);
-
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(debug_notify) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("debug-notify", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This plugin will print all messages passed via notify bus");
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_INIT, init);
- ROAR_DL_PLUGIN_REG_UNLOAD(unload);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-alternative.c
===================================================================
--- plugins/universal/filter-slfi-alternative.c	(revision 6052)
+++ 	(revision )
@@ -1,184 +1,0 @@
-//filter-slfi-alternative.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_FILTER  32
-
-struct slfi_alternative {
- struct roar_slfi_inst * filter[MAX_FILTER];
- size_t filter_len;
- size_t current;
- ssize_t channel;
- uint8_t event;
-};
-
-static int __cb_event_add(struct roar_slfi_inst * inst, void * userdata, uint8_t event) {
- (void)inst;
- return roar_slfi_event_add(userdata, event);
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_alternative * self = roar_mm_malloc(sizeof(struct slfi_alternative));
- const struct roar_keyval * kv;
- ssize_t i;
-
- if ( self == NULL )
-  return -1;
-
- self->filter_len =  0;
- self->current    =  0;
- self->channel    = -1;
- self->event      = ROAR_ROARDMX_EVENT_STEP;
- inst->userdata = self;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-  if ( !strcmp(kv->key, "channel") ) {
-   self->channel = atoi(kv->value);
-   if ( self->channel < 0 )
-    self->channel = 0;
-  } else if ( !strcmp(kv->key, "event") ) {
-   self->event = roar_roardmx_str2event(kv->value);
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static int __uninit(struct roar_slfi_inst * inst) {
- struct slfi_alternative * self = inst->userdata;
- size_t i;
-
- for (i = 0; i < self->filter_len; i++) {
-  roar_slfi_unref(self->filter[i]);
- }
-
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_alternative * self = inst->userdata;
- size_t i;
-
- // Don't do anything if we have no childs:
- if ( self->filter_len == 0 )
-  return 0;
-
- if ( self->channel == (ssize_t)-1 ) {
-  for (i = 0; i < eventlen; i++) {
-   if ( event[i] == self->event ) {
-    self->current++;
-    if ( self->current == self->filter_len )
-     self->current = 0;
-    break;
-   }
-  }
- } else if ( size_of_universe > self->channel ) {
-  self->current = universe[self->channel] / self->filter_len;
-  if ( self->current >= self->filter_len )
-   self->current = self->filter_len - 1;
- } else {
-  ROAR_WARN("__update(*): Universe too small for filter (source channel=%lu).", (unsigned long int)self->channel);
-  roar_err_set(ROAR_ERROR_NOENT);
-  return -1;
- }
-
- return roar_slfi_update(self->filter[self->current], universe, size_of_universe, usecspassed, event, eventlen);
-}
-
-static int __ctl(struct roar_slfi_inst * inst, enum roar_slfi_command command, void * argp) {
- struct slfi_alternative * self = inst->userdata;
-
- switch (command) {
-  case ROAR_SLFI_CMD_PUSH:
-    if ( self->filter_len == MAX_FILTER ) {
-     roar_err_set(ROAR_ERROR_NOSPC);
-     return -1;
-    }
-    if ( roar_slfi_ref(argp) == -1 )
-     return -1;
-    roar_slfi_cb_set_event_add(argp, __cb_event_add, inst);
-    self->filter[self->filter_len++] = argp;
-    return 0;
-   break;
-#ifndef DEBUG
-  default:
-   break;
-#endif
- }
-
- roar_err_set(ROAR_ERROR_BADRQC);
- return -1;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "alternative",
-  .description = "Alternative SLFI filter",
-  .flags = ROAR_SLFI_FLAG_NONE,
-  .init = __init,
-  .uninit = __uninit,
-  .update = __update,
-  .ctl = __ctl
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_alternative) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-alternative", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This is a container plugin for SLFI filter alternatives.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-calc.c
===================================================================
--- plugins/universal/filter-slfi-calc.c	(revision 6052)
+++ 	(revision )
@@ -1,420 +1,0 @@
-//filter-slfi-calc.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_CHANNELS_IN 8
-
-enum slfi_calctype {
- CT_NULL = 0,
- CT_ADD,
- CT_SUB,
- CT_MUL,
- CT_DIV,
- CT_MOD,
- CT_LOG,
- CT_EXP,
- CT_SQRT,
- CT_POW,
- CT_SUM,  // sum of all samples
- CT_DXDT  // dx/dt.
-};
-
-enum slfi_numbersystem {
- NS_AUTO = 0,
- NS_CLIP,
- NS_SCALE
-};
-
-// flags:
-#define CF_NONE              0x00000000U
-#define CF_I                 0x00000001U
-#define CF_ABS               0x00000002U
-
-struct slfi_calc {
- enum slfi_calctype ct;
- enum slfi_numbersystem ns;
- uint32_t flags;
- int_least32_t i; // i-flag register
- int_least32_t c; // register to store inter-interval values.
- ssize_t channel_out;
- ssize_t channel_in[MAX_CHANNELS_IN];
- ssize_t channel_in_num;
-};
-
-static inline void __init_calc(struct slfi_calc * calc) {
- size_t i;
-
- memset(calc, 0, sizeof(*calc));
-
- calc->ct = CT_NULL;
- calc->ns = NS_AUTO;
- calc->flags = CF_NONE;
- calc->i = 0;
- calc->c = 0;
- calc->channel_out = -1;
- calc->channel_in_num = 0;
-
- for (i = 0; i < MAX_CHANNELS_IN; i++)
-  calc->channel_in[i] = -1;
-}
-
-static int __push_calc(const struct slfi_calc * calc, struct slfi_calc ** array, size_t * arraylen, size_t * arrayptr) {
- struct slfi_calc * new;
- int err;
- size_t i;
-
- if ( *arrayptr == *arraylen ) {
-  new = roar_mm_realloc(*array, sizeof(struct slfi_calc)*(*arraylen + 8));
-  err = roar_error;
-  if ( new == NULL ) {
-   roar_mm_free(*array);
-   roar_err_set(err);
-   *array = NULL;
-   *arraylen = 0;
-   *arrayptr = 0;
-   return -1;
-  }
-  for (i = *arrayptr + 1; i < (*arrayptr + 8); i++)
-   __init_calc(&(new[i]));
-  *array = new;
-  *arraylen += 8;
- }
-
- (*array)[*arrayptr] = *calc;
- (*arrayptr)++;
- return 0;
-}
-
-static inline enum slfi_calctype __parse_calc_ct(const char * str, const char ** flags) {
- const struct {
-  const char * name;
-  const enum slfi_calctype ct;
- } *p, __table[] = {
-  {"NULL", CT_NULL},
-  {"add", CT_ADD},
-  {"sub", CT_SUB},
-  {"mul", CT_MUL},
-  {"div", CT_DIV},
-  {"mod", CT_MOD},
-  {"log", CT_LOG},
-  {"exp", CT_EXP},
-  {"sqrt", CT_SQRT},
-  {"pow", CT_POW},
-  {"sum", CT_SUM},
-  {"dxdt", CT_DXDT},
-  {NULL, CT_NULL} // list terminator.
- };
- ssize_t len;
-
- for (p = __table; p->name != NULL; p++) {
-  len = roar_mm_strlen(p->name);
-  if ( !strncasecmp(str, p->name, len) ) {
-   *flags = str+len;
-   return p->ct;
-  }
- }
- *flags = NULL;
- return CT_NULL;
-}
-
-static inline const struct slfi_calc * __parse_calc(const char * key, const char * value) {
- static struct slfi_calc calc;
- const char * flags;
- char * valbuf, * cur, * saveptr;
- size_t i;
- int found_error = 0;
-
- if ( !*value )
-  return NULL;
-
- __init_calc(&calc);
-
-/*
- calc->i = 0;
- calc->channel_out = -1;
-*/
-
- calc.ct = __parse_calc_ct(key, &flags);
- if ( calc.ct == CT_NULL )
-  return NULL;
-
- if ( flags != NULL ) {
-  for (; *flags; flags++) {
-   switch (*flags) {
-    // normal flags:
-    case 'i': calc.flags |= CF_I; break;
-    case 'a': calc.flags |= CF_ABS; break;
-
-    // system:
-    case 's': calc.ns = NS_SCALE; break;
-    case 'c': calc.ns = NS_CLIP; break;
-    default:
-     ROAR_ERR("__parse_calc(key='%s', value='%s'): Unknown flag: %c", key, value, *flags);
-     return NULL;
-   }
-  }
- }
-
- valbuf = roar_mm_strdup(value);
- if ( valbuf == NULL )
-  return NULL;
- 
- cur = roar_mm_strtok_r(valbuf, ":", &saveptr);
-
- calc.channel_out = atoi(cur);
-
- i = 0;
- while ((cur = roar_mm_strtok_r(NULL, ":", &saveptr)) != NULL) {
-  calc.channel_in[i] = atoi(cur);
-  calc.channel_in_num++;
-  if ( calc.channel_in[i] < 0 || (i+1) == MAX_CHANNELS_IN ) {
-   found_error = 1;
-   break;
-  }
-  i++;
- }
-
- roar_mm_free(valbuf);
-
- if ( found_error )
-  return NULL;
-
- if ( calc.flags & CF_I ) {
-  for (i = 1; i < MAX_CHANNELS_IN; i++) {
-   if ( calc.channel_in[i] == -1 ) {
-    calc.i = calc.channel_in[i-1];
-    calc.channel_in[i-1] = -1;
-    calc.channel_in_num--;
-    break;
-   }
-  }
- }
-
- if ( calc.ct == CT_NULL || calc.ns == NS_AUTO || calc.channel_out < 0 )
-  return NULL;
- return &calc;
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- const struct slfi_calc * calc;
- struct slfi_calc * array = NULL;
- size_t arraylen = 0;
- size_t arrayptr = 0;
- const struct roar_keyval * kv;
- ssize_t i;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-
-  if ( (calc = __parse_calc(kv->key, kv->value)) != NULL ) {
-   if ( __push_calc(calc, &array, &arraylen, &arrayptr) == -1 ) {
-    ROAR_ERR("__init(*): Can not add more calculations: %s", roar_errorstring);
-    return -1;
-   }
-//  } else if ( !strcmp(kv->key, "") ) {
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- inst->userdata = array;
- return 0;
-}
-
-static inline int_least32_t __calc_step(int_least32_t val, uint8_t in, enum slfi_calctype ct, enum slfi_numbersystem ns) {
- switch (ct) {
-  case CT_SUM:
-  case CT_ADD: val += in; break;
-  case CT_SUB: val -= in; break;
-  case CT_MUL: val *= in; break;
-  case CT_DIV: val /= in; break;
-  case CT_MOD: val %= in; break;
-  default:
-    roar_panic(ROAR_FATAL_ERROR_CPU_FAILURE, NULL); // we should never reach this point at all.
-   break;
- }
-
- switch (ns) {
-  case NS_AUTO: break;
-  case NS_CLIP:
-    if ( val > 255 ) {
-     val = 255;
-    } else if ( val < 0 ) {
-     val = 0;
-    }
-   break;
-  case NS_SCALE:
-    switch (ct) {
-     case CT_MUL:
-       val /= 255;
-      break;
-     default: /* NOOPs */; break;
-    }
-   break;
- }
-
- return val;
-}
-
-static inline void __calc(struct slfi_calc * calc, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed) {
- int_least32_t val = 0;
- ssize_t i;
-
- (void)usecspassed; // needed for CT_DXDT.
-
- if ( calc->channel_out >= size_of_universe ) {
-  ROAR_WARN("__calc(*): Output channel outside universe!");
-  return;
- }
-
- if ( calc->channel_in_num ) {
-  if ( calc->channel_in[0] >= size_of_universe ) {
-   ROAR_WARN("__calc(*): Initial Input channel outside universe!");
-   return;
-  }
-  val = universe[calc->channel_in[0]];
- } else if ( calc->flags & CF_I ) {
-  val = calc->i;
- }
-
- switch (calc->ct) {
-  case CT_NULL: return; break;
-  case CT_LOG:
-  case CT_SQRT:
-  case CT_POW:
-  case CT_DXDT:
-    ROAR_ERR("__calc(*): Operation not supported");
-    return;
-   break;
-  case CT_SUM:
-    val += calc->c;
-  case CT_ADD:
-  case CT_SUB:
-  case CT_MUL:
-  case CT_DIV:
-  case CT_MOD:
-  case CT_EXP:
-    for (i = 1; i < calc->channel_in_num; i++) {
-     if ( calc->channel_in[i] >= size_of_universe ) {
-      ROAR_WARN("__calc(*): Input channel outside universe!");
-      return;
-     }
-     val = __calc_step(val, universe[calc->channel_in[i]], calc->ct, calc->ns);
-    }
-
-    if ( calc->channel_in_num && calc->flags & CF_I ) {
-     ROAR_DBG("__calc(*): calc->channel_in_num=%i, calc->i=%i", (int)calc->channel_in_num, (int)calc->i);
-     val = __calc_step(val, calc->i, calc->ct, calc->ns);
-    }
-   break;
- }
-
- switch (calc->ct) {
-  case CT_NULL: break;
-  case CT_SUM:
-    calc->c = val;
-   break;
-  case CT_ADD:
-  case CT_SUB:
-    if ( calc->ns == NS_SCALE )
-     val /= calc->channel_in_num + (calc->flags & CF_I ? 1 : 0);
-   break;
-  // NOOPs:
-  case CT_MUL:
-  case CT_DIV:
-  case CT_MOD:
-  case CT_EXP:
-   break;
-  default:
-    ROAR_ERR("__calc(*): Operation not supported");
-   break;
- }
-
- if ( calc->flags & CF_ABS )
-  val = abs(val);
-
- universe[calc->channel_out] = val;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_calc * self = inst->userdata;
-
- (void)event, (void)eventlen;
-
- while (self->channel_out != -1) {
-  __calc(self, universe, size_of_universe, usecspassed);
-  self++;
- }
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "calc",
-  .description = "Calc SLFI filter",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_calc) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-calc", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin calculates values of channels.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-chain.c
===================================================================
--- plugins/universal/filter-slfi-chain.c	(revision 6052)
+++ 	(revision )
@@ -1,147 +1,0 @@
-//filter-slfi-chain.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_FILTER  32
-
-struct slfi_chain {
- struct roar_slfi_inst * filter[MAX_FILTER];
- size_t filter_len;
-};
-
-static int __cb_event_add(struct roar_slfi_inst * inst, void * userdata, uint8_t event) {
- (void)inst;
- return roar_slfi_event_add(userdata, event);
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_chain * self = roar_mm_malloc(sizeof(struct slfi_chain));
-
- (void)para, (void)paralen;
-
- if ( self == NULL )
-  return -1;
-
- self->filter_len = 0;
- inst->userdata = self;
-
- return 0;
-}
-
-static int __uninit(struct roar_slfi_inst * inst) {
- struct slfi_chain * self = inst->userdata;
- size_t i;
-
- for (i = 0; i < self->filter_len; i++) {
-  roar_slfi_unref(self->filter[i]);
- }
-
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_chain * self = inst->userdata;
- size_t i;
- int ret;
-
- for (i = 0; i < self->filter_len; i++) {
-  ret = roar_slfi_update(self->filter[i], universe, size_of_universe, usecspassed, event, eventlen);
-  if ( ret != 0 )
-   return ret;
- }
-
- return 0;
-}
-
-static int __ctl(struct roar_slfi_inst * inst, enum roar_slfi_command command, void * argp) {
- struct slfi_chain * self = inst->userdata;
-
- switch (command) {
-  case ROAR_SLFI_CMD_PUSH:
-    if ( self->filter_len == MAX_FILTER ) {
-     roar_err_set(ROAR_ERROR_NOSPC);
-     return -1;
-    }
-    if ( roar_slfi_ref(argp) == -1 )
-     return -1;
-    roar_slfi_cb_set_event_add(argp, __cb_event_add, inst);
-    self->filter[self->filter_len++] = argp;
-    return 0;
-   break;
-#ifndef DEBUG
-  default:
-   break;
-#endif
- }
-
- roar_err_set(ROAR_ERROR_BADRQC);
- return -1;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "chain",
-  .description = "Chain SLFI filter",
-  .flags = ROAR_SLFI_FLAG_NONE,
-  .init = __init,
-  .uninit = __uninit,
-  .update = __update,
-  .ctl = __ctl
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_chain) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-chain", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This is a container plugin for SLFI filter chains.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-channel2event.c
===================================================================
--- plugins/universal/filter-slfi-channel2event.c	(revision 6052)
+++ 	(revision )
@@ -1,179 +1,0 @@
-//filter-slfi-channel2event.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define FLAG_BLACKOUT   0x0001
-#define FLAG_FULLON     0x0002
-
-struct slfi_channel2event {
- ssize_t channel;
- uint8_t lastvalue;
- uint8_t event;
- int flags;
- int emitting;
-};
-
-static int __str2bool(const char * str) {
- if ( *str == 'y' || *str == 'j' || *str == '1' || *str == 't' )
-  return 1;
- return 0;
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_channel2event * self = roar_mm_malloc(sizeof(struct slfi_channel2event));
- const struct roar_keyval * kv;
- ssize_t i;
-
- if ( self == NULL )
-  return -1;
-
- self->channel    = -1;
- self->lastvalue  =  0;
- self->event      = ROAR_ROARDMX_EVENT_STEP;
- self->flags      = FLAG_BLACKOUT|FLAG_FULLON;
- self->emitting   =  0;
- inst->userdata = self;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-  if ( !strcmp(kv->key, "channel") ) {
-   self->channel = atoi(kv->value);
-   if ( self->channel < 0 )
-    self->channel = 0;
-  } else if ( !strcmp(kv->key, "event") ) {
-   self->event = roar_roardmx_str2event(kv->value);
-  } else if ( !strcmp(kv->key, "blackout") ) {
-   self->flags |= FLAG_BLACKOUT;
-   if ( !__str2bool(kv->value) )
-    self->flags -= FLAG_BLACKOUT;
-  } else if ( !strcmp(kv->key, "fullon") ) {
-   self->flags |= FLAG_BLACKOUT;
-   if ( !__str2bool(kv->value) )
-    self->flags -= FLAG_BLACKOUT;
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_channel2event * self = inst->userdata;
- register uint8_t value;
-
- (void)usecspassed, (void)event, (void)eventlen;
-
- if ( self->channel >= size_of_universe ) {
-  ROAR_WARN("__update(*): Universe too small for filter (source channel=%lu).", (unsigned long int)self->channel);
-  roar_err_set(ROAR_ERROR_INVAL);
-  return -1;
- }
-
- value = universe[self->channel];
- if ( (self->flags & FLAG_BLACKOUT) && value == 0x00 ) {
-  if ( self->emitting & FLAG_FULLON ) {
-   roar_slfi_event_add(inst, ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_OFF);
-   self->emitting -= FLAG_FULLON;
-  }
-  if ( !(self->emitting & FLAG_BLACKOUT) ) {
-   roar_slfi_event_add(inst, ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_ON);
-   self->emitting |= FLAG_BLACKOUT;
-  }
- } else if ( (self->flags & FLAG_FULLON) && value == 0xFF ) {
-  if ( self->emitting & FLAG_BLACKOUT ) {
-   roar_slfi_event_add(inst, ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_OFF);
-   self->emitting -= FLAG_BLACKOUT;
-  }
-  if ( !(self->emitting & FLAG_FULLON) ) {
-   roar_slfi_event_add(inst, ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_ON);
-   self->emitting |= FLAG_FULLON;
-  }
- } else {
-  if ( self->emitting & FLAG_BLACKOUT ) {
-   roar_slfi_event_add(inst, ROAR_ROARDMX_EVENT_BLACKOUT|ROAR_ROARDMX_ETYPE_OFF);
-   self->emitting -= FLAG_BLACKOUT;
-  }
-
-  if ( self->emitting & FLAG_FULLON ) {
-   roar_slfi_event_add(inst, ROAR_ROARDMX_EVENT_FULLON|ROAR_ROARDMX_ETYPE_OFF);
-   self->emitting -= FLAG_FULLON;
-  }
-
-  if ( value != self->lastvalue )
-   roar_slfi_event_add(inst, self->event);
-  self->lastvalue = value;
- }
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "channel2event",
-  .description = "SLFI filter mapping channel data to events",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_channel2event) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-channel2event", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin allows to map DMX channel data to RoarDMX events.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-fade.c
===================================================================
--- plugins/universal/filter-slfi-fade.c	(revision 6052)
+++ 	(revision )
@@ -1,367 +1,0 @@
-//filter-slfi-fade.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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 <math.h>
-
-enum slfi_function {
- FUNC_STEP = 0,
- FUNC_LIN,
- FUNC_COS
-// FUNC_LOWPASS
-};
-
-struct slfi_channel {
- // config:
- ssize_t index;
- enum    slfi_function func;
- double  exponent;
- int32_t time_base;
- ssize_t time_channel; // if not -1: time_end = time_base * valueof(time_channel)/255.
- ssize_t time_channelblack; // if not -1: time_black = time_end * valueof(time_channelblack)/255.
- double  time_black_point;
- int32_t time_end;
- int32_t time_black;
- ssize_t trigger_channel;
- uint8_t trigger_event;
- // state:
- int32_t t;
- uint8_t value_old;
- uint8_t value_trigger;
-};
-
-static enum slfi_function __str2func (const char * str) {
- if ( !strcasecmp(str, "step") ) {
-  return FUNC_STEP;
- } else if ( !strcasecmp(str, "lin") ) {
-  return FUNC_LIN;
- } else if ( !strcasecmp(str, "cos") ) {
-  return FUNC_COS;
-/*
- } else if ( !strcasecmp(str, "lowpass") ) {
-  return FUNC_LOWPASS;
-*/
- } else {
-  ROAR_WARN("__str2func(str='%s'): Unknown function, defaulting to linear fade", str);
-  return FUNC_LIN;
- }
-}
-
-static void __init_chan(struct slfi_channel * chan) {
- memset(chan, 0, sizeof(*chan));
- chan->index = -1;
- chan->func = FUNC_LIN;
- chan->exponent = 1.;
- chan->time_base = 1000000L;
- chan->time_channel = -1;
- chan->time_channelblack = -1;
- chan->time_black_point = -1;
- chan->time_end = chan->time_base;
- chan->time_black = -1;
- chan->trigger_channel = -1;
- chan->trigger_event = ROAR_ROARDMX_EVENT_STEP;
- chan->t = -1;
- chan->value_old = 0;
- chan->value_trigger = 0;
-}
-
-static int __push_chan(struct slfi_channel * chan, struct slfi_channel ** array, size_t * arraylen, size_t * arrayptr) {
- struct slfi_channel * new;
- int err;
- size_t i;
-
- if ( (*arrayptr + 1) >= *arraylen ) {
-  new = roar_mm_realloc(*array, sizeof(struct slfi_channel)*(*arraylen + 8));
-  err = roar_error;
-  if ( new == NULL ) {
-   roar_mm_free(array);
-   roar_err_set(err);
-   *array = NULL;
-   *arraylen = 0;
-   *arrayptr = 0;
-   return -1;
-  }
-  for (i = *arrayptr + 1; i < (*arrayptr + 8); i++)
-   __init_chan(&(new[i]));
-  *array = new;
-  *arraylen += 8;
- }
-
- (*array)[*arrayptr] = *chan;
- (*arrayptr)++;
- return 0;
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- const struct roar_keyval * kv;
- ssize_t i;
- struct slfi_channel chan;
- struct slfi_channel * array = NULL;
- size_t arraylen = 0;
- size_t arrayptr = 0;
-
- __init_chan(&chan);
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-
-  if ( !strcmp(kv->key, "channel") ) {
-   if ( chan.index != -1 ) {
-    if ( __push_chan(&chan, &array, &arraylen, &arrayptr) == -1 ) {
-     ROAR_ERR("__init(*): Can not add more channels: %s", roar_errorstring);
-     return -1;
-    }
-   }
-   chan.index = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "exponent") ) {
-   chan.exponent = atof(kv->value);
-  } else if ( !strcmp(kv->key, "timebase") ) {
-   chan.time_base = roar_str2usec(kv->value);
-  } else if ( !strcmp(kv->key, "time") ) {
-   chan.time_end = roar_str2usec(kv->value);
-  } else if ( !strcmp(kv->key, "time_black_point") ) {
-   if ( !strcmp(kv->value, "none") ) {
-    chan.time_black_point = -1;
-   } else {
-    chan.time_black_point = atof(kv->value);
-    if ( chan.time_black_point <= 0. ) chan.time_black_point = -1.;
-    if ( chan.time_black_point >= 1. ) chan.time_black_point = -1.;
-   }
-  } else if ( !strcmp(kv->key, "timechannel") ) {
-   chan.time_channel = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "timechannelblack") ) {
-   chan.time_channelblack = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "triggerchannel") ) {
-   chan.trigger_channel = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "triggerevent") ) {
-   chan.trigger_event = roar_roardmx_str2event(kv->value);
-  } else if ( !strcmp(kv->key, "function") ) {
-   chan.func = __str2func(kv->value);
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- if ( chan.index != -1 ) {
-  if ( __push_chan(&chan, &array, &arraylen, &arrayptr) == -1 ) {
-   ROAR_ERR("__init(*): Can not add more channels: %s", roar_errorstring);
-   return -1;
-  }
- }
-
- inst->userdata = array;
- return 0;
-}
-
-static double __func_calc(enum slfi_function func, double a) {
- switch (func) {
-  case FUNC_STEP:
-     return a > 0.999 ? 1. : 0.; // allow some error here. Error should be 1/255.
-    break;
-  case FUNC_LIN:
-    return a;
-   break;
-  case FUNC_COS:
-    return (1.-cos(M_PI*a))/2.;
-   break;
- }
-
- // error.
- return 1.;
-}
-
-static double __time_back_to_t1(int32_t t) {
- if ( t > 0 )
-  return (double)t;
- return 0;
-}
-
-static uint8_t __channel_calc(struct slfi_channel * chan, uint8_t value, int32_t usecspassed, const uint8_t * event, size_t eventlen, uint8_t * universe, ssize_t size_of_universe) {
- int have_trigger = 0;
- size_t i;
- double value_old, value_new;
- double a;
- double t1;
-
- if ( chan->trigger_channel >= 0 ) {
-  if ( chan->trigger_channel >= size_of_universe ) {
-   ROAR_WARN("__channel_calc(*): Universe too small for filter.");
-   have_trigger = 0;
-  } else {
-   if ( universe[chan->trigger_channel] != chan->value_trigger ) {
-    chan->value_trigger = universe[chan->trigger_channel];
-    have_trigger = 1;
-   }
-  }
- } else {
-  for (i = 0; i < eventlen; i++) {
-   if ( event[i] == chan->trigger_event || event[i] == (chan->trigger_event | ROAR_ROARDMX_ETYPE_ON) ) {
-    have_trigger = 1;
-    break;
-   }
-  }
- }
-
- ROAR_DBG("__channel_calc(*): chan={.time=%li, .time_end=%li, ...}, have_trigger=%i", (long int)chan->t, (long int)chan->time_end, have_trigger);
-
- // are we currently fading?
- if ( chan->t < 0 && !have_trigger )
-  return chan->value_old; // no, just return current value.
-
- // yes, keep calcing:
- if ( have_trigger && chan->t < 0 )
-  chan->t = 0;
-
- // recaculate timings.
- if ( chan->time_channel >= 0 ) {
-  if ( chan->time_channel >= size_of_universe ) {
-   ROAR_WARN("__channel_calc(*): Universe too small for filter.");
-   chan->time_end = 0;
-  } else {
-   chan->time_end = (chan->time_base * (int32_t)universe[chan->time_channel]) / 255;
-  }
- }
-
- if ( chan->time_channelblack != -1 ) {
-  if ( chan->time_channelblack >= size_of_universe ) {
-   ROAR_WARN("__channel_calc(*): Universe too small for filter.");
-   chan->time_black = -1;
-  } else {
-   chan->time_black = (chan->time_end * (int32_t)universe[chan->time_channelblack]) / 255;
-  }
- } else {
-  chan->time_black = chan->time_end * chan->time_black_point;
- }
- ROAR_DBG("__channel_calc(*): chan->time_black=%li", (long int)chan->time_black);
-
- // calculate value.
- if ( chan->t >= chan->time_end ) {
-  chan->t = -1;
-  a = 1.;
-  value_old = value_new = chan->value_old = value;
- } else if ( chan->t < chan->time_black ) {
-  a = (double)chan->t / (double)chan->time_black;
-  value_old = chan->value_old;
-  value_new = 0.;
- } else {
-  t1 = __time_back_to_t1(chan->time_black);
-  a = ((double)chan->t - t1) / ((double)chan->time_end - t1);
-  value_old = chan->time_black > 0 ? 0 : chan->value_old;
-  value_new = value;
-  if ( a > 1. )
-   a = 1.;
- }
-
- if ( a > 1. ) {
-  a = 1.;
- }
-
- if ( 0 ) { // inverse mode
-  a = 2.*a - __func_calc(chan->func, a);
- } else { // normal mode
-  a = __func_calc(chan->func, a);
- }
-
- a = pow(a, chan->exponent);
- value = value_new = (double)(value_old * (1. - a) + value_new * a);
- if ( value_new > 255. ) value = 255;
- if ( value_new < 0. )   value = 0;
-
- if ( have_trigger ) {
-  chan->value_old = value;
-  chan->t = 0;
- }
-
- if ( chan->t != -1 )
-  chan->t += usecspassed;
-
- return value;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_channel * chan = inst->userdata;
-
- if ( chan == NULL )
-  return 0;
-
- while (chan->index != -1) {
-  ROAR_DBG("__update(*): chan(%p)->index=%i", chan, (int)chan->index);
-  if ( chan->index < 0 && chan->index >= size_of_universe ) {
-   ROAR_WARN("__update(*): Universe too small for filter.");
-   continue;
-  }
-  universe[chan->index] = __channel_calc(chan, universe[chan->index], usecspassed, event, eventlen, universe, size_of_universe);
-  chan++;
- }
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "fade",
-  .description = "Fade SLFI filter",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_fade) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-fade", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin allows to fade between settings");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-file2filter.c
===================================================================
--- plugins/universal/filter-slfi-file2filter.c	(revision 6052)
+++ 	(revision )
@@ -1,237 +1,0 @@
-//filter-slfi-file2filter.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_STACKSIZE 16
-
-static int __cb_event_add(struct roar_slfi_inst * inst, void * userdata, uint8_t event) {
- (void)inst;
- return roar_slfi_event_add(userdata, event);
-}
-
-static struct roar_slfi_inst * __parse_filter(char * p) {
- struct roar_slfi_inst * ret;
- struct roar_keyval * para = NULL;
- ssize_t paralen = -1;
- char * args;
- int err;
-
- args = strstr(p, " ");
- if ( args != NULL ) {
-  *args = 0;
-  args++;
-  // strip spaces:
-  for (; *p == ' '; p++);
-
-  paralen = roar_keyval_split(&para, args, NULL, NULL, 1);
- }
-
- ret = roar_slfi_new(p, 1, para, paralen);
- err = roar_error;
-
- if ( para != NULL )
-  roar_mm_free(para);
-
- roar_err_set(err);
- return ret;
-}
-
-static struct roar_slfi_inst * __parse_vio(struct roar_vio_calls * vio) {
- struct roar_slfi_inst * stack[MAX_STACKSIZE] = {NULL};
- size_t stackpointer = 0;
- size_t i;
- char buf[1024];
- char * p;
- int err = ROAR_ERROR_NONE;
- char * end;
-
- // create root node.
- stack[stackpointer] = roar_slfi_new("chain", 1, NULL, -1);
- if ( stack[stackpointer] == NULL )
-  return NULL;
- stackpointer++;
-
- while ((p = roar_vio_fgets(vio, buf, sizeof(buf))) != NULL) {
-  // strip spaces:
-  for (; *p == ' '; p++);
-
-  // strip newlines.
-  for (end = p; *end; end++) {
-   if ( *end == '\n' || *end == '\r' ) {
-    *end = 0;
-    break;
-   }
-  }
-  // skip comments:
-  if ( *p == '#' )
-   continue;
-  if ( *p == '{' ) {
-   if ( stackpointer == (MAX_STACKSIZE-1) ) {
-    err = ROAR_ERROR_NOSPC;
-    break;
-   }
-   stackpointer++;
-   stack[stackpointer] = NULL;
-  } else if ( *p == '}' ) {
-   if ( stackpointer == 1 ) {
-    err = ROAR_ERROR_ILLSEQ;
-    break;
-   }
-   if ( stack[stackpointer] != NULL ) {
-    roar_slfi_unref(stack[stackpointer]);
-    stack[stackpointer] = NULL;
-   }
-   stackpointer--;
-  } else {
-   if ( stack[stackpointer] != NULL ) {
-    roar_slfi_unref(stack[stackpointer]);
-    stack[stackpointer] = NULL;
-   }
-   stack[stackpointer] = __parse_filter(p);
-   if ( stack[stackpointer] == NULL ) {
-    err = roar_error;
-    break;
-   }
-   if ( roar_slfi_ctl(stack[stackpointer-1], ROAR_SLFI_CMD_PUSH, stack[stackpointer]) == -1 ) {
-    err = roar_error;
-    break;
-   }
-  }
- }
-
- for (i = stackpointer; i; i--)
-  roar_slfi_unref(stack[i]);
-
- if (err != ROAR_ERROR_NONE ) {
-  roar_slfi_unref(stack[0]);
-  stack[0] = NULL;
- }
-
- roar_err_set(err);
- return stack[0];
-}
-
-static struct roar_slfi_inst * __parse_file(const char * file) {
- struct roar_vio_calls vio;
- struct roar_slfi_inst * ret;
- int err;
-
- if ( file == NULL ) {
-  roar_err_set(ROAR_ERROR_INVAL);
-  return NULL;
- }
-
- if ( roar_vio_open_dstr_simple(&vio, file, ROAR_VIOF_READ) == -1 )
-  return NULL;
-
- ret = __parse_vio(&vio);
- err = roar_error;
-
- roar_vio_close(&vio);
-
- roar_err_set(err);
- return ret;
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- const struct roar_keyval * kv;
- const char * filename = NULL;
- ssize_t i;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-  if ( !strcmp(kv->key, "file") ) {
-   filename = kv->value;
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- inst->userdata = __parse_file(filename);
- if ( inst->userdata == NULL )
-  return -1;
-
- roar_slfi_cb_set_event_add(inst->userdata, __cb_event_add, inst);
-
- return 0;
-}
-
-static int __uninit(struct roar_slfi_inst * inst) {
- roar_slfi_unref(inst->userdata);
- inst->userdata = NULL;
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- return roar_slfi_update(inst->userdata, universe, size_of_universe, usecspassed, event, eventlen);
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "file2filter",
-  .description = "SLFI filter structure builder",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = __uninit,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_file2filter) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-file2filter", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin loads SLFI filter structures based on informations store in a file.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-helloworld.c
===================================================================
--- plugins/universal/filter-slfi-helloworld.c	(revision 6052)
+++ 	(revision )
@@ -1,79 +1,0 @@
-//filter-slfi-helloworld.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- (void)inst, (void)usecspassed, (void)event, (void)eventlen;
-
- if ( size_of_universe >= 2 )
-  universe[1] = universe[0]/2;
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "helloworld",
-  .description = "example SLFI filter",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = NULL,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_helloworld) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-helloworld", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin acts as simple example for SLFI plugins.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-map.c
===================================================================
--- plugins/universal/filter-slfi-map.c	(revision 6052)
+++ 	(revision )
@@ -1,248 +1,0 @@
-//filter-slfi-map.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_EVENTS 8
-#define MAX_MAPS   16
-
-enum slfi_maptype {
- // copy=start-end:dest
- MT_COPY,
- // swap=start:dest
- MT_SWAP,
- // inverse=start
- MT_INVERSE
-};
-
-struct slfi_map {
- enum slfi_maptype mt;
- ssize_t src_start;
- ssize_t src_end;
- ssize_t dst_start;
-};
-
-struct slfi_mapinst {
- uint8_t event[MAX_EVENTS][2];
- size_t event_len;
- struct slfi_map map[MAX_MAPS];
- size_t map_len;
-};
-
-static struct slfi_map __parse_map(const char * type, const char * str) {
- struct slfi_map map = {MT_COPY, -1, -1, -1};
- char * buf = roar_mm_strdup(str);
- char * value;
- char * end;
-
- if ( buf == NULL ) {
-  ROAR_ERR("__parse_map(*): Can not allocate memory. Bad.");
-  return map;
- }
-
- if ( !strcmp(type, "copy") || !strcmp(type, "move") || !strcmp(type, "mov") ) {
-  map.mt = MT_COPY;
- } else if ( !strcmp(type, "swap") ) {
-  map.mt = MT_SWAP;
- } else if ( !strcmp(type, "inverse") || !strcmp(type, "inv") ) {
-  map.mt = MT_INVERSE;
- } else {
-  ROAR_ERR("__parse_map(*): Unknown map type: %s", type);
-  return map;
- }
-
- value = strstr(buf, ":");
- if ( value != NULL ) {
-  *value = 0;
-  value++;
-  map.dst_start = atoi(value);
-  if ( map.dst_start < 0 )
-   map.dst_start = 0;
- }
-
- end = strstr(buf, "-");
- if ( end != NULL ) {
-  *end = 0;
-  end++;
- }
-
- map.src_start = atoi(buf);
- if ( map.src_start < 0 )
-  map.src_start = 0;
-
- if ( end != NULL ) {
-  map.src_end = atoi(end);
-  if ( map.src_end < map.src_start )
-   map.src_end = map.src_start;
- }
-
- roar_mm_free(buf);
-
- if ( (map.mt == MT_COPY || map.mt == MT_INVERSE) && map.src_end == -1 )
-  map.src_end = map.src_start;
-
- if ( map.mt != MT_INVERSE && map.dst_start == -1 ) {
-  ROAR_ERR("__parse_map(*): Bad mapping: no destination channel(s) given.");
-  map.src_start = -1;
-  return map;
- }
-
- return map;
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_mapinst * self = roar_mm_malloc(sizeof(struct slfi_mapinst));
- const struct roar_keyval * kv;
- ssize_t i;
-
- if ( self == NULL )
-  return -1;
-
- memset(self, 0, sizeof(*self));
- inst->userdata = self;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-
-  if ( !strcmp(kv->key, "event") ) {
-   ROAR_WARN("__init(*): Can not add event: Not Supported");
-/*
-   if ( self->event_len == MAX_EVENTS ) {
-    ROAR_WARN("__init(*): Can not add (list is full) event: %s", kv->value);
-    continue;
-   }
-   self->event[self->event_len++] = roar_roardmx_str2event(kv->value);
-*/
-  } else if ( !strcmp(kv->key, "copy") || !strcmp(kv->key, "move") || !strcmp(kv->key, "mov") ||
-              !strcmp(kv->key, "swap") ||
-              !strcmp(kv->key, "inverse") || !strcmp(kv->key, "inv") ) {
-   if ( self->map_len == MAX_MAPS ) {
-    ROAR_WARN("__init(*): Can not add (list is full) map: %s=%s", kv->key, kv->value);
-    continue;
-   }
-   self->map[self->map_len++] = __parse_map(kv->key, kv->value);
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_mapinst * self = inst->userdata;
- const struct slfi_map * map;
- size_t i;
- ssize_t j;
- uint8_t tmp;
-
- (void)inst, (void)usecspassed, (void)event, (void)eventlen;
-
- for (i = 0; i < self->event_len; i++) {
-  for (j = 0; j < (ssize_t)eventlen; j++) {
-   if ( self->event[i][0] == event[j] ) {
-    roar_slfi_event_add(inst, self->event[i][1]);
-   }
-  }
- }
-
- for (i = 0; i < self->map_len; i++) {
-  map = &(self->map[i]);
-
-  if ( map->src_start >= size_of_universe || map->src_end >= size_of_universe || map->dst_start >= size_of_universe ) {
-   ROAR_WARN("__update(*): Universe too small for filter.");
-   return 0;
-  }
-
-  if ( map->src_end != -1 && (map->dst_start + map->src_end - map->src_start) >= size_of_universe ) {
-   ROAR_WARN("__update(*): Universe too small for filter.");
-   return 0;
-  }
-
-  switch (map->mt) {
-   case MT_COPY:
-     memcpy(&(universe[map->dst_start]), &(universe[map->src_start]), map->src_end - map->src_start + 1);
-    break;
-   case MT_SWAP:
-     tmp = universe[map->src_start];
-     universe[map->src_start] = universe[map->dst_start];
-     universe[map->dst_start] = tmp;
-    break;
-   case MT_INVERSE:
-     for (j = map->src_start; j <= map->src_end; j++)
-      universe[j] = 255 - universe[j];
-    break;
-  }
- }
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "map",
-  .description = "Map SLFI filter",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_map) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-map", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin maps values between channels.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-random.c
===================================================================
--- plugins/universal/filter-slfi-random.c	(revision 6052)
+++ 	(revision )
@@ -1,210 +1,0 @@
-//filter-slfi-random.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_CHANNELS  64
-
-struct slfi_channel {
- ssize_t channel;
- int32_t time_end;
- int32_t time_cur;
- int32_t time_max;
- uint8_t value_start;
- uint8_t value_end;
-};
-
-struct slfi_random {
- struct slfi_channel channel[MAX_CHANNELS];
- size_t channel_len;
-};
-
-static inline void parse_range(ssize_t * channel, ssize_t * channel_stop, const char * str) {
- char * delm;
- char * buf;
-
- if ( strstr(str, "-") == NULL ) {
-  *channel = atoi(str);
-  *channel_stop = *channel;
-  return;
- }
-
- buf = roar_mm_strdup(str);
- if ( buf == NULL ) {
-  ROAR_WARN("Can not allocate memory: %s", roar_errorstring);
-  *channel = 0;
-  *channel_stop = 0;
-  return;
- }
-
- delm = strstr(buf, "-");
- *delm = 0;
- delm++;
-
- *channel = atoi(buf);
- *channel_stop = atoi(delm);
-
- if ( *channel_stop < *channel )
-  *channel_stop = *channel;
-
- roar_mm_free(buf);
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_random * self = roar_mm_malloc(sizeof(struct slfi_random));
- const struct roar_keyval * kv;
- ssize_t i;
- int32_t time_max = 2000000L;
- ssize_t channel, channel_stop;
-
- if ( self == NULL )
-  return -1;
-
- memset(self, 0, sizeof(*self));
- inst->userdata = self;
-
- for (i = 0; i < (ssize_t)MAX_CHANNELS; i++) {
-  self->channel[i].channel     = -1;
-  self->channel[i].time_end    =  0;
-  self->channel[i].time_cur    =  0;
-  self->channel[i].value_start =  0;
- }
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-
-  if ( !strcmp(kv->key, "time-max") ) {
-   time_max = roar_str2usec(kv->value);
-   if ( time_max < 0 )
-    time_max = 2000000L;
-  } else if ( !strcmp(kv->key, "channel") ) {
-   parse_range(&channel, &channel_stop, kv->value);
-   for (; channel <= channel_stop; channel++) {
-    if ( self->channel_len == MAX_CHANNELS ) {
-     ROAR_WARN("__init(*): Can not add (list is full) channel: %s", kv->value);
-     continue;
-    }
-    self->channel[self->channel_len].channel = channel;
-    self->channel[self->channel_len].time_max = time_max;
-    self->channel_len++;
-   }
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static inline void calc_end(struct slfi_channel * channel) {
- if ( channel->time_cur <= channel->time_end )
-  return;
-
- channel->time_cur = 0;
- channel->time_end = (int32_t)1 + (int32_t)roar_random_uint16() * ((channel->time_max-1) / 65536L);
- channel->value_start = channel->value_end;
-
- if ( roar_random_uint16() < 32768 )
-  return;
-
- channel->value_end = roar_random_uint16() & 0xE0;
-}
-
-static inline uint8_t calc_channel(struct slfi_channel * channel) {
- double trel = (double)channel->time_cur/(double)channel->time_end;
- double valdiff = (double)(channel->value_end - channel->value_start)*trel;
-
- valdiff += (double)channel->value_start;
-
- return (uint8_t)(unsigned int)(int)valdiff;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_random * self = inst->userdata;
- struct slfi_channel * channel;
- size_t i;
-
- (void)inst, (void)event, (void)eventlen;
-
- for (i = 0; i < self->channel_len; i++) {
-  channel = &(self->channel[i]);
-  if ( channel->channel >= size_of_universe ) {
-   ROAR_WARN("__update(*): Universe too small for filter.");
-   continue;
-  }
-  calc_end(channel);
-  universe[channel->channel] = calc_channel(channel);
-  channel->time_cur += usecspassed;
- }
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "random",
-  .description = "Random SLFI filter",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_random) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-random", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin sets random values. It can be used for fireflies or moodlights");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-static.c
===================================================================
--- plugins/universal/filter-slfi-static.c	(revision 6052)
+++ 	(revision )
@@ -1,187 +1,0 @@
-//filter-slfi-static.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_EVENTS   8
-#define MAX_RANGES  32
-
-struct slfi_range {
- ssize_t start;
- ssize_t end;
- uint8_t value;
-};
-
-struct slfi_static {
- uint8_t event[MAX_EVENTS];
- size_t event_len;
- struct slfi_range range[MAX_RANGES];
- size_t range_len;
-};
-
-static struct slfi_range __parse_range(const char * str) {
- struct slfi_range range = {0, 0, 0};
- char * buf = roar_mm_strdup(str);
- char * value;
- char * end;
-
- if ( buf == NULL ) {
-  ROAR_ERR("__parse_range(*): Can not allocate memory. Bad.");
-  return range;
- }
-
- value = strstr(buf, ":");
- if ( value != NULL ) {
-  *value = 0;
-  value++;
-  range.value = atoi(value);
- }
-
- end = strstr(buf, "-");
- if ( end != NULL ) {
-  *end = 0;
-  end++;
- }
-
- range.start = atoi(buf);
- if ( range.start < 0 )
-  range.start = 0;
-
- range.end = range.start;
-
- if ( end != NULL ) {
-  range.end = atoi(end);
-  if ( range.end < range.start )
-   range.end = range.start;
- }
-
- roar_mm_free(buf);
- return range;
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_static * self = roar_mm_malloc(sizeof(struct slfi_static));
- const struct roar_keyval * kv;
- ssize_t i;
-
- if ( self == NULL )
-  return -1;
-
- memset(self, 0, sizeof(*self));
- inst->userdata = self;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-
-  if ( !strcmp(kv->key, "event") ) {
-   if ( self->event_len == MAX_EVENTS ) {
-    ROAR_WARN("__init(*): Can not add (list is full) event: %s", kv->value);
-    continue;
-   }
-   self->event[self->event_len++] = roar_roardmx_str2event(kv->value);
-  } else if ( !strcmp(kv->key, "set") || !strcmp(kv->key, "sset") || !strcmp(kv->key, "clear") ||
-              !strcmp(kv->key, "rangeset") || !strcmp(kv->key, "rangeclear") ) {
-   if ( self->range_len == MAX_RANGES ) {
-    ROAR_WARN("__init(*): Can not add (list is full) range: %s", kv->value);
-    continue;
-   }
-   self->range[self->range_len++] = __parse_range(kv->value);
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_static * self = inst->userdata;
- size_t i;
- ssize_t j;
-
- (void)inst, (void)usecspassed, (void)event, (void)eventlen;
-
- for (i = 0; i < self->event_len; i++)
-  roar_slfi_event_add(inst, self->event[i]);
-
- for (i = 0; i < self->range_len; i++) {
-  for (j = self->range[i].start; j <= self->range[i].end; j++) {
-   if ( j >= size_of_universe ) {
-    ROAR_WARN("__update(*): Universe too small for filter (range=%lu, channel=%lu).", (unsigned long int)i, (unsigned long int)j);
-    break;
-   }
-   universe[j] = self->range[i].value;
-  }
- }
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "static",
-  .description = "Static SLFI filter",
-  .flags = ROAR_SLFI_FLAG_ON_UPDATE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_static) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-static", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin sets static values.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-strobe.c
===================================================================
--- plugins/universal/filter-slfi-strobe.c	(revision 6052)
+++ 	(revision )
@@ -1,167 +1,0 @@
-//filter-slfi-strobe.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-struct slfi_strobe {
- // config:
- ssize_t channel_brightness;
- ssize_t channel_frequency;
- ssize_t channel_trigger;
- uint8_t brightness;
- uint8_t frequency;
- uint8_t event;
-
- // runtime:
- uint8_t value_brightness;
- uint8_t value_frequency;
- uint8_t value_trigger;
-};
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_strobe * self = roar_mm_malloc(sizeof(struct slfi_strobe));
- const struct roar_keyval * kv;
- ssize_t i;
-
- if ( self == NULL )
-  return -1;
-
- memset(self, 0, sizeof(*self));
- self->channel_brightness =  -1;
- self->channel_frequency  =  -1;
- self->channel_trigger    =  -1;
- self->brightness         = 255;
- self->frequency          =  64;
- self->event              = ROAR_ROARDMX_EVENT_STROBE;
- inst->userdata = self;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-  if ( !strcmp(kv->key, "event") ) {
-   self->event = roar_roardmx_str2event(kv->value) & ROAR_ROARDMX_MASK_EVENT;
-  } else if ( !strcmp(kv->key, "brightness") ) {
-   self->brightness = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "frequency") ) {
-   self->frequency = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "brightnesschannel") ) {
-   self->channel_brightness = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "frequencychannel") ) {
-   self->channel_frequency = atoi(kv->value);
-  } else if ( !strcmp(kv->key, "triggerchannel") ) {
-   self->channel_trigger = atoi(kv->value);
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static inline void __set_channel(uint8_t * universe, ssize_t size_of_universe, ssize_t channel, uint8_t value) {
- if ( channel < 0 )
-  return;
- if ( channel >= size_of_universe ) {
-  ROAR_WARN("__set_channel(+): Universe too small for filter. Channel %llu not found.", (long long unsigned int)channel);
-  return;
- }
- universe[channel] = value;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_strobe * self = inst->userdata;
- size_t i;
-
- (void)usecspassed;
-
- for (i = 0; i < eventlen; i++) {
-  switch (event[i]) {
-   case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_BEAT:
-     self->value_trigger += 7; // prime value > 3 for maximum 'random' effect.
-    break;
-   case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_OFF:
-     self->value_brightness = 0;
-     self->value_frequency  = 0;
-    break;
-   case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_ON:
-   case ROAR_ROARDMX_EVENT_STROBE|ROAR_ROARDMX_ETYPE_HOLD:
-     self->value_brightness = self->brightness;
-     self->value_frequency  = self->frequency;
-    break;
-  }
- }
-
- __set_channel(universe, size_of_universe, self->channel_brightness, self->value_brightness);
- __set_channel(universe, size_of_universe, self->channel_frequency,  self->value_frequency);
- __set_channel(universe, size_of_universe, self->channel_trigger,    self->value_trigger);
-
- return 0;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "strobe",
-  .description = "Controls strobes via events",
-  .flags = ROAR_SLFI_FLAG_NONE,
-  .init = __init,
-  .uninit = NULL,
-  .update = __update,
-  .ctl = NULL
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_strobe) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-strobe", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This is a plugin allows to control common strobes via the strobe event.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/filter-slfi-trigger.c
===================================================================
--- plugins/universal/filter-slfi-trigger.c	(revision 6052)
+++ 	(revision )
@@ -1,166 +1,0 @@
-//filter-slfi-trigger.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-#define MAX_FILTER  32
-
-struct slfi_trigger {
- struct roar_slfi_inst * filter;
- uint8_t event;
- int active;
-};
-
-static int __cb_event_add(struct roar_slfi_inst * inst, void * userdata, uint8_t event) {
- (void)inst;
- return roar_slfi_event_add(userdata, event);
-}
-
-static int __init(struct roar_slfi_inst * inst, const struct roar_keyval * para, ssize_t paralen) {
- struct slfi_trigger * self = roar_mm_malloc(sizeof(struct slfi_trigger));
- const struct roar_keyval * kv;
- ssize_t i;
-
- if ( self == NULL )
-  return -1;
-
- self->filter   = NULL;
- self->event    = ROAR_ROARDMX_EVENT_STEP;
- self->active   = 0;
- inst->userdata = self;
-
- for (i = 0; i < paralen; i++) {
-  kv = &(para[i]);
-  if ( kv->key == NULL || kv->value == NULL )
-   continue;
-  if ( !strcmp(kv->key, "event") ) {
-   self->event = roar_roardmx_str2event(kv->value);
-  } else {
-   ROAR_WARN("__init(*): Unknown parameter: %s", kv->key);
-  }
- }
-
- return 0;
-}
-
-static int __uninit(struct roar_slfi_inst * inst) {
- struct slfi_trigger * self = inst->userdata;
-
- roar_slfi_unref(self->filter);
-
- return 0;
-}
-
-static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) {
- struct slfi_trigger * self = inst->userdata;
- size_t i;
- int active = self->active;
-
- // Don't do anything if we have no child:
- if ( self->filter == NULL )
-  return 0;
-
- for (i = 0; i < eventlen; i++) {
-  if ( event[i] == self->event ) {
-   active = 1;
-  } else if ( event[i] == (self->event|ROAR_ROARDMX_ETYPE_ON)   ||
-              event[i] == (self->event|ROAR_ROARDMX_ETYPE_HOLD) ) {
-   self->active = active = 1;
-  } else if ( event[i] == (self->event|ROAR_ROARDMX_ETYPE_OFF) ) {
-   self->active = active = 0;
-  }
- }
-
- if ( !active )
-  return 0;
-
- return roar_slfi_update(self->filter, universe, size_of_universe, usecspassed, event, eventlen);
-}
-
-static int __ctl(struct roar_slfi_inst * inst, enum roar_slfi_command command, void * argp) {
- struct slfi_trigger * self = inst->userdata;
-
- switch (command) {
-  case ROAR_SLFI_CMD_PUSH:
-    if ( roar_slfi_ref(argp) == -1 )
-     return -1;
-    roar_slfi_cb_set_event_add(argp, __cb_event_add, inst);
-    self->filter = argp;
-    return 0;
-   break;
-#ifndef DEBUG
-  default:
-   break;
-#endif
- }
-
- roar_err_set(ROAR_ERROR_BADRQC);
- return -1;
-}
-
-static const struct roar_slfi_filter filter[1] = {
- {
-  .name = "trigger",
-  .description = "Trigger SLFI filter on event",
-  .flags = ROAR_SLFI_FLAG_NONE,
-  .init = __init,
-  .uninit = __uninit,
-  .update = __update,
-  .ctl = __ctl
- }
-};
-
-ROAR_DL_PLUGIN_REG_SLFI(filter);
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(filter_slfi_trigger) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-trigger", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This is a container plugin for SLFI filter triggers.");
-
- // Load filters.
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/helloworld.c
===================================================================
--- plugins/universal/helloworld.c	(revision 6052)
+++ 	(revision )
@@ -1,90 +1,0 @@
-//helloworld.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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>
-
-// A simple function printing our message.
-static int hw_init (struct roar_dl_librarypara * para) {
- const char * text = "Hello world!";
- struct roar_keyval * cur;
- size_t i;
-
- if ( para != NULL && para->argv != NULL ) {
-  for (i = 0; i < para->argc; i++) {
-   cur = &(para->argv[i]);
-   if ( cur->key != NULL && !strcmp(cur->key, "text") ) {
-    if ( cur->value != NULL ) {
-     text = cur->value;
-    } else if ( (i+1) < para->argc && para->argv[i+1].key == NULL ) {
-     text = para->argv[i+1].value;
-     i++;
-    }
-   }
-  }
- }
-
- roar_vio_printf(roar_stdout, "%s\n", text);
-
- return 0;
-}
-
-// This struct contains the AppSched pointers.
-static struct roar_dl_appsched sched = {
- .init   = hw_init,
- .free   = NULL,
- .update = NULL,
- .tick   = NULL,
- .wait   = NULL
-};
-
-// This is the plugin control block.
-ROAR_DL_PLUGIN_START(helloworld) {
- // Here we set the name and vendor of our plugin.
- // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("helloworld", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
-
- // This sets the version of your plugin.
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
-
- // This sets the license of your plugin.
- // If there is no tag for the license you use you can just
- // use ROAR_DL_PLUGIN_META_LICENSE().
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
-
- // This sets the author and contact infos.
- // There are several other macros to do this with other parameters.
- // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
-
- // This sets the description for your plugin.
- ROAR_DL_PLUGIN_META_DESC("This plugin prints the string \"Hello world!\".");
-
- // Here the AppSched block from above is registered.
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched);
-
-// This is the end of the control block.
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/piface.c
===================================================================
--- plugins/universal/piface.c	(revision 6052)
+++ 	(revision )
@@ -1,405 +1,0 @@
-//piface.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2013-2015
- *
- *  This file is part of roard 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_H_LINUX_SPI_SPIDEV
-#include <linux/spi/spidev.h>
-#include <sys/ioctl.h>
-
-#define NUM_PORTS (8+8+1)
-
-#define TRANSFER_LEN   3
-#define TRANSFER_DELAY 5
-#define TRANSFER_SPEED 1000000
-#define TRANSFER_BPW   8
-
-#define SPI_WRITE_CMD 0x40
-#define SPI_READ_CMD 0x41
-
-#define IODIRA 0x00 // I/O direction A
-#define IODIRB 0x01 // I/O direction B
-#define IOCON  0x0A // I/O config
-#define GPIOA  0x12 // port A
-#define GPIOB  0x13 // port B
-#define GPPUA  0x0C // port A pullups
-#define GPPUB  0x0D // port B pullups
-#define OUTPUT_PORT GPIOA
-#define INPUT_PORT  GPIOB
-
-struct state {
- int inited;
- int bus;
- int device;
- struct roar_vio_calls vio_store;
- struct roar_vio_calls * vio;
- unsigned char buffer_output;
- unsigned char buffer_input;
- struct roar_service_gpio_port ports[NUM_PORTS];
-};
-
-static struct state * state = NULL;
-static struct state   state_init = {
- .inited = 0,
- .bus    = 0,
- .device = 0,
- .vio    = NULL,
- .buffer_output = 0x00,
- .buffer_input  = 0x00,
- .ports  = {
-// inputs:
-  {.id = 0, .name = "gpin0", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 1, .name = "gpin1", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 2, .name = "gpin2", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 3, .name = "gpin3", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 4, .name = "gpin4", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 5, .name = "gpin5", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 6, .name = "gpin6", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 7, .name = "gpin7", .mode = ROAR_SERVICE_GPIO_FINPUT|ROAR_SERVICE_GPIO_FPULLUP, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-
-// outputs:
-  {.id = 8, .name = "gpout0", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 9, .name = "gpout1", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 10, .name = "gpout2", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 11, .name = "gpout3", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 12, .name = "gpout4", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 13, .name = "gpout5", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 14, .name = "gpout6", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-  {.id = 15, .name = "gpout7", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TBOOL, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 1, .frange_min = 0, .frange_max = 1},
-
-// special:
-  {.id = 16, .name = "bar0", .mode = ROAR_SERVICE_GPIO_FOUTPUT, .unit = NULL, .type = ROAR_SERVICE_GPIO_TINT, .state = ROAR_SERVICE_GPIO_SUNINITED, .irange_min = 0, .irange_max = 8, .frange_min = 0, .frange_max = 8}
- }
-};
-
-static int piface__transfer(char cmd, char port, char value) {
- unsigned char txbuffer[3] = {cmd, port, value};
- unsigned char rxbuffer[3];
- struct spi_ioc_transfer transfer_buffer = {
-  .tx_buf = (unsigned long) txbuffer,
-  .rx_buf = (unsigned long) rxbuffer,
-  .len = TRANSFER_LEN,
-  .delay_usecs = TRANSFER_DELAY,
-  .speed_hz = TRANSFER_SPEED,
-  .bits_per_word = TRANSFER_BPW,
- };
- struct roar_vio_sysio_ioctl ctl = {.cmd = SPI_IOC_MESSAGE(1), .argp = &transfer_buffer};
-
- if ( roar_vio_ctl(state->vio, ROAR_VIO_CTL_SYSIO_IOCTL, &ctl) == -1 )
-  return -1; 
-
- return (unsigned int)rxbuffer[2];
-}
-
-static int piface__init(void) {
- char path[80];
-
- if ( state->inited ) {
-  roar_err_set(ROAR_ERROR_ALREADY);
-  return -1;
- }
-
- snprintf(path, sizeof(path), "file://dev/spidev%i.%i", state->bus, state->device);
-
- state->vio = &(state->vio_store);
- if ( roar_vio_open_dstr_simple(state->vio, path, ROAR_VIOF_READWRITE) == -1 )
-  return -1;
-
- piface__transfer(SPI_WRITE_CMD, IOCON,  8);    // enable hardware addressing
- piface__transfer(SPI_WRITE_CMD, GPIOA,  0x00); // turn on port A
- piface__transfer(SPI_WRITE_CMD, IODIRA, 0);    // set port A as an output
- piface__transfer(SPI_WRITE_CMD, IODIRB, 0xFF); // set port B as an input
- piface__transfer(SPI_WRITE_CMD, GPPUB,  0xFF); // turn on port B pullups
- piface__transfer(SPI_WRITE_CMD, OUTPUT_PORT, 0x00); // turn of all outputs.
-
- state->inited = 1;
-
- return 0;
-}
-
-static int piface__free(void) {
- if ( !state->inited ) {
-  roar_err_set(ROAR_ERROR_BADSTATE);
-  return -1;
- }
-
- roar_vio_close(state->vio);
-
- state->inited = 0;
-
- return 0;
-}
-
-static void piface__write_output(unsigned char val) {
- piface__transfer(SPI_WRITE_CMD, OUTPUT_PORT, state->buffer_output = val);
-}
-
-static unsigned char piface__read_output(void) {
- return state->buffer_output = piface__transfer(SPI_READ_CMD, OUTPUT_PORT, 0xFF);
-}
-
-static unsigned char piface__read_input(void) {
- return state->buffer_input = piface__transfer(SPI_READ_CMD, INPUT_PORT, 0xFF) ^ 0xFF;
-}
-
-static inline int __portval_to_bool(const struct roar_service_gpio_port * port, unsigned int val) {
- int bit = 1 << (port->id & 0x07);
- return val & bit ? 1 : 0;
-}
-
-static inline unsigned char __render_bar(int bits) {
- unsigned char ret = 0;
- int i;
-
- // this is a generic version. As long as this is not called too often it should work fine.
-
- for (i = 0; i < bits; i++) {
-  ret <<= 1;
-  ret  |= 1;
- }
-
- return ret;
-}
-
- // get list of gpio IDs.
- // buffer is passed as ids, buffer size (in elements) is passed as len.
- // returns the number of elements stored in ids or -1 on error.
-static ssize_t __list(int * ids, size_t len) {
- size_t i;
-
- if ( ids == NULL ) {
-  roar_err_set(ROAR_ERROR_FAULT);
-  return -1;
- }
-
- for (i = 0; i < len && i < NUM_PORTS; i++)
-  ids[i] = i;
-
- return i;
-}
-
- // get the number of gpios. See also comments above on what.
-static ssize_t __num(enum roar_service_num what) {
- (void)what;
-
- return NUM_PORTS; // 8 inputs, 8 outputs and a a virtual bar
-}
- // get a gpio by ID. The object returned is a copy and must not be motified or freed.
-static int __get(int id, struct roar_service_gpio_port * port) {
- if ( id < 0 || id >= NUM_PORTS ) {
-  roar_err_set(ROAR_ERROR_RANGE);
-  return -1;
- }
-
- if ( port == NULL ) {
-  roar_err_set(ROAR_ERROR_FAULT);
-  return -1;
- }
-
- *port = state->ports[id];
- return 0;
-}
-
- // Sets up ports.
- // the controler should set mode and state of port to given target mode and state.
- // If id is given as -1 this is about the controler. mode MUST NOT contain any
- // flags beside ROAR_SERVICE_GPIO_FCACHED. If ROAR_SERVICE_GPIO_FCACHED
- // is set it is applied all ports.
-static int __setup(int id, uint_least32_t mode, enum roar_service_gpio_state tstate) {
- size_t i;
-
- if ( id < -1 || id >= NUM_PORTS ) {
-  roar_err_set(ROAR_ERROR_RANGE);
-  return -1;
- }
-
- if ( id == -1 ) {
-  if ( mode != 0 && mode != ROAR_SERVICE_GPIO_FCACHED ) {
-   roar_err_set(ROAR_ERROR_INVAL);
-   return -1;
-  }
-
-  switch (tstate) {
-   case ROAR_SERVICE_GPIO_SREADY:
-    if ( state->inited )
-     return 0;
-    if ( piface__init() == -1 )
-     return -1;
-    for (i = 0; i < NUM_PORTS; i++) {
-     state->ports[i].mode |= ROAR_SERVICE_GPIO_FCACHED;
-     state->ports[i].mode -= ROAR_SERVICE_GPIO_FCACHED;
-     state->ports[i].mode |= mode;
-    }
-    return 0;
-   case ROAR_SERVICE_GPIO_SUNINITED:
-    if ( !state->inited )
-     return 0;
-    return piface__free();
-   default:
-     roar_err_set(ROAR_ERROR_INVAL);
-     return -1;
-    break;
-  }
- }
-
- roar_err_set(ROAR_ERROR_NOSYS);
- return -1;
-}
-
- // get value of port (input or output) as int or float.
-static int __get_int(int id) {
- const struct roar_service_gpio_port * port;
- unsigned char val;
-
- if ( !state->inited ) {
-  roar_err_set(ROAR_ERROR_BADSTATE);
-  return -1;
- }
-
- if ( id < 0 || id >= NUM_PORTS ) {
-  roar_err_set(ROAR_ERROR_RANGE);
-  return -1;
- }
-
- port = &(state->ports[id]);
-
- if ( port->type != ROAR_SERVICE_GPIO_TBOOL ) {
-  roar_err_set(ROAR_ERROR_NOTSUP);
-  return -1;
- }
-
- if ( port->mode & ROAR_SERVICE_GPIO_FINPUT ) {
-  val = piface__read_input();
- } else {
-  val = piface__read_output();
- }
-
- return __portval_to_bool(port, val);
-}
-
-static double __get_float(int id) {
- return __get_int(id);
-}
-
- // set value of output (as int or float).
-static int __set_int(int id, int val) {
- const struct roar_service_gpio_port * port;
- unsigned char buffer;
- int bit;
-
- if ( !state->inited ) {
-  roar_err_set(ROAR_ERROR_BADSTATE);
-  return -1;
- }
-
- if ( id < 0 || id >= NUM_PORTS ) {
-  roar_err_set(ROAR_ERROR_RANGE);
-  return -1;
- }
-
- port = &(state->ports[id]);
-
- if ( !(port->mode & ROAR_SERVICE_GPIO_FOUTPUT) ) {
-  roar_err_set(ROAR_ERROR_NOTSUP);
-  return -1;
- }
-
- if ( val < port->irange_min || val > port->irange_max ) {
-  roar_err_set(ROAR_ERROR_RANGE);
-  return -1;
- }
-
- switch (port->type) {
-  case ROAR_SERVICE_GPIO_TBOOL:
-    bit = 1 << (id & 0x07);
-
-    buffer = state->buffer_output;
-    buffer |= bit;
-
-    if ( !val )
-     buffer -= bit;
-
-    piface__write_output(buffer);
-
-    return 0;
-   break;
-  case ROAR_SERVICE_GPIO_TINT:
-    piface__write_output(__render_bar(val));
-    return 0;
-   break;
-  default:
-    roar_err_set(ROAR_ERROR_NOTSUP);
-    return -1;
-   break;
- }
-}
-
-static int __set_float(int id, double val) {
- return __set_int(id, val);
-}
-
-static struct roar_service_gpio api = {
- .list = __list,
- .num  = __num,
- .get  = __get,
- .setup = __setup,
- .get_int = __get_int,
- .get_float = __get_float,
- .set_int = __set_int,
- .set_float = __set_float,
- .convert_int = NULL,
- .convert_float = NULL
-};
-
-ROAR_DL_PLUGIN_REG_SERVICES_GET_API(get_api, api)
-
-static const struct roar_dl_service service[1] = {
- {
-  .appname = NULL,
-  .appabi = NULL,
-  .servicename = ROAR_SERVICE_GPIO_NAME,
-  .serviceabi = ROAR_SERVICE_GPIO_ABI,
-  .description = "Interface to PiFace",
-  .flags = ROAR_DL_SERVICE_FLAGS_NONE,
-  .userdata = NULL,
-  .get_api = get_api
- }
-};
-
-ROAR_DL_PLUGIN_REG_SERVICES(service);
-
-ROAR_DL_PLUGIN_START(piface) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("piface", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This plugin provides a simple interface to the PiFace board.");
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_SERVICE);
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(state, state_init);
-} ROAR_DL_PLUGIN_END
-
-#endif
-
-//ll
Index: plugins/universal/plugin-info.c
===================================================================
--- plugins/universal/plugin-info.c	(revision 6052)
+++ 	(revision )
@@ -1,139 +1,0 @@
-//plugin-info.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 int static_counter = 0;
-int nonstatic_counter = 0;
-
-static int global_data_init = 0;
-static int * global_data;
-
-static void print_counter  (void) {
- static int static_func_counter = 0;
-
- printf("static_counter=%i, nonstatic_counter=%i, static_func_counter=%i, *global_data=%i\n",
-        static_counter, nonstatic_counter, static_func_counter, *global_data);
-
- static_counter++;
- nonstatic_counter++;
- static_func_counter++;
- (*global_data)++;
-}
-
-static void print_parameter(struct roar_dl_librarypara * para) {
- size_t i;
- char c;
-
- roar_vio_printf(roar_stdout, "version    = %i (%smatching)\n",
-                 para->version, para->version == ROAR_DL_LIBPARA_VERSION ? "" : "not ");
- roar_vio_printf(roar_stdout, "length     = %lu (%smatching)\n",
-                 (long unsigned int)para->len, para->len == sizeof(*para) ? "" : "not ");
-
- if ( para->version != ROAR_DL_LIBPARA_VERSION || para->len != sizeof(*para) ) {
-  roar_vio_printf(roar_stdout, "Warning: Unsupported para block. Version or length missmatch.\n");
-  return;
- }
-
- roar_vio_printf(roar_stdout, "refc       = %lu\n", (long unsigned int)para->refc);
- if ( para->argv == NULL ) {
-  roar_vio_printf(roar_stdout, "argv[]     = <not set>\n");
- } else {
-  roar_vio_printf(roar_stdout, "argv[]     = <kv array>\n");
-  for (i = 0; i < para->argc; i++) {
-   c = i == (para->argc - 1) ? '\\' : '|';
-   if ( para->argv[i].value == NULL ) {
-    roar_vio_printf(roar_stdout, " %c- \"%s\" has no value.\n", c, para->argv[i].key);
-   } else {
-    roar_vio_printf(roar_stdout, " %c- \"%s\" has value \"%s\".\n", c, para->argv[i].key, para->argv[i].value);
-   }
-  }
- }
-
- roar_vio_printf(roar_stdout, para->binargv    == NULL ? "binargv    = <not set>\n" : "binargv    = %p\n", para->binargv);
- roar_vio_printf(roar_stdout, para->appname    == NULL ? "appname    = <not set>\n" : "appname    = \"%s\"\n", para->appname);
- roar_vio_printf(roar_stdout, para->abiversion == NULL ? "abiversion = <not set>\n" : "abiversion = \"%s\"\n", para->abiversion);
- roar_vio_printf(roar_stdout, para->notifycore == NULL ? "notifycore = <not set>\n" : "notifycore = %p\n", para->notifycore);
- roar_vio_printf(roar_stdout, para->container  == NULL ? "container  = <not set>\n" : "container  = %p\n", para->container);
- roar_vio_printf(roar_stdout, para->loader     == NULL ? "loader     = <not set>\n" : "loader     = %p\n", para->loader);
- roar_vio_printf(roar_stdout, para->loader_userdata == NULL ? "loader_userdata = <not set>\n" : "loader_userdata = %p\n", para->loader_userdata);
-}
-
-static void print_notifycore (struct roar_dl_librarypara * para) {
- struct roar_notify_core * tmp;
-
- tmp = roar_notify_core_swap_global(NULL);
- roar_notify_core_swap_global(tmp);
-
- if ( para->notifycore == NULL || para->notifycore == tmp ) {
-  roar_vio_printf(roar_stdout,
-                 tmp == NULL ? "global notify core= <not set> (matching)\n" : "global notify core= %p (matching)\n",
-                 tmp);
- } else {
-  roar_vio_printf(roar_stdout,
-                  tmp == NULL ? "global notify core= <not set> (not matching)\n" :
-                                "global notify core= %p (not matching)\n",
-                  tmp);
- }
-
- roar_notify_core_unref(tmp);
-}
-
-static void print_env(void) {
- const char * server = roar_libroar_get_server();
- roar_vio_printf(roar_stdout, "Default server: %s%s%s\n",
-                              server == NULL ? "" : "\"",
-                              server == NULL ? "<not set>" : server,
-                              server == NULL ? "" : "\"");
-}
-
-static int init  (struct roar_dl_librarypara * para) {
- print_parameter(para);
- print_notifycore(para);
- print_env();
- print_counter();
- return 0;
-}
-
-static struct roar_dl_appsched sched = {
- .init   = init,
- .free   = NULL,
- .update = NULL,
- .tick   = NULL,
- .wait   = NULL
-};
-
-ROAR_DL_PLUGIN_START(plugin_info) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("plugin-info", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); 
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Display information about the plugin context");
-
- ROAR_DL_PLUGIN_REG_GLOBAL_DATA(global_data, global_data_init);
- ROAR_DL_PLUGIN_REG_APPSCHED(&sched);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/protocol-daytime.c
===================================================================
--- plugins/universal/protocol-daytime.c	(revision 6052)
+++ 	(revision )
@@ -1,85 +1,0 @@
-//protocol-daytime.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 int _set_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct roar_buffer * buf;
- void * data;
- ssize_t len;
- time_t now = time(NULL);
- char * date = asctime(gmtime(&now));
-
- (void)client, (void)vio, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- len = roar_mm_strlen(date) + 1;
-
- if ( roar_buffer_new_data(&buf, len, &data) == -1 )
-  return -1;
-
- memcpy(data, date, len);
-
- if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 )
-  return -1;
-
- return 0;
-}
-
-static int _flushed(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- roar_err_set(ROAR_ERROR_NODATA);
- return -1;
-}
-
-static const struct roar_dl_proto proto = {
- .proto = ROAR_PROTO_DAYTIME,
- .description = "The Internet daytime protocol",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = _set_proto,
- .unset_proto = NULL,
- .handle = NULL,
- .flush = NULL,
- .flushed = _flushed,
- .status = NULL
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, proto, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_daytime) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-daytime", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet daytime protocol");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/protocol-discard.c
===================================================================
--- plugins/universal/protocol-discard.c	(revision 6052)
+++ 	(revision )
@@ -1,68 +1,0 @@
-//protocol-discard.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 int _handle(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- char buf[4096];
-
- (void)client, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( roar_vio_read(vio, buf, sizeof(buf)) < 1 ) {
-  return -1;
- }
-
- return 0;
-}
-
-static const struct roar_dl_proto proto = {
- .proto = ROAR_PROTO_DISCARD,
- .description = "Discard all data send to the server",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = NULL,
- .unset_proto = NULL,
- .handle = _handle,
- .flush = NULL,
- .flushed = NULL,
- .status = NULL
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, proto, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_discard) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-discard", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of a dummy protocol discarding all data");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/protocol-echo.c
===================================================================
--- plugins/universal/protocol-echo.c	(revision 6052)
+++ 	(revision )
@@ -1,88 +1,0 @@
-//protocol-echo.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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 int _handle(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct roar_buffer * buf;
- void * data;
- ssize_t len;
-
- (void)client, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- ROAR_DBG("_handle(client=%i, vio=%p) = ?", client, vio);
-
- if ( roar_buffer_new_data(&buf, 1024, &data) == -1 )
-  return -1;
-
- len = roar_vio_read(vio, data, 1024);
- if ( len < 1 ) {
-  ROAR_DBG("_handle(client=%i, vio=%p) = -1 // error=%s(%i)", client, vio, roar_errorstring, roar_error);
-  return -1;
- }
-
- if ( roar_buffer_set_len(buf, len) == -1 ) {
-  ROAR_DBG("_handle(client=%i, vio=%p) = -1 // error=%s(%i)", client, vio, roar_errorstring, roar_error);
-  roar_buffer_free(buf);
-  return -1;
- }
-
- if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 )
-  return -1;
-
- ROAR_DBG("_handle(client=%i, vio=%p) = 0", client, vio);
- return 0;
-}
-
-
-static const struct roar_dl_proto proto = {
- .proto = ROAR_PROTO_ECHO,
- .description = "Send all data send to the server back to the client",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = NULL,
- .unset_proto = NULL,
- .handle = _handle,
- .flush = NULL,
- .flushed = NULL,
- .status = NULL
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, proto, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_echo) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-echo", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of a dummy protocol sending all data back to the sender");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/protocol-http.c
===================================================================
--- plugins/universal/protocol-http.c	(revision 6052)
+++ 	(revision )
@@ -1,1155 +1,0 @@
-//protocol-http.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2015
- *
- *  This file is part of roard 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_LIBUSTE
-#include <uste.h>
-#endif
-
-struct resource_handle;
-
-enum ctl_cmd {
- CMD_SET_CLIENTNAME
-};
-
-enum status {
- STATUS_WAITING_FOR_HEADERS = 0,
- STATUS_END_OF_HEADER,
- STATUS_BAD_HEADER,
- STATUS_RUNNING_DATA,
- STATUS_DONE
-};
-
-struct input_source {
- int userdata_si;
- void * userdata_vp;
- ssize_t offset;
- struct roar_vio_calls * vio;
- struct roar_vio_calls vio_store;
-};
-
-struct http_client {
- enum status status;
- struct roar_buffer * input_buffer;
- char * method;
- char * proto;
- char * uri;
- char * path, * query_string;
- void * headersstore;
- struct roar_keyval * headers;
- ssize_t headerslen;
- const struct resource_handle * resource;
- struct input_source input;
- struct roar_dl_librarypara * pluginpara;
- int clientid;
-};
-
-struct resource_handle {
- const char  * uri;
- const char  * rawdata;
- const ssize_t rawlen;
- const char  * content_type;
- int (*header_send)(struct http_client * self, struct roar_buffer ** obuffer);
- int (*body_send)(struct http_client * self, struct roar_buffer ** obuffer);
-};
-
-static struct {
- enum {
-  HOSTTYPE_GENERIC = 0,
-  HOSTTYPE_ROARD
- } hosttype;
- union {
-  struct {
-   int (*clients_set_name)(int id, const char * name);
-  } roard;
- } hostspec;
-} __host = {.hosttype = HOSTTYPE_GENERIC};
-
-static int header_send(struct roar_buffer ** obuffer, int status, const char * msg, const char * content_type, ssize_t len);
-static void send_errorpage(struct http_client * self, struct roar_buffer ** obuffer, int error, const char * msg);
-
-static int slow_zero_stream(struct http_client * self, struct roar_buffer ** obuffer) {
- struct roar_buffer * buffer;
- void * data;
-
- self->status = STATUS_RUNNING_DATA;
-
- if ( roar_buffer_new_data(&buffer, 1, &data) == -1 )
-  return -1;
-
- *((char*)data) = 0;
-
- if ( roar_buffer_moveintoqueue(obuffer, &buffer) == -1 ) {
-  roar_buffer_free(buffer);
-  return -1;
- }
-
- return 0;
-}
-
-static const char * __res_vio_content_type_get(struct http_client * self, const char * indexfile) {
- const char * point = strrchr(indexfile != NULL ? indexfile : self->path, '.');
-
- if ( point == NULL )
-  return NULL;
-
- point++;
-
-#define __type1(mime,ext) \
- } else if ( !strcmp(point, (ext)) ) { \
-  return (mime);
-#define __type2(mime,ext0,ext1) \
- } else if ( !strcmp(point, (ext0)) || !strcmp(point, (ext1)) ) { \
-  return (mime);
-
-#ifdef __FIX_VIM_SYNTAX_HIGHLIGHTING__
-}
-#endif
-
- if ( !strcmp(point, "txt") || !strcmp(point, "text") ) {
-  return "text/plain";
-__type2("text/html", "html", "htm")
-__type1("text/css", "css")
-__type1("image/png", "png")
-__type2("image/jpeg", "jpeg", "jpg")
- }
-
- return NULL;
-}
-
-#ifdef ROAR_HAVE_LIBUSTE
-static uste_var_t __res_vio_handle_uste_build_headers(struct http_client * self) {
- uste_var_t root = uste_var_new_kv();
- uste_var_t var;
- ssize_t i;
-
- if ( root == NULL )
-  return NULL;
-
- uste_var_set_key(root, "header");
-
- for (i = 0; i < self->headerslen; i++) {
-  var = uste_var_new_str(self->headers[i].value == NULL ? "" : self->headers[i].value);
-  if ( self->headers[i].key != NULL )
-   uste_var_set_key(var, self->headers[i].key);
-  uste_var_push(root, var);
-  uste_var_unref(var);
- }
-
- return root;
-}
-
-static inline int __is_hex(char c) {
- if ( c >= '0' && c <= '9' )
-  return 1;
- if ( c >= 'a' && c <= 'f' )
-  return 1;
- if ( c >= 'A' && c <= 'F' )
-  return 1;
- return 0;
-}
-
-static inline int __hex2num(char c) {
- if ( c >= '0' && c <= '9' )
-  return c - '0';
- if ( c >= 'a' && c <= 'f' )
-  return c - 'a' + 10;
- if ( c >= 'A' && c <= 'F' )
-  return c - 'A' + 10;
- return 0;
-}
-
-static void __res_vio_handle_uste_uridecode(char * str) {
- const char * c = str;
-
- for (; *c; c++, str++) {
-  if ( *c == '%' && __is_hex(c[1]) && __is_hex(c[2]) ) {
-   *str = __hex2num(c[1])*16 + __hex2num(c[2]);
-   c += 2;
-  } else if ( *c == '+' ) {
-   *str = ' ';
-  } else {
-   *str = *c;
-  }
- }
- *str = *c;
-}
-
-static void __res_vio_handle_uste_keyify(char * str) {
- if ( *str == '#' )
-  *str = '_';
- for (;*str; str++)
-  if (*str == '.')
-   *str = '_';
-}
-
-static uste_var_t __res_vio_handle_uste_build_getparams(struct http_client * self) {
- uste_var_t root = uste_var_new_kv();
- uste_var_t subroot;
- uste_var_t var;
- char * qs_buffer;
- char * cur;
- char * state;
- char * key, * value;
-
- if ( root == NULL )
-  return NULL;
-
- uste_var_set_key(root, "get");
- if ( self->query_string == NULL )
-  return root;
-
- qs_buffer = roar_mm_strdup(self->query_string);
-
- // do better handling here.
- if ( qs_buffer == NULL )
-  return root;
-
- cur = roar_mm_strtok_r(qs_buffer, "&", &state);
-
- while (cur != NULL) {
-  key = cur;
-  value = strstr(cur, "=");
-  if ( value != NULL ) {
-   *value = 0;
-   value++;
-   __res_vio_handle_uste_uridecode(value);
-  }
-  __res_vio_handle_uste_uridecode(key);
-  __res_vio_handle_uste_keyify(key);
-
-  if ( value == NULL ) {
-   var = uste_var_new_undef();
-  } else {
-   var = uste_var_new_str(value);
-  }
-
-  subroot = uste_var_pull(root, key);
-  if ( subroot == NULL ) {
-   subroot = uste_var_new_array();
-   if ( subroot != NULL ) {
-    uste_var_set_key(subroot, key);
-    uste_var_push(root, subroot);
-   }
-  }
-
-  if ( subroot != NULL ) {
-   uste_var_push(subroot, var);
-   uste_var_unref(subroot);
-  }
-  uste_var_unref(var);
-  cur = roar_mm_strtok_r(NULL, "&", &state);
- }
-
- roar_mm_free(qs_buffer);
- return root;
-}
-
-static uste_var_t __res_vio_handle_uste_build_rootkv(struct http_client * self) {
- uste_var_t root = uste_var_new_kv();
- uste_var_t subroot, subsubroot;
- uste_var_t var;
-
- if ( root == NULL )
-  return NULL;
-
-#define __new_member_prefix(prefix,name) \
-   if ( prefix->name != NULL ) { \
-    var = uste_var_new_str(prefix->name); \
-    uste_var_set_key(var, #name); \
-    uste_var_push(subsubroot, var); \
-    uste_var_unref(var); \
-   }
-#define __new_member(name) __new_member_prefix(self,name)
-
- subroot = uste_var_new_kv();
- if ( subroot != NULL ) {
-  uste_var_set_key(subroot, "__client__");
-  uste_var_push(root, subroot);
-
-  var = uste_var_new_int(self->clientid);
-  uste_var_set_key(var, "clientid");
-  uste_var_push(subroot, var);
-  uste_var_unref(var);
-
-  subsubroot = uste_var_new_kv();
-  if ( subsubroot != NULL ) {
-   uste_var_set_key(subsubroot, "http");
-   uste_var_push(subroot, subsubroot);
-
-   __new_member(method);
-   __new_member(proto);
-   __new_member(uri);
-   __new_member(path);
-   __new_member(query_string);
-
-   var = __res_vio_handle_uste_build_headers(self);
-   uste_var_push(subsubroot, var);
-   uste_var_unref(var);
-
-   var = __res_vio_handle_uste_build_getparams(self);
-   uste_var_push(subsubroot, var);
-   uste_var_unref(var);
-
-   uste_var_unref(subsubroot);
-  }
-
-  uste_var_unref(subroot);
- }
-
- subroot = uste_var_new_kv();
- if ( subroot != NULL ) {
-  uste_var_set_key(subroot, "__host__");
-  uste_var_push(root, subroot);
-
-  subsubroot = subroot;
-  __new_member_prefix(self->pluginpara, appname);
-  __new_member_prefix(self->pluginpara, abiversion);
-
-  uste_var_unref(subroot);
- }
-
- return root;
-}
-
-static void __res_vio_handle_uste(struct http_client * self, struct roar_buffer ** obuffer, const char * content_type, const char * filename) {
- struct roar_buffer * buffer = NULL;
- uste_renderer_t renderer;
- uste_parser_t parser;
- uste_var_t rootkv;
- uste_node_t root;
- int err;
-
-
- parser = uste_parser_new(self->input.vio, filename);
- err = roar_error;
- roar_vio_close(self->input.vio);
- if ( parser == NULL ) {
-  send_errorpage(self, obuffer, err, NULL);
-  return;
- }
-
- if ( uste_parser_parse(parser) == -1 ) {
-  send_errorpage(self, obuffer, roar_error, NULL);
-  return;
- }
-
- root = uste_parser_get_rootnode(parser);
- err = roar_error;
- uste_parser_unref(parser);
-
- if ( root == NULL ) {
-  send_errorpage(self, obuffer, err, NULL);
-  return;
- }
-
- renderer = uste_renderer_new();
- err = roar_error;
- if ( renderer == NULL ) {
-  uste_node_unref(root);
-  send_errorpage(self, obuffer, err, NULL);
-  return;
- }
-
- uste_stdfunc_register_all(renderer);
- uste_libroar_register_all(renderer);
-
- rootkv = __res_vio_handle_uste_build_rootkv(self);
- err = roar_error;
- if ( rootkv == NULL ) {
-  uste_node_unref(root);
-  uste_renderer_unref(renderer);
-  send_errorpage(self, obuffer, err, NULL);
-  return;
- }
-
- uste_renderer_set_rootvar(renderer, rootkv);
- uste_var_unref(rootkv);
-
- buffer = uste_node_render(root, renderer);
- err = roar_error;
- uste_node_unref(root);
- uste_renderer_unref(renderer);
-
- if ( buffer == NULL ) {
-  send_errorpage(self, obuffer, err, NULL);
-  return;
- }
-
- header_send(obuffer, 200, NULL, content_type, -1);
-
- if ( buffer != NULL ) {
-  if ( roar_buffer_moveintoqueue(obuffer, &buffer) == -1 ) {
-   roar_buffer_free(buffer);
-   return;
-  }
- }
-
- self->status = STATUS_DONE;
-}
-#endif
-
-static int __res_vio_check_uste(struct http_client * self, struct roar_buffer ** obuffer, const char * content_type) {
- const size_t len = 14;
- struct roar_buffer * buffer;
- void * data;
- ssize_t ret;
- int err;
-
- // TODO: use content type for some basic filtering.
- (void)content_type;
-
- *obuffer = NULL;
-
- if ( roar_buffer_new_data(&buffer, len, &data) == -1 )
-  return -1;
-
- ret = roar_vio_read(self->input.vio, data, len);
- err = roar_error;
-
- if ( ret < 1 ) {
-  roar_buffer_free(buffer);
-  roar_error = err;
-  return -1;
- }
-
- *obuffer = buffer;
-
- if ( ret == (ssize_t)len ) {
-  return !strncmp(data, "@@@TEMPLATE@@@", len);
- } else {
-  if ( roar_buffer_set_len(buffer, ret) == -1 ) {
-   *obuffer = NULL;
-   roar_buffer_free(buffer);
-   return -1;
-  }
-  // is this really a nice idea?
-  return 0;
- }
-}
-
-static int __res_vio_header_send(struct http_client * self, struct roar_buffer ** obuffer) {
- static const char * index_files[] = {NULL, "index.html", "index.txt", "index"};
- struct roar_buffer * buffer;
- struct roar_keyval * path;
- char filename[1024];
- const char * slash = "/";
- const char * content_type = NULL;
- int uste_check;
- size_t i;
- const char * indexfile = NULL;
-
- if ( self->pluginpara == NULL ) {
-  roar_err_set(ROAR_ERROR_INVAL);
-  return -1;
- }
-
- path = roar_keyval_lookup(self->pluginpara->argv, "webroot", self->pluginpara->argc, 1);
- if ( path == NULL ) {
-  if ( roar_error == ROAR_ERROR_NOENT )
-   roar_err_set(ROAR_ERROR_INVAL);
-  return -1;
- }
-
- if ( path->value == NULL ) {
-  roar_err_set(ROAR_ERROR_INVAL);
-  return -1;
- }
-
- if ( strstr(self->path, "..") != NULL || strstr(self->path, "#") != NULL ) {
-  roar_err_set(ROAR_ERROR_INVAL);
-  return -1;
- }
-
- if ( (roar_mm_strlen(path->value) + roar_mm_strlen(self->path) + 2) > sizeof(filename) ) {
-  roar_err_set(ROAR_ERROR_NAMETOOLONG);
-  return -1;
- }
-
- if ( self->path[0] == '/' || path->value[strlen(path->value)-1] == '/' )
-  slash = "";
-
- uste_check = -1;
- for (i = 0; uste_check == -1 && i < (sizeof(index_files)/sizeof(*index_files)); i++) {
-  indexfile = index_files[i];
-
-  snprintf(filename, sizeof(filename), "%s%s%s%s%s", path->value, slash, self->path,
-           indexfile == NULL ? "" : "/",
-           indexfile == NULL ? "" : indexfile);
-
-
-  self->input.vio = &(self->input.vio_store);
-  if ( roar_vio_open_dstr_simple(self->input.vio, filename, ROAR_VIOF_READ|ROAR_VIOF_NONBLOCK) == -1 ) {
-   continue;
-  }
-
-  if ( roar_vio_ctl(self->input.vio, ROAR_VIO_CTL_GET_MIMETYPE, &content_type) == -1 )
-   content_type = NULL;
-
-  if ( content_type == NULL )
-   content_type = __res_vio_content_type_get(self, indexfile);
-
-  uste_check = __res_vio_check_uste(self, &buffer, content_type);
-  if ( uste_check == -1 )
-   roar_vio_unref(self->input.vio);
- }
-
- if ( uste_check == -1 )
-  return -1;
-
- if ( uste_check == 1 ) {
-  if ( buffer != NULL )
-   roar_buffer_free(buffer);
-#ifdef ROAR_HAVE_LIBUSTE
-  __res_vio_handle_uste(self, obuffer, content_type, filename);
-  return 0;
-#else
-  roar_vio_close(self->input.vio);
-  send_errorpage(self, obuffer, ROAR_ERROR_NOSYS, NULL);
-  return 0;
-#endif
- }
-
- header_send(obuffer, 200, NULL, content_type, -1);
-
- if ( buffer != NULL ) {
-  if ( roar_buffer_moveintoqueue(obuffer, &buffer) == -1 ) {
-   roar_buffer_free(buffer);
-   return -1;
-  }
- }
-
- self->status = STATUS_RUNNING_DATA;
- return 0;
-}
-
-static int __res_vio_body_send(struct http_client * self, struct roar_buffer ** obuffer) {
- const size_t len = 1024;
- struct roar_buffer * buffer;
- void * data;
- ssize_t ret;
-
- if ( self->status == STATUS_DONE )
-  return 0;
-
- if ( roar_buffer_new_data(&buffer, len, &data) == -1 )
-  return -1;
-
- ret = roar_vio_read(self->input.vio, data, len);
-
- if ( ret == -1 && roar_error == ROAR_ERROR_AGAIN ) {
-  ret = 0;
- } else if ( ret < 1 ) {
-  roar_buffer_free(buffer);
-  if ( roar_error != ROAR_ERROR_AGAIN ) {
-   self->status = STATUS_DONE;
-   roar_vio_close(self->input.vio);
-  }
-  return 0;
- }
-
- if ( roar_buffer_set_len(buffer, ret) == -1 ) {
-  roar_buffer_free(buffer);
-  return -1;
- }
-
- if ( roar_buffer_moveintoqueue(obuffer, &buffer) == -1 ) {
-  roar_buffer_free(buffer);
-  return -1;
- }
-
- return 0;
-}
-
-static const struct resource_handle _g_resources[] = {
- {
-  .uri = "/test/*",
-  .rawdata = "Hello world!\n",
-  .rawlen  = 13,
-  .content_type = NULL,
-  .header_send = NULL,
-  .body_send = NULL
- },
- {
-  .uri = "/szs/*",
-  .rawdata = NULL,
-  .rawlen  = -1,
-  .content_type = NULL,
-  .header_send = NULL,
-  .body_send = slow_zero_stream
- },
- {
-  .uri = "*",
-  .rawdata = NULL,
-  .rawlen  = -1,
-  .content_type = NULL,
-  .header_send = __res_vio_header_send,
-  .body_send = __res_vio_body_send
- }
-};
-
-
-static inline int __ret(struct http_client * self, struct roar_buffer ** obuffer) {
- ROAR_DBG("__ret(self=%p, obuffer=%p{%p}): self->status=%i", self, obuffer, *obuffer, (int)self->status);
- if ( *obuffer != NULL )
-  return 0;
- if ( self->status == STATUS_DONE )
-  return -1;
- return 0;
-}
-
-static int __ctl(struct http_client * self, enum ctl_cmd cmd, void * argp) {
- switch (cmd) {
-  case CMD_SET_CLIENTNAME:
-    if ( argp == NULL ) {
-     roar_err_set(ROAR_ERROR_FAULT);
-     return -1;
-    }
-    ROAR_DBG("__ctl(self=%p, cmd=%i, argp='%s') = ?", self, (int)cmd, (const char *)argp);
-    switch (__host.hosttype) {
-     case HOSTTYPE_GENERIC:
-       roar_err_set(ROAR_ERROR_BADHOST);
-       return -1;
-      break;
-     case HOSTTYPE_ROARD:
-       __host.hostspec.roard.clients_set_name(self->clientid, argp);
-      break;
-    }
-   break;
- }
-
- roar_err_set(ROAR_ERROR_BADRQC);
- return -1;
-}
-
-static void __init(struct roar_dl_librarypara * para) {
- // TODO add some init code here.
-
- if ( para == NULL )
-  return;
-
- if ( !roar_dl_para_check_version(para, "roard <0/RoarAudio>", "1.0beta8") ) {
-  __host.hosttype = HOSTTYPE_ROARD;
-  __host.hostspec.roard.clients_set_name = roar_dl_getsym(ROAR_DL_HANDLE_APPLICATION, "clients_set_name", -1);
-
-  // check if *all* function have been found:
-  if ( __host.hostspec.roard.clients_set_name == NULL ) {
-   __host.hosttype = HOSTTYPE_GENERIC;
-  }
- }
-}
-
-// this function is a wrapper for __init() with the code which should be inlined.
-static inline void _init(struct roar_dl_librarypara * para) {
- static int inited = 0;
- if (inited) return;
- __init(para);
- inited = 1;
-}
-
-static const struct resource_handle * resource_lookup_by_uri(const char * uri) {
- size_t i;
-
- for (i = 0; i < (sizeof(_g_resources)/sizeof(*_g_resources)); i++) {
-  if ( !roar_mm_strselcmp(_g_resources[i].uri, uri) ) {
-   return &(_g_resources[i]);
-  }
- }
-
- roar_err_set(ROAR_ERROR_NOENT);
- return NULL;
-}
-
-static int resource_header_send(struct http_client * self, struct roar_buffer ** obuffer) {
- if ( self->resource->header_send != NULL )
-  return self->resource->header_send(self, obuffer);
-
- return header_send(obuffer, 200, NULL, self->resource->content_type, self->resource->rawlen);
-}
-
-static int resource_body_send(struct http_client * self, struct roar_buffer ** obuffer) {
- struct roar_buffer * buffer;
- void * data;
- int ret;
-
- if ( self->resource->body_send != NULL )
-  return self->resource->body_send(self, obuffer);
-
- if ( self->resource->rawlen == -1 ) {
-  self->status = STATUS_DONE;
-  roar_err_set(ROAR_ERROR_INVAL);
-  return -1;
- }
-
- if ( roar_buffer_new_data(&buffer, self->resource->rawlen, &data) == -1 ) {
-  self->status = STATUS_DONE;
-  return -1;
- }
-
- memcpy(data, self->resource->rawdata, self->resource->rawlen);
-
- ret = roar_buffer_moveintoqueue(obuffer, &buffer);
- self->status = STATUS_DONE;
-
- return ret;
-}
-
-static int header_parse(struct http_client * self) {
- void * data;
- size_t len;
- size_t i;
- char * start, * end;
- char * start_uri;
- char * start_headers, * end_headers = NULL;
- char * tmp;
- struct roar_keyval * c;
-
- if ( roar_buffer_get_datalen(self->input_buffer, &data, &len) == -1 )
-  return -1;
-
- ROAR_DBG("header_parse(self=%p): data='%*s'", self, (int)len, (const char*)data);
-
- if ( len < 4 )
-  return 0;
-
- for (i = 0; i < (len - 3); i++) {
-  if ( ((const char*)data)[i] == '\r' ) {
-   ROAR_DBG("header_parse(self=%p): i=%i", self, (int)i);
-   if ( !strncmp(data + i, "\r\n\r\n", 4) ) {
-    self->status = STATUS_END_OF_HEADER;
-    end_headers = data + i;
-    break;
-   }
-  }
- }
-
- if ( self->status != STATUS_END_OF_HEADER ) {
-  for (i = 0; i < (len - 1); i++) {
-   if ( ((const char*)data)[i] == '\n' ) {
-    ROAR_DBG("header_parse(self=%p): i=%i", self, (int)i);
-    if ( !strncmp(data + i, "\n\n", 2) ) {
-     self->status = STATUS_END_OF_HEADER;
-     end_headers = data + i;
-     break;
-    }
-   }
-  }
- }
-
- if ( self->status != STATUS_END_OF_HEADER )
-  return 0;
-
- *end_headers = 0;
-
- end = strstr(data, " ");
- if ( end == NULL ) {
-  self->status = STATUS_BAD_HEADER;
-  return 1;
- }
-
- *end = 0;
- end++;
- self->method = roar_mm_strdup(data);
-
- start = end;
-
- end = strstr(start, " ");
- if ( end == NULL ) {
-  self->status = STATUS_BAD_HEADER;
-  return 1;
- }
-
- *end = 0;
- end++;
- self->uri = roar_mm_strdup(start);
- start_uri = start;
-
- start = end;
-
- end = strstr(start, "\r");
- if ( end == NULL )
-  end = strstr(start, "\n");
- if ( end == NULL ) {
-  self->status = STATUS_BAD_HEADER;
-  return 1;
- }
-
- *end = 0;
- end++;
- self->proto = roar_mm_strdup(start);
-
- start_headers = end;
-
- start = start_uri;
-
- end = strstr(start, "?");
- if ( end == NULL ) {
-  self->path = roar_mm_strdup(start);
- } else {
-  *end = 0;
-  end++;
-  self->path = roar_mm_strdup(start);
-  self->query_string = roar_mm_strdup(end);
- }
-
- self->headerslen = 0;
-
- i = end_headers - start_headers + 1;
- self->headersstore = roar_mm_memdup(start_headers, i);
- if ( self->headersstore == NULL ) {
-  self->status = STATUS_BAD_HEADER; // TODO: FIXME: not the right error, but works. ;)
-  return -1;
- }
-
- start_headers = self->headersstore;
- end_headers   = start_headers + i;
-
- for (tmp = start_headers; tmp < end_headers;) {
-  for (; tmp < end_headers && (*tmp == '\r' || *tmp == '\n'); tmp++);
-  if ( tmp == end_headers )
-   break;
-  self->headerslen++;
-  for (; tmp < end_headers && !(*tmp == '\r' || *tmp == '\n'); tmp++);
- }
-
- ROAR_DBG("header_parse(self=%p): self->headerslen=%i", self, (int)self->headerslen);
-
- self->headers = roar_mm_malloc(sizeof(struct roar_keyval)*(self->headerslen+1));
- if ( self->headers == NULL ) {
-  self->status = STATUS_BAD_HEADER; // TODO: FIXME: not the right error, but works. ;)
-  return -1;
- }
- memset(self->headers, 0, sizeof(struct roar_keyval)*(self->headerslen+1));
- c = self->headers;
-
- for (tmp = start_headers; tmp < end_headers;) {
-  ROAR_DBG("header_parse(self=%p): tmp='%s'", self, tmp);
-  for (; tmp < end_headers && (*tmp == '\r' || *tmp == '\n'); tmp++) *tmp = '\0';
-  if ( tmp == end_headers )
-   break;
-  ROAR_DBG("header_parse(self=%p): tmp='%s'", self, tmp);
-  c->key = tmp;
-  ROAR_DBG("header_parse(self=%p): c->key='%s'", self, c->key);
-  for (; tmp < end_headers && !(*tmp == '\r' || *tmp == '\n' || *tmp == ':'); tmp++);
-  c->value = tmp;
-  for (; tmp < end_headers && !(*tmp == '\r' || *tmp == '\n'); tmp++);
-  c++;
- }
-
- c->key = NULL;
- c->value = NULL;
-
- for (i = 0; i < (size_t)self->headerslen; i++) {
-  c = &(self->headers[i]);
-  if ( c->value[0] == '\0' ) {
-   c->value = NULL;
-   continue;
-  }
-
-  c->value[0] = '\0';
-  c->value++;
-
-  for (; c->value[0] == ' '; c->value++);
-
-  if ( c->value[0] == '\0' )
-   c->value = NULL;
- }
-
- return 1;
-}
-
-static int header_send(struct roar_buffer ** obuffer, int status, const char * msg, const char * content_type, ssize_t len) {
- struct roar_buffer * buffer;
- size_t bufferlen = 1024;
- void * data;
- char buffer_len[64];
-
- if ( roar_buffer_new_data(&buffer, bufferlen, &data) == -1 )
-  return -1;
-
- if ( msg == NULL ) {
-  switch (status) {
-   case 200: msg = "OK"; break;
-   case 400: msg = "Bad Request"; break;
-   case 404: msg = "File not found"; break;
-   case 500: msg = "Internal server error"; break;
-   default:  msg = "<<<unknown status code>>>"; break;
-  }
- }
-
- if ( content_type == NULL )
-  content_type = "text/plain";
-
- if ( len == (ssize_t)-1 ) {
-  buffer_len[0] = 0;
- } else {
-  snprintf(buffer_len, sizeof(buffer_len), "Content-Length: %lu\r\n", (long unsigned int)len);
- }
-
-/*
-Date: Sun, 29 Jul 2012 01:08:15 GMT
-Cache-Control: no-cache,no-store
-Content-Type: text/html; charset=%s
-*/
- snprintf(data, bufferlen, "HTTP/1.0 %i %s\r\n"
-                           "Server: protocol-http (libroar plugin)\r\n"
-                           "Connection: close\r\n"
-                           "Content-Type: %s\r\n"
-                           "%s"
-                           "\r\n",
-                           status, msg, content_type, buffer_len
-                           );
-
- if ( roar_buffer_set_len(buffer, roar_mm_strlen(data)) == -1 ) {
-  roar_buffer_free(buffer);
-  return -1;
- }
-
- if ( roar_buffer_moveintoqueue(obuffer, &buffer) == -1 ) {
-  roar_buffer_free(buffer);
-  return -1;
- }
-
- return 0;
-}
-
-static void send_errorpage(struct http_client * self, struct roar_buffer ** obuffer, int error, const char * msg) {
- struct roar_buffer * buffer;
- const size_t bufferlen = 1024;
- void * data;
- int httperror;
-
- if ( roar_err_convert(&httperror, ROAR_ERROR_TYPE_HTTP, error, ROAR_ERROR_TYPE_ROARAUDIO) == -1 )
-  httperror = 500;
-
- if ( msg == NULL )
-  msg = roar_error2str(error);
-
- // send header and mark as done early so we can just return in case some of the later calls fail.
- header_send(obuffer, httperror, msg, "text/html", -1);
- self->status = STATUS_DONE;
-
- if ( roar_buffer_new_data(&buffer, bufferlen, &data) == -1 )
-  return;
-
- snprintf(data, bufferlen, "<html>\n"
-                           " <head><title>%i - %s</title></head>\n"
-                           " <body>\n"
-                           "  <h1>%i - %s</h1><hr>\n"
-                           " </body>\n"
-                           "</html>",
-                           httperror, msg, httperror, msg);
-
- _LIBROAR_IGNORE_RET(roar_buffer_set_len(buffer, roar_mm_strlen(data)));
-
- if ( roar_buffer_moveintoqueue(obuffer, &buffer) == -1 )
-  roar_buffer_free(buffer);
-}
-
-static void handle_client(struct http_client * self, struct roar_buffer ** obuffer) {
- struct roar_keyval * kv;
-
- // meta stuff:
- // try to set client name.
- kv = roar_keyval_lookup(self->headers, "user-agent", self->headerslen, 0);
- if ( kv != NULL && kv->value != NULL ) {
-  __ctl(self, CMD_SET_CLIENTNAME, kv->value);
- }
-
- // first try lookup including query string. if nothing is found
- // retry search with only resource path.
- self->resource = resource_lookup_by_uri(self->uri);
- if ( self->resource == NULL )
-  self->resource = resource_lookup_by_uri(self->path);
-
- if ( self->resource == NULL ) {
-  send_errorpage(self, obuffer, roar_error, NULL);
-  return;
- }
-
- if ( resource_header_send(self, obuffer) == -1 ) {
-  send_errorpage(self, obuffer, roar_error, NULL);
-  return;
- }
-
- resource_body_send(self, obuffer);
-
- //send_errorpage(self, obuffer, ROAR_ERROR_CAUSALITY, NULL);
-// send_errorpage(self, obuffer, roar_random_uint16() % ROAR_ERROR_BADLICENSE, NULL);
- return;
-}
-
-
-static int _set_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct http_client * self = roar_mm_malloc(sizeof(struct http_client));
-
- (void)vio, (void)protopara, (void)protoparalen;
-
- if ( self == NULL )
-  return -1;
-
- _init(pluginpara);
-
- memset(self, 0, sizeof(*self));
- self->status = STATUS_WAITING_FOR_HEADERS;
- self->headerslen = (ssize_t)-1;
- self->clientid = client;
-
- if ( pluginpara != NULL ) {
-  roar_dl_para_ref(pluginpara);
-  self->pluginpara = pluginpara;
- }
-
- *userdata = self;
-
- return __ret(self, obuffer);
-}
-
-static int _unset_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct http_client * self = *userdata;
-
- (void)client, (void)vio, (void)obuffer, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( self->input_buffer != NULL )
-  roar_buffer_free(self->input_buffer);
-
- if ( self->method != NULL )
-  roar_mm_free(self->method);
- if ( self->proto != NULL )
-  roar_mm_free(self->proto);
- if ( self->uri != NULL )
-  roar_mm_free(self->uri);
- if ( self->path != NULL )
-  roar_mm_free(self->path);
- if ( self->query_string != NULL )
-  roar_mm_free(self->query_string);
- if ( self->headersstore != NULL )
-  roar_mm_free(self->headersstore);
- if ( self->headers != NULL )
-  roar_mm_free(self->headers);
-
- if ( self->pluginpara != NULL )
-  roar_dl_para_unref(self->pluginpara);
-
- roar_mm_free(self);
- *userdata = NULL;
-
- return 0;
-}
-
-#define _INCREMENT 256
-static int _handle(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct http_client * self = *userdata;
- void * data;
- size_t oldlen;
- ssize_t ret;
-
- (void)client, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- if ( self->status != STATUS_WAITING_FOR_HEADERS )
-  return __ret(self, obuffer);
-
- if ( self->input_buffer == NULL ) {
-  if ( roar_buffer_new_data(&(self->input_buffer), _INCREMENT, &data) == -1 )
-   return -1;
-  oldlen = 0;
- } else {
-  if ( roar_buffer_get_len(self->input_buffer, &oldlen) == -1 )
-   return -1;
-  if ( roar_buffer_set_len(self->input_buffer, oldlen + _INCREMENT) == -1 )
-   return -1;
-  if ( roar_buffer_get_data(self->input_buffer, &data) == -1 )
-   return -1;
- }
-
- data += oldlen;
-
- ret = roar_vio_read(vio, data, _INCREMENT);
- if ( ret == (ssize_t)-1 ) {
-  // we can safely ignore return value here as we return error anyway.
-  _LIBROAR_IGNORE_RET(roar_buffer_set_len(self->input_buffer, oldlen));
-  return -1;
- }
-
- if ( roar_buffer_set_len(self->input_buffer, oldlen + ret) == -1 ) {
-  ROAR_WARN("_handle(*): Can not reset buffer length. BAD. Error was: %s", roar_errorstring);
-  return -1;
- }
-
- header_parse(self);
-
- if ( self->status == STATUS_BAD_HEADER ) {
-  header_send(obuffer, 400, NULL, NULL, -1);
-  self->status = STATUS_DONE;
- } else if ( self->status == STATUS_END_OF_HEADER ) {
-  handle_client(self, obuffer);
- }
-
- return __ret(self, obuffer);
-}
-
-// this is a dummy function only used to kill the client after all data has been flushed.
-static int _flushed(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- struct http_client * self = *userdata;
-
- (void)client, (void)vio, (void)protopara, (void)protoparalen, (void)pluginpara;
-
- ROAR_DBG("_flushed(*) = ?");
-
- if ( self->status == STATUS_RUNNING_DATA )
-  resource_body_send(self, obuffer);
-
- return __ret(self, obuffer);
-}
-
-static const struct roar_dl_proto proto = {
- .proto = ROAR_PROTO_HTTP,
- .description = "Hyper Text Transfer Protocol",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = _set_proto,
- .unset_proto = _unset_proto,
- .handle = _handle,
- .flush = NULL,
- .flushed = _flushed,
- .status = NULL
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, proto, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_http) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-http", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of the HTTP Protocol");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/service-about.c
===================================================================
--- plugins/universal/service-about.c	(revision 6052)
+++ 	(revision )
@@ -1,74 +1,0 @@
-//service-about.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2013-2015
- *
- *  This file is part of roard 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 int __show(const struct roar_dl_libraryname * libname) {
- struct roar_vio_calls * vio = roar_stdout;
-
- roar_vio_printf(vio, "---[ About %s ]---\n", libname->name);
-#define _var(x,y) \
- if ( libname->x != NULL ) \
-  roar_vio_printf(vio, " %-16s: %s\n", y, libname->x);
- _var(libname, "Full Name");
- _var(libversion, "Full Version");
- _var(abiversion, "ABI Version");
- _var(description, "Description");
- _var(contact, "Contact");
- _var(authors, "Other Authors");
- _var(license, "License");
- roar_vio_printf(vio, "---[ End of About ]---\n");
- return 0;
-}
-
-static struct roar_service_about api = {.show = __show};
-
-ROAR_DL_PLUGIN_REG_SERVICES_GET_API(get_api, api)
-
-static const struct roar_dl_service service[1] = {
- {
-  .appname = NULL,
-  .appabi = NULL,
-  .servicename = ROAR_SERVICE_ABOUT_NAME,
-  .serviceabi = ROAR_SERVICE_ABOUT_ABI,
-  .description = "About dialog display API",
-  .flags = ROAR_DL_SERVICE_FLAGS_NONE,
-  .userdata = NULL,
-  .get_api = get_api
- }
-};
-
-ROAR_DL_PLUGIN_REG_SERVICES(service);
-
-ROAR_DL_PLUGIN_START(service_about) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("service-about", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("This plugin provides a simple interface to about dialog display functions.");
- ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_SERVICE);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/universal/tic-tac-toe.c
===================================================================
--- plugins/universal/tic-tac-toe.c	(revision 6067)
+++ 	(revision )
@@ -1,425 +1,0 @@
-//tic-tac-toe.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2015
- *
- *  This file is part of roard 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 _FREE     ' '
-#define _PLAYER   'X'
-#define _COMPUTER 'O'
-#define _NOBODY   '#'
-
-#define _DISPLAY \
-/* Bring Telnet in right mode: */ \
-/* IAC WILL ECHO IAC WILL SUPPRESS_GO_AHEAD IAC WONT LINEMODE */ \
-/* 255  251    1 255  251                 3 255  252       34 */ \
-"\377\373\001\377\373\003\377\374\042" \
-"\e[2J\e[H" \
-" Tic Tac Toe\r\n" \
-" (running: %s, API: %s)\r\n" \
-"\r\n" \
-"Game board:     IDs:\r\n"        \
-" %c | %c | %c      7 | 8 | 9\r\n"   \
-"---+---+---     ---+---+---\r\n" \
-" %c | %c | %c      4 | 5 | 6\r\n"   \
-"---+---+---     ---+---+---\r\n" \
-" %c | %c | %c      1 | 2 | 3\r\n"   \
-"\r\n" \
-"%s\r\n"
-#define _DISPLAY_BUFFER_LEN 1024
-
-#define _HELP \
-"\e[2J\e[H" \
-" Tic Tac Toe\r\n" \
-" (running: %s, API: %s)\r\n" \
-"\r\n" \
-"IDs:            Alternative IDs:\r\n" \
-" 7 | 8 | 9       a | s | d\r\n"   \
-"---+---+---     ---+---+---\r\n"  \
-" 4 | 5 | 6       f |SPC| h\r\n"   \
-"---+---+---     ---+---+---\r\n"  \
-" 1 | 2 | 3       j | k | l\r\n"   \
-"\r\n" \
-"Other keys:\r\n" \
-" q g , .  - Quit\r\n" \
-" n +      - New game\r\n" \
-" H 0      - Help\r\n" \
-" e        - Exit help / Redraw game\r\n" \
-"\r\n" \
-"%s\r\n"
-
-#define MSG__YOUR_TURN       "It's your turn. -- press any ID or H for help, q to quit --"
-#define MSG__CANNOT_PUT_HERE "You can not put your mark here. -- try again another position --"
-#define MSG__WON_PLAYER      "You won. -- press any key to continue or H for help, q to quit --"
-#define MSG__WON_COMPUTER    "I won. -- press any key to continue or H for help, q to quit --"
-#define MSG__WON_NOBODY      "Nobody won. -- press any key to continue or H for help, q to quit --"
-#define MSG__HELP            "-- press e to continue or q to quit --"
-
-typedef char game_state[9];
-
-struct test_result {
- int score_player, score_computer;
- int free;
-};
-
-struct stats {
- int free;
- struct test_result results[9];
-};
-
-static void new_game(game_state * state) {
- memset(state, _FREE, sizeof(game_state));
-}
-
-static int try_put(game_state * state, int id, char player) {
- if ( id < 0 || id > 8 )
-  return -1;
-
- if ( (*state)[id] == _FREE ) {
-  (*state)[id] = player;
-  return 0;
- } else {
-  return -1;
- }
-};
-
-static void analyze(struct stats * stats, game_state * state) {
- static const int textvec[3][3][2] = {
-  {{0, 3}, {1, 3}, {2,  3}},
-  {{0, 1}, {3, 1}, {6,  1}},
-  {{0, 1}, {4, 0}, {8, -1}}
- };
- struct test_result * res;
- int i, j;
- int test;
-
- stats->free = 0;
-
- for (i = 0; i < 9; i++)
-  if ( (*state)[i] == _FREE )
-   stats->free++;
-
- for (test = 0; test < 3; test++) {
-  for (i = 0; i < 3; i++) {
-   res = &(stats->results[i+test*3]);
-   res->score_player = 0;
-   res->score_computer = 0;
-   res->free = -1;
-   for (j = 0; j < 3; j++) {
-    switch ((*state)[textvec[test][j][0] + textvec[test][j][1]*i]) {
-     case _PLAYER: res->score_player++; break;
-     case _COMPUTER: res->score_computer++; break;
-     case _FREE: res->free = textvec[test][j][0] + textvec[test][j][1]*i; break;
-    }
-   }
-  }
- }
-}
-
-static char check_won(game_state * state) {
- struct stats stats;
- int i;
-
- analyze(&stats, state);
-
- for (i = 0; i < 9; i++) {
-  if ( stats.results[i].score_player == 3 )
-   return _PLAYER;
-  if ( stats.results[i].score_computer == 3 )
-   return _COMPUTER;
- }
-
- if ( stats.free == 0)
-  return _NOBODY;
-
- return 0;
-}
-
-static void auto_move(game_state * state, int player_move) {
- static const int corner[4] = {0, 2, 6, 8};
- static const int side[4]   = {1, 3, 5, 7};
- struct stats stats;
- struct test_result * res;
- int i;
-
- analyze(&stats, state);
-
- // step 0: try to win.
- for (i = 0; i < 9; i++) {
-  res = &(stats.results[i]);
-  if ( res->score_computer == 2 && res->free != -1 ) {
-   if ( try_put(state, res->free, _COMPUTER) == 0 )
-    return;
-  }
- }
-
- // step 1: block winning
- for (i = 0; i < 9; i++) {
-  res = &(stats.results[i]);
-  if ( res->score_player == 2 && res->free != -1 ) {
-   if ( try_put(state, res->free, _COMPUTER) == 0 )
-    return;
-  }
- }
-
- // step 2: fork
- // TODO: implement
-
- // step 3: block forking
- // TODO: implement
-
- // step 4: play center
- if ( try_put(state, 4, _COMPUTER) == 0 )
-  return;
-
- // step 5: "Opposite corner"
- for (i = 0; i < 4; i++)
-  if ( player_move == corner[i] )
-   if ( try_put(state, 8 - player_move, _COMPUTER) == 0 )
-    return;
-
- // step 6: Empty corner
- for (i = 0; i < 4; i++)
-  if ( try_put(state, corner[i], _COMPUTER) == 0 )
-   return;
-
- // step 7: Empty side
- for (i = 0; i < 4; i++)
-  if ( try_put(state, side[i], _COMPUTER) == 0 )
-   return;
-}
-
-static void draw_help(struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- struct roar_buffer * buf;
- ssize_t len = 0;
- void * data;
-
- if ( roar_buffer_new_data(&buf, _DISPLAY_BUFFER_LEN, &data) == -1 )
-  return;
-
- snprintf(data, _DISPLAY_BUFFER_LEN, _HELP,
-          pluginpara == NULL || pluginpara->appname    == NULL ? "<unknown>" : pluginpara->appname,
-          pluginpara == NULL || pluginpara->abiversion == NULL ? "<unknown>" : pluginpara->abiversion,
-          MSG__HELP);
-
- len = roar_mm_strlen(data);
-
- if ( roar_buffer_set_len(buf, len) == -1 ) {
-  roar_buffer_free(buf);
- }
-
- _LIBROAR_IGNORE_RET(roar_buffer_moveintoqueue(obuffer, &buf));
-}
-
-static void draw_game(game_state * state, const char * info, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
- struct roar_buffer * buf;
- ssize_t len = 0;
- void * data;
-
- if ( roar_buffer_new_data(&buf, _DISPLAY_BUFFER_LEN, &data) == -1 )
-  return;
-
- snprintf(data, _DISPLAY_BUFFER_LEN, _DISPLAY,
-          pluginpara == NULL || pluginpara->appname    == NULL ? "<unknown>" : pluginpara->appname,
-          pluginpara == NULL || pluginpara->abiversion == NULL ? "<unknown>" : pluginpara->abiversion,
-          (*state)[0], (*state)[1], (*state)[2],
-          (*state)[3], (*state)[4], (*state)[5],
-          (*state)[6], (*state)[7], (*state)[8],
-          info);
-
- len = roar_mm_strlen(data);
-
- if ( roar_buffer_set_len(buf, len) == -1 ) {
-  roar_buffer_free(buf);
- }
-
- _LIBROAR_IGNORE_RET(roar_buffer_moveintoqueue(obuffer, &buf));
-}
-
-static int _set_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- game_state * state;
-
- (void)client, (void)vio, (void)obuffer, (void)protopara, (void)protoparalen;
-
- ROAR_DBG("_set_proto(*) = ?");
-
- state = roar_mm_malloc(sizeof(game_state));
- if ( state == NULL )
-  return -1;
-
- new_game(state);
-
- *userdata = state;
-
- draw_game(state, MSG__YOUR_TURN, obuffer, pluginpara);
-
- ROAR_DBG("_set_proto(client=%i, vio=%p, obuffer=%p, userdata=%p{%p}, protopara=%p, protoparalen=?, pluginpara=%p) = 0", client, vio, obuffer, userdata, *userdata, protopara, pluginpara);
- return 0;
-}
-
-static char map_input(char c) {
- switch (c) {
-  case ',':
-  case '.':
-  case 'g':
-    return 'q';
-   break;
-  case 'a': return '0'; break;
-  case 's': return '1'; break;
-  case 'd': return '2'; break;
-  case 'f': return '3'; break;
-  case ' ': return '4'; break;
-  case 'h': return '5'; break;
-  case 'j': return '6'; break;
-  case 'k': return '7'; break;
-  case 'l': return '8'; break;
-  case '+': return 'n'; break;
-  case '0': return 'H'; break;
- }
-
- if ( c > '9' )
-  return c;
- if ( c >= '7' )
-  return c - 7;
- if ( c >= '4' )
-  return c - 1;
- if ( c >= '1' )
-  return c + 5;
- return c;
-}
-
-static int _handle(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
- char buf[32];
- ssize_t len;
- ssize_t i;
- const char * msg = MSG__YOUR_TURN;
- char won;
- int player_move = -1;
- char c;
-
- (void)client, (void)obuffer, (void)protopara, (void)protoparalen;
-
- ROAR_DBG("_handle(client=%i, vio=%p, obuffer=%p, userdata=%p{%p}, protopara=%p, protoparalen=?, pluginpara=%p) = ?", client, vio, obuffer, userdata, *userdata, protopara, pluginpara);
-
- len = roar_vio_read(vio, buf, sizeof(buf));
-
- if ( len < 1 ) {
-  return -1;
- }
-
- if ( check_won(*userdata) ) {
-  for (i = 0; i < len; i++) {
-   if ( map_input(buf[i]) == 'q' ) {
-    return -1;
-   } else {
-    new_game(*userdata);
-    draw_game(*userdata, MSG__YOUR_TURN, obuffer, pluginpara);
-    return 0;
-   }
-  }
- }
-
- for (i = 0; i < len; i++) {
-  c = map_input(buf[i]);
-  switch (c) {
-   case 'q':
-     return -1;
-    break;
-   case 'n':
-     new_game(*userdata);
-     draw_game(*userdata, MSG__YOUR_TURN, obuffer, pluginpara);
-     return 0;
-    break;
-   case 'H':
-     draw_help(obuffer, pluginpara);
-     return 0;
-    break;
-   case 'e':
-     draw_game(*userdata, MSG__YOUR_TURN, obuffer, pluginpara);
-     return 0;
-    break;
-   case '0': case '1': case '2': case '3': case '4':
-   case '5': case '6': case '7': case '8':
-     if ( try_put(*userdata, c - '0', _PLAYER) == -1 ) {
-      msg = MSG__CANNOT_PUT_HERE;
-      draw_game(*userdata, msg, obuffer, pluginpara);
-      return 0;
-     } else {
-      msg = MSG__YOUR_TURN;
-      i = len; // end the loop.
-      player_move = c - '0';
-     }
-    break;
-  }
- }
-
- won = check_won(*userdata);
-
- if ( !won && player_move != -1 ) {
-  auto_move(*userdata, player_move);
-  won = check_won(*userdata);
- }
-
- switch (won) {
-  case _PLAYER: msg = MSG__WON_PLAYER; break;
-  case _COMPUTER: msg = MSG__WON_COMPUTER; break;
-  case _NOBODY: msg = MSG__WON_NOBODY; break;
- }
-
- draw_game(*userdata, msg, obuffer, pluginpara);
-
- ROAR_DBG("check_client(client=%i, vio=%p) = 0", client, vio);
- return 0;
-}
-
-
-static const struct roar_dl_proto proto = {
- .proto = ROAR_PROTO_GAME,
- .description = "Simple Tic-Tac-Toe game",
- .flags = ROAR_DL_PROTO_FLAGS_NONE,
- .set_proto = _set_proto,
- .unset_proto = NULL,
- .handle = _handle,
- .flush = NULL,
- .flushed = NULL,
- .status = NULL
-};
-
-static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
- (void)para, (void)lib;
- ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, proto, ROAR_DL_PROTO_VERSION);
- return 0;
-}
-
-ROAR_DL_PLUGIN_START(protocol_tic_tac_toe) {
- ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-tic-tac-toe", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
- ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
- ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
- ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
- ROAR_DL_PLUGIN_META_DESC("Implementation of a the well known game Tic-Tac-Toe");
-
- ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
-} ROAR_DL_PLUGIN_END
-
-//ll
Index: plugins/xine/Makefile
===================================================================
--- plugins/xine/Makefile	(revision 5851)
+++ 	(revision )
@@ -1,24 +1,0 @@
-TARGET=xineplug_ao_out_roar.so
-
-OBJ=roar.o
-
-
-XINE_LIBS=`xine-config --libs`
-XINE_CFLAGS=`xine-config --cflags`
-INSTALL_DIR=`xine-config --plugindir`
-
-#DEFINES=-DDEBUG
-CFLAGS += $(DEBUG_g) $(Wall) -O2 $(DEFINES) $(INCLUDE) $(fPIC) $(XINE_CFLAGS)
-LDFLAGS+= $(DEBUG_g) $(Wall) -shared -lroar $(XINE_LIBS)
-
-all: ${TARGET}
-clean:
-	rm -f ${TARGET} *.o
-new: clean all
-
-install: ${TARGET}
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	cp ${TARGET} ${DESTDIR}${INSTALL_DIR}/
-
-xineplug_ao_out_roar.so: $(OBJ)
-	$(CC) $(LDFLAGS) -o xineplug_ao_out_roar.so $(OBJ)
Index: plugins/xine/roar.c
===================================================================
--- plugins/xine/roar.c	(revision 6052)
+++ 	(revision )
@@ -1,206 +1,0 @@
-//roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *      Copyright (C) 2000-2003 the xine project
- *
- *  This file is part of the xine RoarAudio plugin 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 <errno.h>
-#include <string.h>
-#ifdef ROAR_HAVE_H_UNISTD
-#include <unistd.h>
-#endif
-#ifdef ROAR_HAVE_H_SIGNAL
-#include <signal.h>
-#endif
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <inttypes.h>
-
-#include <xine/xine_internal.h>
-#include <xine/xineutils.h>
-#include <xine/audio_out.h>
-#include <xine/metronom.h>
-
-#define AO_OUT_ROAR_IFACE_VERSION 8
-
-#define GAP_TOLERANCE         5000
-
-typedef struct esd_driver_s {
-  ao_driver_t      ao_driver;
-
-  xine_t          *xine;
-
-  int              capabilities;
-
-  struct roar_connection con;
-  struct roar_stream     stream;
-  int fh;
-
-} roar_driver_t;
-
-typedef struct {
-  audio_driver_class_t driver_class;
-  xine_t          *xine;
-} roar_class_t;
-
-static int ao_roar_open(ao_driver_t *this_gen,
-                       uint32_t bits, uint32_t rate, int mode) {
- return -1;
-}
-static void ao_roar_close(ao_driver_t *this_gen) {
- roar_driver_t *this = (roar_driver_t *) this_gen;
-
- if ( this->fh != -1 )
-  close(this->fh);
- this->fh = -1;
-}
-
-static int ao_roar_num_channels(ao_driver_t *this_gen) {
- return -1;
-}
-
-static int ao_roar_bytes_per_frame(ao_driver_t *this_gen) {
-  roar_driver_t *this = (roar_driver_t *) this_gen;
-  return (this->stream.info.bits * this->stream.info.channels)/8;
-}
-
-static int ao_roar_delay(ao_driver_t *this_gen) {
- return 0;
-}
-
-static int ao_roar_write(ao_driver_t *this_gen,
-                        int16_t* frame_buffer, uint32_t num_frames) {
- roar_driver_t *this = (roar_driver_t *) this_gen;
- int bpf = (this->stream.info.bits * this->stream.info.channels)/8;
- return write(this->fh, frame_buffer, num_frames*bpf) / bpf;
-}
-static int ao_roar_get_gap_tolerance (ao_driver_t *this_gen) {
-  return GAP_TOLERANCE;
-}
-
-static void ao_roar_exit(ao_driver_t *this_gen) {
- roar_driver_t *this = (roar_driver_t *) this_gen;
-
- ao_roar_close(this_gen);
-
- roar_disconnect(&(this->con));
-
- free(this);
-}
-
-static int ao_roar_get_property (ao_driver_t *this_gen, int property) {
- return 0;
-}
-static int ao_roar_set_property (ao_driver_t *this_gen, int property, int value) {
- return ~value;
-}
-
-static int ao_roar_ctrl(ao_driver_t *this_gen, int cmd, ...) {
- return 0;
-}
-
-static uint32_t ao_roar_get_capabilities (ao_driver_t *this_gen) {
-  roar_driver_t *this = (roar_driver_t *) this_gen;
-  return this->capabilities;
-}
-
-static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
-                                 const void *data) {
-  roar_driver_t      *this;
-
-  this                     = (roar_driver_t *) xine_xmalloc(sizeof(roar_driver_t));
-  if ( !this )
-   return NULL;
-
-  if ( roar_simple_connect(&(this->con), NULL, "libxine") == -1 ) {
-   free(this);
-   return NULL;
-  }
-
-  this->fh = -1;
-
-  this->capabilities       = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_MUTE_VOL;
-
-
-  this->ao_driver.get_capabilities    = ao_roar_get_capabilities;
-  this->ao_driver.get_property        = ao_roar_get_property;
-  this->ao_driver.set_property        = ao_roar_set_property;
-  this->ao_driver.open                = ao_roar_open;
-  this->ao_driver.num_channels        = ao_roar_num_channels;
-  this->ao_driver.bytes_per_frame     = ao_roar_bytes_per_frame;
-  this->ao_driver.get_gap_tolerance   = ao_roar_get_gap_tolerance;
-  this->ao_driver.delay               = ao_roar_delay;
-  this->ao_driver.write               = ao_roar_write;
-  this->ao_driver.close               = ao_roar_close;
-  this->ao_driver.exit                = ao_roar_exit;
-  this->ao_driver.control             = ao_roar_ctrl;
-
-  return &(this->ao_driver);
-}
-
-
-static char* get_identifier (audio_driver_class_t *this_gen) {
-  return "roar";
-}
-
-static char* get_description (audio_driver_class_t *this_gen) {
-  return _("xine audio output plugin using RoarAudio");
-}
-
-static void dispose_class (audio_driver_class_t *this_gen) {
-
-  roar_class_t *this = (roar_class_t *) this_gen;
-
-  free (this);
-}
-
-static void *init_class (xine_t *xine, void *data) {
-
-  roar_class_t        *this;
-
-  this = (roar_class_t *) xine_xmalloc(sizeof(roar_class_t));
-
-  this->driver_class.open_plugin     = open_plugin;
-  this->driver_class.get_identifier  = get_identifier;
-  this->driver_class.get_description = get_description;
-  this->driver_class.dispose         = dispose_class;
-
-  this->xine = xine;
-
-  return this;
-}
-
-static const ao_info_t ao_info_roar = {
-  4
-};
-
-const plugin_info_t xine_plugin_info[] = {
-  /* type, API, "name", version, special_info, init_function */
-  { PLUGIN_AUDIO_OUT, AO_OUT_ROAR_IFACE_VERSION, "roar", XINE_VERSION_CODE, &ao_info_roar, init_class },
-  { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
-
-//ll
Index: plugins/xmms/.cvsignore
===================================================================
--- plugins/xmms/.cvsignore	(revision 2802)
+++ 	(revision )
@@ -1,2 +1,0 @@
-Makefile.conf
-*.dll
Index: plugins/xmms/Makefile
===================================================================
--- plugins/xmms/Makefile	(revision 5851)
+++ 	(revision )
@@ -1,27 +1,0 @@
-TARGET=libroar.so
-
-OBJ=roar.o gui.o
-
-include ../../Makefile.conf
-include ../../Makefile.inc
-include Makefile.conf
-
-#DEFINES=-DDEBUG
-CFLAGS += $(DEBUG_g) $(Wall) $(Wextra) $(OPTI_O) -I../../include $(DEFINES) $(INCLUDE) $(INCPATH) $(SHARED_CF) $(fPIC) $(GTK_CFLAFS) $(XMMS_CFLAGS)
-LDFLAGS+= $(DEBUG_g) $(Wall) $(SHARED) $(LDPATH) -L../../lib
-LIBS    = $(LIBROAR) $(GTK_LIBS) $(XMMS_LIBS)
-
-all: ${TARGET}
-clean:
-	rm -f ${TARGET} *.o
-new: clean all
-
-install: libroar.so
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	cp libroar.so ${DESTDIR}${INSTALL_DIR}/
-semi-install: libroar.so
-	mkdir -p ${DESTDIR}${INSTALL_DIR}
-	ln -fs `pwd`/libroar.so ${DESTDIR}${INSTALL_DIR}/
-
-libroar.so: $(OBJ)
-	$(CC) $(LDFLAGS) -o libroar.so $(OBJ) $(LIBS)
Index: plugins/xmms/all.h
===================================================================
--- plugins/xmms/all.h	(revision 6052)
+++ 	(revision )
@@ -1,95 +1,0 @@
-//all.h:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of the XMMS RoarAudio output plugin 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.
- *
- */
-
-#ifndef _ALL_H_
-#define _ALL_H_
-
-#include <roaraudio.h>
-
-//#include "xmms/i18n.h"
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "xmms/plugin.h"
-#include "xmms/xmmsctrl.h"
-#include "xmms/dirbrowser.h"
-#include "xmms/configfile.h"
-#include "xmms/util.h"
-
-#define _(x) (x)
-
-gint ctrlsocket_get_session_id(void);
-
-void roar_init(void);
-void roar_about(void);
-void roar_configure(void);
-
-void roar_get_volume(int *l, int *r);
-void roar_set_volume(int l, int r);
-void roar_mixer_init(void);
-void roar_mixer_init_vol(int l, int r);
-
-int roar_playing(void);
-int roar_free(void);
-void roar_write(void *ptr, int length);
-void roar_close(void);
-void roar_flush(int time);
-void roar_pause(short p);
-int roar_open(AFormat fmt, int rate, int nch);
-int roar_get_output_time(void);
-int roar_get_written_time(void);
-
-int roar_update_metadata(void);
-int roar_chk_metadata(void);
-
-#define STATE_CONNECTED   1
-#define STATE_PLAYING     2
-#define STATE_NORECONNECT 4
-
-struct xmms_roar_out {
- int                 state;
- char              * server;
- struct roar_connection con;
- struct roar_stream     stream;
- struct roar_vio_calls  vio;
- long unsigned int   written;
- long unsigned int   bps;
- int                 session;
- int                 pause;
- struct {
-  int l, r;
- } mixer;
- struct {
-  int                server_type;
-  int                port;
-  char             * player_name;
- } cfg;
-} g_inst;
-
-#endif
-
-//ll
Index: plugins/xmms/configure
===================================================================
--- plugins/xmms/configure	(revision 1742)
+++ 	(revision )
@@ -1,112 +1,0 @@
-#!/bin/sh
-
-. ../configure.inc
-
-HAVE_ROAR=false
-
-while [ "$1" != '' ]
-do
- case "$1" in
-  --install-dir|--inst-dir)
-   INSTALL_DIR="$2"
-   shift;
-  ;;
-  --pkg-config)
-   PKG_CONFIG="$2"
-   shift;
-  ;;
-  --force-have-roar)
-   HAVE_ROAR=true
-  ;;
-  --help|-h)
-    cat << EOF
-Usage: ./configure [OPTIONS]...
-
-Options:
-  --help               - Show this help
-  --inst-dir DIR       - Install dir
-  --force-have-roar    - Force to assume libroar is ok
-  --pkg-config PKGCONF - Set filename for pkg-config
-EOF
-    exit 0
-   ;;
-  *)
-    echo 'Unknown option. Try ./configure --help'
-    exit 2
- esac
- shift;
-done
-
-on_error () {
- exit 1;
-}
-
-check_cc;
-check_pkg_config;
-
-echo -n 'testing for gtk... '
-#pkg-config
-
-#if [ "$PKG_CONFIG" != '' ]
-#then
-# GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0 2> /dev/null`
-# GTK_CFLAFS=`$PKG_CONFIG --cflags gtk+-2.0 2> /dev/null`
-#else
- GTK_LIBS=`gtk-config --libs 2> /dev/null`
- GTK_CFLAFS=`gtk-config --cflags 2> /dev/null`
-#fi
-
-if [ "$GTK_LIBS" = '' -a "$GTK_CFLAFS" = '' ]
-then
- echo no.
- on_error;
-else
- echo yes
-fi
-
-echo -n 'testing for xmms... '
-XMMS_LIBS=`xmms-config --libs 2> /dev/null`
-XMMS_CFLAGS=`xmms-config --cflags 2> /dev/null`
-
-if [ "$XMMS_LIBS" = '' -a "$XMMS_CFLAGS" = '' ]
-then
- echo no.
- on_error;
-else
- echo yes
-fi
-
-echo -n 'testing for xmms plugin dir... '
-if [ "$INSTALL_DIR" = '' ]
-then
- INSTALL_DIR=`xmms-config --output-plugin-dir`
-
- if [ "$INSTALL_DIR" = '' ]
- then
-  echo not found.
-  on_error;
- else
-  echo "$INSTALL_DIR"
- fi
-else
-  echo "$INSTALL_DIR"
-fi
-
-check_libroar;
-
-rm -f tests tests.c
-
-echo creating Makefile.conf...
-{
- echo "CC=$CC"
- echo
- echo "GTK_LIBS=$GTK_LIBS"
- echo "GTK_CFLAFS=$GTK_CFLAFS"
- echo
- echo "XMMS_LIBS=$XMMS_LIBS"
- echo "XMMS_CFLAGS=$XMMS_CFLAGS"
- echo
- echo "INSTALL_DIR=$INSTALL_DIR"
-} > Makefile.conf
-
-#ll
Index: plugins/xmms/gui.c
===================================================================
--- plugins/xmms/gui.c	(revision 6052)
+++ 	(revision )
@@ -1,338 +1,0 @@
-//gui.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of the XMMS RoarAudio output plugin 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 "all.h"
-
-// ABOUT:
-
-void roar_about(void) {
- static GtkWidget *dialog;
-
- if (dialog != NULL)
-  return;
-
- dialog = xmms_show_message(
-                _("About RoarAudio Plugin"),
-                _("RoarAudio XMMS Plugin..."
-                 ), _("OK"), FALSE, NULL, NULL);
- gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
-                    GTK_SIGNAL_FUNC(gtk_widget_destroyed),
-                    &dialog);
-}
-
-// CONFIG:
-
-void on_button_ok_enter(GtkButton * button, gpointer user_data) {
-}
-
-void roar_configure(void) {
-  GtkWidget *config_win;
-  GtkWidget *vbox_main;
-  GtkWidget *tabs_main;
-  GtkWidget *frame_server;
-  GtkWidget *alignment_server;
-  GtkWidget *table1;
-  GtkWidget *label_server_type;
-  GtkWidget *label_server_host;
-  GtkWidget *label_server_port;
-  GtkObject *input_server_port_adj;
-  GtkWidget *input_server_port;
-  GtkWidget *input_server_host;
-  GtkWidget *input_server_type;
-  GtkWidget *label_host;
-  GtkWidget *label_server;
-  GtkWidget *frame_proxy;
-  GtkWidget *alignment_proxy;
-  GtkWidget *table2;
-  GtkWidget *label_proxy_type;
-  GtkWidget *label_proxy_addr;
-  GtkWidget *input_proxy_host;
-  GtkWidget *input_proxy_type;
-  GtkWidget *label_frame_proxy;
-  GtkWidget *label_proxy;
-  GtkWidget *vbox_meta;
-  GtkWidget *frame_meta_player;
-  GtkWidget *alignment1;
-  GtkWidget *hbox_meta_player;
-  GtkWidget *label_player_name;
-  GtkWidget *input_meta_player_name;
-  GtkWidget *label_player;
-  GtkWidget *frame_meta_title;
-  GtkWidget *alignment2;
-  GtkWidget *hbox_meta_title;
-  GtkWidget *input_meta_send_title;
-  GtkWidget *input_meta_send_filename;
-  GtkWidget *label_meta_title;
-  GtkWidget *label_meta;
-  GtkWidget *hbox_buttons;
-  GtkWidget *button_ok;
-  GtkWidget *button_cancel;
-
-  config_win = gtk_window_new(GTK_WINDOW_DIALOG);
-  gtk_window_set_title(GTK_WINDOW(config_win), _("RoarAudio Plugin - Configuration"));
-//  gtk_window_set_destroy_with_parent(GTK_WINDOW(config_win), TRUE);
-//  gtk_window_set_icon_name(GTK_WINDOW(config_win), "gtk-preferences");
-
-  gtk_widget_show (config_win);
-
-  vbox_main = gtk_vbox_new (FALSE, 0);
-  gtk_widget_show (vbox_main);
-  gtk_container_add (GTK_CONTAINER (config_win), vbox_main);
-
-  tabs_main = gtk_notebook_new ();
-  gtk_widget_show (tabs_main);
-  gtk_box_pack_start (GTK_BOX (vbox_main), tabs_main, TRUE, TRUE, 0);
-
-  frame_server = gtk_frame_new (NULL);
-  gtk_widget_show (frame_server);
-  gtk_container_add (GTK_CONTAINER (tabs_main), frame_server);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_server), GTK_SHADOW_NONE);
-
-  alignment_server = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment_server);
-  gtk_container_add (GTK_CONTAINER (frame_server), alignment_server);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment_server), 0, 0, 12, 0);
-
-  table1 = gtk_table_new (3, 2, FALSE);
-  gtk_widget_show (table1);
-  gtk_container_add (GTK_CONTAINER (alignment_server), table1);
-
-  label_server_type = gtk_label_new (_("Server Type:"));
-  gtk_widget_show (label_server_type);
-  gtk_table_attach (GTK_TABLE (table1), label_server_type, 0, 1, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_server_type), 0, 0.5);
-
-  label_server_host = gtk_label_new (_("Host or Path:"));
-  gtk_widget_show (label_server_host);
-  gtk_table_attach (GTK_TABLE (table1), label_server_host, 0, 1, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_server_host), 0, 0.5);
-
-  label_server_port = gtk_label_new (_("Port:"));
-  gtk_widget_show (label_server_port);
-  gtk_table_attach (GTK_TABLE (table1), label_server_port, 0, 1, 2, 3,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_server_port), 0, 0.5);
-
-  input_server_port_adj = gtk_adjustment_new (16002, 0, 65535, 1, 10, 10);
-  input_server_port = gtk_spin_button_new (GTK_ADJUSTMENT (input_server_port_adj), 1, 0);
-  gtk_widget_show (input_server_port);
-  gtk_table_attach (GTK_TABLE (table1), input_server_port, 1, 2, 2, 3,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-  input_server_host = gtk_entry_new ();
-  gtk_widget_show (input_server_host);
-  gtk_table_attach (GTK_TABLE (table1), input_server_host, 1, 2, 1, 2,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-/*
-  input_server_type = gtk_combo_box_entry_new_text ();
-  gtk_widget_show (input_server_type);
-  gtk_table_attach (GTK_TABLE (table1), input_server_type, 1, 2, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("Local"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("TCP/IP"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("DECnet"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_server_type), _("Fork"));
-*/
-  label_host = gtk_label_new (_("<b>Host:</b>"));
-  gtk_widget_show (label_host);
-//  gtk_frame_set_label_widget (GTK_FRAME (frame_server), label_host);
-//  gtk_label_set_use_markup (GTK_LABEL (label_host), TRUE);
-
-  label_server = gtk_label_new (_("Server & Network"));
-  gtk_widget_show (label_server);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs_main), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs_main), 0), label_server);
-
-  frame_proxy = gtk_frame_new (NULL);
-  gtk_widget_show (frame_proxy);
-  gtk_container_add (GTK_CONTAINER (tabs_main), frame_proxy);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_proxy), GTK_SHADOW_NONE);
-
-  alignment_proxy = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment_proxy);
-  gtk_container_add (GTK_CONTAINER (frame_proxy), alignment_proxy);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment_proxy), 0, 0, 12, 0);
-
-  table2 = gtk_table_new (2, 2, FALSE);
-  gtk_widget_show (table2);
-  gtk_container_add (GTK_CONTAINER (alignment_proxy), table2);
-
-  label_proxy_type = gtk_label_new (_("Type:"));
-  gtk_widget_show (label_proxy_type);
-  gtk_table_attach (GTK_TABLE (table2), label_proxy_type, 0, 1, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_proxy_type), 0, 0.5);
-
-  label_proxy_addr = gtk_label_new (_("Proxy Address"));
-  gtk_widget_show (label_proxy_addr);
-  gtk_table_attach (GTK_TABLE (table2), label_proxy_addr, 0, 1, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label_proxy_addr), 0, 0.5);
-
-  input_proxy_host = gtk_entry_new ();
-  gtk_widget_show (input_proxy_host);
-  gtk_table_attach (GTK_TABLE (table2), input_proxy_host, 1, 2, 1, 2,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
-/*
-  input_proxy_type = gtk_combo_box_entry_new_text ();
-  gtk_widget_show (input_proxy_type);
-  gtk_table_attach (GTK_TABLE (table2), input_proxy_type, 1, 2, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (GTK_FILL), 0, 0);
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("None"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SOCKS4"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SOCKS4a"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SOCKS4d"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("HTTP Connect"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (input_proxy_type), _("SSH"));
-*/
-
-  label_frame_proxy = gtk_label_new (_("<b>Proxy</b>"));
-  gtk_widget_show (label_frame_proxy);
-/*
-  gtk_frame_set_label_widget (GTK_FRAME (frame_proxy), label_frame_proxy);
-  gtk_label_set_use_markup (GTK_LABEL (label_frame_proxy), TRUE);
-*/
-
-  label_proxy = gtk_label_new (_("Proxy"));
-  gtk_widget_show (label_proxy);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs_main), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs_main), 1), label_proxy);
-
-  vbox_meta = gtk_vbox_new (FALSE, 0);
-  gtk_widget_show (vbox_meta);
-  gtk_container_add (GTK_CONTAINER (tabs_main), vbox_meta);
-
-  frame_meta_player = gtk_frame_new (NULL);
-  gtk_widget_show (frame_meta_player);
-  gtk_box_pack_start (GTK_BOX (vbox_meta), frame_meta_player, TRUE, TRUE, 0);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_meta_player), GTK_SHADOW_NONE);
-
-  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment1);
-  gtk_container_add (GTK_CONTAINER (frame_meta_player), alignment1);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
-
-  hbox_meta_player = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox_meta_player);
-  gtk_container_add (GTK_CONTAINER (alignment1), hbox_meta_player);
-
-  label_player_name = gtk_label_new (_("Player Name:"));
-  gtk_widget_show (label_player_name);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_player), label_player_name, FALSE, FALSE, 0);
-
-  input_meta_player_name = gtk_entry_new ();
-  gtk_widget_show (input_meta_player_name);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_player), input_meta_player_name, TRUE, TRUE, 0);
-  gtk_entry_set_text (GTK_ENTRY (input_meta_player_name), _("XMMS"));
-
-  label_player = gtk_label_new (_("<b>Player</b>"));
-  gtk_widget_show (label_player);
-/*
-  gtk_frame_set_label_widget (GTK_FRAME (frame_meta_player), label_player);
-  gtk_label_set_use_markup (GTK_LABEL (label_player), TRUE);
-*/
-
-  frame_meta_title = gtk_frame_new (NULL);
-  gtk_widget_show (frame_meta_title);
-  gtk_box_pack_start (GTK_BOX (vbox_meta), frame_meta_title, TRUE, TRUE, 0);
-  gtk_frame_set_shadow_type (GTK_FRAME (frame_meta_title), GTK_SHADOW_NONE);
-
-  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
-  gtk_widget_show (alignment2);
-  gtk_container_add (GTK_CONTAINER (frame_meta_title), alignment2);
-//  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0);
-
-  hbox_meta_title = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox_meta_title);
-  gtk_container_add (GTK_CONTAINER (alignment2), hbox_meta_title);
-
-/*
-  input_meta_send_title = gtk_check_button_new_with_mnemonic (_("Send song title to server"));
-  gtk_widget_show (input_meta_send_title);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_title), input_meta_send_title, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (input_meta_send_title), TRUE);
-
-  input_meta_send_filename = gtk_check_button_new_with_mnemonic (_("Send song filename to server"));
-  gtk_widget_show (input_meta_send_filename);
-  gtk_box_pack_start (GTK_BOX (hbox_meta_title), input_meta_send_filename, FALSE, FALSE, 0);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (input_meta_send_filename), TRUE);
-*/
-
-  label_meta_title = gtk_label_new (_("<b>Current Song</b>"));
-  gtk_widget_show (label_meta_title);
-/*
-  gtk_frame_set_label_widget (GTK_FRAME (frame_meta_title), label_meta_title);
-  gtk_label_set_use_markup (GTK_LABEL (label_meta_title), TRUE);
-*/
-
-  label_meta = gtk_label_new (_("Meta Data"));
-  gtk_widget_show (label_meta);
-  gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs_main), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs_main), 2), label_meta);
-
-  hbox_buttons = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox_buttons);
-  gtk_box_pack_start (GTK_BOX (vbox_main), hbox_buttons, TRUE, TRUE, 0);
-
-
-  button_ok = gtk_button_new_with_label(_("OK"));
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_ok, FALSE, FALSE, 0);
-
-  button_cancel = gtk_button_new_with_label(_("Cancel"));
-  gtk_signal_connect_object(GTK_OBJECT(button_cancel), "clicked",
-                            GTK_SIGNAL_FUNC(gtk_widget_destroy),
-                            GTK_OBJECT(config_win));
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_cancel, FALSE, FALSE, 0);
-
-/*
-  button_ok = gtk_button_new_from_stock ("gtk-ok");
-  gtk_widget_show (button_ok);
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_ok, FALSE, FALSE, 0);
-
-  button_cancel = gtk_button_new_from_stock ("gtk-cancel");
-  gtk_widget_show (button_cancel);
-  gtk_box_pack_start (GTK_BOX (hbox_buttons), button_cancel, FALSE, FALSE, 0);
-
-  g_signal_connect_swapped ((gpointer) button_ok, "clicked",
-                            G_CALLBACK (on_button_ok_enter),
-                            GTK_OBJECT (config_win));
-  g_signal_connect_swapped ((gpointer) button_cancel, "clicked",
-                            G_CALLBACK (gtk_widget_destroy),
-                            GTK_OBJECT (config_win));
-*/
-}
-
-//ll
Index: plugins/xmms/roar.c
===================================================================
--- plugins/xmms/roar.c	(revision 6052)
+++ 	(revision )
@@ -1,376 +1,0 @@
-//roar.c:
-
-/*
- *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
- *
- *  This file is part of the XMMS RoarAudio output plugin 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 "all.h"
-
-OutputPlugin roar_op = {
-        NULL,
-        NULL,
-        "RoarAudio XMMS Plugin", /* Description */
-        roar_init,
-        roar_about,
-        roar_configure,
-        roar_get_volume,
-        roar_set_volume,
-        roar_open,
-        roar_write,
-        roar_close,
-        roar_flush,
-        roar_pause,
-        roar_free,
-        roar_playing,
-        roar_get_output_time,
-        roar_get_written_time,
-};
-
-OutputPlugin *get_oplugin_info(void) {
- return &roar_op;
-}
-
-void roar_init(void) {
- ConfigFile * cfgfile;
-
- cfgfile = xmms_cfg_open_default_file();
-
- g_inst.state = 0;
- g_inst.server = NULL;
- g_inst.session = ctrlsocket_get_session_id();
- g_inst.mixer.l = -1;
- g_inst.mixer.r = -1;
-
- xmms_cfg_read_string(cfgfile, "ROAR", "server", &g_inst.server);
-
- xmms_cfg_read_string(cfgfile, "ROAR", "player_name", &g_inst.cfg.player_name);
-
- xmms_cfg_free(cfgfile);
-
- if ( g_inst.cfg.player_name == NULL )
-  g_inst.cfg.player_name = "XMMS";
-
- ROAR_DBG("roar_init(*) = (void)");
-}
-
-int roar_playing(void) {
- return FALSE;
-}
-
-void roar_write(void *ptr, int length) {
- ssize_t r;
-
- if ( g_inst.pause )
-  return;
-
- ROAR_DBG("roar_write(ptr=%p, length=%i) = (void)", ptr, length);
-
- while (length) {
-  if ( (r = roar_vio_write(&(g_inst.vio), ptr, length >= 1764*4 ? 1764*4 : length)) != -1 ) {
-   g_inst.written   += r;
-   ptr              += r;
-   length           -= r;
-  } else {
-   if ( errno == EAGAIN ) {
-    xmms_usleep(1000);
-   } else {
-    return;
-   }
-  }
- }
-}
-
-int roar_open(AFormat fmt, int rate, int nch) {
- int codec = ROAR_CODEC_DEFAULT;
- int bits;
-
- if ( !(g_inst.state & STATE_CONNECTED) ) {
-  if ( roar_simple_connect(&(g_inst.con), g_inst.server, g_inst.cfg.player_name) == -1 ) {
-   return FALSE;
-  }
-  g_inst.state |= STATE_CONNECTED;
- }
-
-  bits = 16;
-  switch (fmt) {
-   case FMT_S8:
-     bits = 8;
-     codec = ROAR_CODEC_DEFAULT;
-    break;
-   case FMT_U8:
-     bits = 8;
-     codec = ROAR_CODEC_PCM_U_LE; // _LE, _BE, _PDP,... all the same for 8 bit output
-    break;
-   case FMT_U16_LE:
-     codec = ROAR_CODEC_PCM_U_LE;
-    break;
-   case FMT_U16_BE:
-     codec = ROAR_CODEC_PCM_U_BE;
-    break;
-   case FMT_U16_NE:
-#if BYTE_ORDER == BIG_ENDIAN
-     codec = ROAR_CODEC_PCM_U_BE;
-#elif BYTE_ORDER == LITTLE_ENDIAN
-     codec = ROAR_CODEC_PCM_U_LE;
-#else
-     codec = ROAR_CODEC_PCM_U_PDP;
-#endif
-    break;
-   case FMT_S16_LE:
-     codec = ROAR_CODEC_PCM_S_LE;
-    break;
-   case FMT_S16_BE:
-     codec = ROAR_CODEC_PCM_S_BE;
-    break;
-   case FMT_S16_NE:
-     codec = ROAR_CODEC_DEFAULT;
-    break;
- }
-
- g_inst.bps       = nch * rate * bits / 8;
-
- roar_close();
-
- if ( roar_vio_simple_new_stream_obj(&(g_inst.vio), &(g_inst.con), &(g_inst.stream),
-                                     rate, nch, bits, codec, ROAR_DIR_PLAY, -1) == -1 ) {
-  roar_disconnect(&(g_inst.con));
-  g_inst.state |= STATE_CONNECTED;
-  g_inst.state -= STATE_CONNECTED;
-  if ( !(g_inst.state & STATE_NORECONNECT) ) {
-   g_inst.state |= STATE_NORECONNECT;
-   xmms_usleep(100000);
-   return roar_open(fmt, rate, nch);
-  } else {
-   g_inst.state -= STATE_NORECONNECT;
-   return FALSE;
-  }
- }
- g_inst.state |= STATE_PLAYING;
-
- g_inst.written = 0;
- g_inst.pause   = 0;
-
- _LIBROAR_IGNORE_RET(roar_stream_set_role(&(g_inst.con), &(g_inst.stream), ROAR_ROLE_MUSIC));
- roar_update_metadata();
- roar_set_volume(g_inst.mixer.l, g_inst.mixer.r);
-
- return TRUE;
-}
-
-void roar_close(void) {
- int was_playing = g_inst.state & STATE_PLAYING;
-
- g_inst.state |= STATE_PLAYING;
- g_inst.state -= STATE_PLAYING;
-
- if ( was_playing ) {
-  roar_vio_close(&(g_inst.vio));
-  xmms_usleep(10000); // give the server 10ms of extra time
- }
-
- g_inst.written = 0;
- ROAR_DBG("roar_close(void) = (void)");
-}
-
-void roar_pause(short p) {
- g_inst.pause = p;
-}
-
-int roar_free(void) {
- if ( g_inst.pause )
-  return 0;
- else
-  return 1000000; // ???
-}
-
-void roar_flush(int time) {
- gint64 r = time;
-
- r *= g_inst.bps;
- r /= 1000;
-
- g_inst.written = r;
-}
-
-int roar_get_output_time(void) {
- return roar_get_written_time();
-}
-
-int roar_get_written_time(void) {
- gint64 r;
-
- if ( !g_inst.bps ) {
-  ROAR_DBG("roar_get_written_time(void) = 0");
-  return 0;
- }
-
- r  = g_inst.written;
- r *= 1000; // sec -> msec
- r /= g_inst.bps;
- ROAR_DBG("roar_get_written_time(void) = %lu", r);
-
- return r;
-}
-
-
-// META DATA:
-
-int roar_update_metadata(void) {
- struct roar_meta   meta;
- char empty = 0;
- char * info;
- char * delm;
- int pos;
-
- pos     = xmms_remote_get_playlist_pos(g_inst.session);
-
- meta.value = &empty;
- meta.key[0] = 0;
- meta.type = ROAR_META_TYPE_NONE;
-
- roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_CLEAR, &meta);
-
- info = xmms_remote_get_playlist_file(g_inst.session, pos);
-
- if ( info ) {
-  if ( strncmp(info, "http:", 5) == 0 )
-   meta.type = ROAR_META_TYPE_FILEURL;
-  else
-   meta.type = ROAR_META_TYPE_FILENAME;
-
-  meta.value = info;
-  ROAR_DBG("roar_update_metadata(*): setting meta data: type=%i, strlen(value)=%i", meta.type, strlen(info));
-  roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_SET, &meta);
-
-  free(info);
- }
-
- info = xmms_remote_get_playlist_title(g_inst.session, pos);
- if ( info ) {
-
-  if ( (delm = strstr(info, " - ")) != NULL ) {
-   *delm = 0;
-   meta.value  = info;
-   meta.type   = ROAR_META_TYPE_ARTIST;
-   roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_SET, &meta);
-
-   meta.value = delm + 3;
-  } else {
-   meta.value = info;
-  }
-
-  meta.type = ROAR_META_TYPE_TITLE;
-
-  roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_SET, &meta);
-
-  free(info);
- }
-
- meta.value = &empty;
- meta.type = ROAR_META_TYPE_NONE;
- roar_stream_meta_set(&(g_inst.con), &(g_inst.stream), ROAR_META_MODE_FINALIZE, &meta);
-
- return 0;
-}
-
-int roar_chk_metadata(void) {
- static int    old_pos = -1;
- static char * old_title = "NEW TITLE";
- int pos;
- char * title;
- int need_update = 0;
-
- pos     = xmms_remote_get_playlist_pos(g_inst.session);
-
- if ( pos != old_pos ) {
-  old_pos = pos;
-  need_update = 1;
- } else {
-  title = xmms_remote_get_playlist_title(g_inst.session, pos);
-
-  if ( strcmp(title, old_title) ) {
-   free(old_title);
-   old_title = title;
-   need_update = 1;
-  } else {
-   free(title);
-  }
- }
-
- if ( need_update ) {
-  roar_update_metadata();
- }
-
- return 0;
-}
-
-// MIXER:
-
-void roar_get_volume(int *l, int *r) {
- int channels;
- struct roar_mixer_settings mixer;
- float fs;
-
- if ( !(g_inst.state & STATE_CONNECTED) || !(g_inst.state & STATE_PLAYING) ) {
-  *l = g_inst.mixer.l;
-  *r = g_inst.mixer.r;
-  return;
- }
-
- if ( roar_get_vol(&(g_inst.con), g_inst.stream.id, &mixer, &channels) == -1 ) {
-  *l = *r = 100;
-  return;
- }
-
- fs = (float)mixer.scale/100.;
-
- if ( channels == 1 ) {
-  *l = *r = mixer.mixer[0]/fs;
- } else {
-  *l = mixer.mixer[0]/fs;
-  *r = mixer.mixer[1]/fs;
- }
-}
-
-void roar_set_volume(int l, int r) {
- struct roar_mixer_settings mixer;
-
- if ( !(g_inst.state & STATE_CONNECTED) )
-  return;
-
- if ( l == -1 ) l = 100;
- if ( r == -1 ) r = 100;
-
- g_inst.mixer.l = l;
- g_inst.mixer.r = r;
-
- if ( !(g_inst.state & STATE_PLAYING) )
-  return;
-
- mixer.mixer[0] = l;
- mixer.mixer[1] = r;
- mixer.scale    = 100;
-
- _LIBROAR_IGNORE_RET(roar_set_vol(&(g_inst.con), g_inst.stream.id, &mixer, 2, ROAR_SET_VOL_UNMAPPED));
-}
-
-//ll
