Index: roard/Makefile
===================================================================
--- roard/Makefile	(revision 3571)
+++ roard/Makefile	(revision 3684)
@@ -6,5 +6,5 @@
 CF_CODEC=codecfilter_cmd.o codecfilter_vorbis.o codecfilter_celt.o codecfilter_speex.o codecfilter_alaw.o codecfilter_mulaw.o codecfilter_sndfile.o codecfilter_fishsound.o
 CF_CONTAINER=codecfilter_wave.o codecfilter_raum.o
-EMUL=emul_esd.o emul_simple.o
+EMUL=emul_esd.o emul_simple.o emul_rsound.o
 
 CF=${CF_CONTAINER} ${CF_CODEC}
Index: roard/clients.c
===================================================================
--- roard/clients.c	(revision 3579)
+++ roard/clients.c	(revision 3684)
@@ -405,4 +405,9 @@
 #endif
 #endif
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD
+  case ROAR_PROTO_RSOUND:
+    rv = clients_delete(id);
+   break;
+#endif
   default:
     rv = -1;
Index: roard/emul_rsound.c
===================================================================
--- roard/emul_rsound.c	(revision 3684)
+++ roard/emul_rsound.c	(revision 3684)
@@ -0,0 +1,130 @@
+//emul_rsound.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
+ *
+ *  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.h"
+
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND
+
+static int emul_rsound_lastcon = -1;
+
+int emul_rsound_new_client  (int client, int data);
+
+int emul_rsound_on_connect  (int fh, struct roard_listen * lsock) {
+ int oldfh = emul_rsound_lastcon;
+ int client;
+ char buf[8] = {0, 0, 0, 0, 0, 1, 0, 0};
+
+ if ( emul_rsound_lastcon == -1 ) {
+  emul_rsound_lastcon = fh;
+  return -2;
+ } else {
+  emul_rsound_lastcon = -1;
+
+  client = clients_new();
+
+  if ( client == -1 )
+   return -1;
+
+  if ( clients_set_fh(client, fh) == -1 ) {
+   ROAR_ERR("net_get_new_client(void): Can not set client's fh");
+
+   clients_delete(client);
+   close(oldfh);
+   close(fh);
+
+   ROAR_DBG("net_get_new_client(void) = -1");
+   return -1;
+  }
+
+  if ( emul_rsound_new_client(client, oldfh) == -1 ) {
+   clients_delete(client);
+   return -1;
+  }
+
+  ROAR_NETWORK_WRITE(oldfh, buf, 8);
+
+  return client;
+ }
+
+ return -1;
+}
+
+int emul_rsound_new_client  (int client, int data) {
+ struct roar_stream_server * ss;
+ struct roar_stream        *  s;
+ struct roar_client        *  c;
+ int stream;
+
+ if ( clients_get(client, &c) == -1 ) {
+  return -1;
+ }
+
+ if ((stream = streams_new()) == -1 ) {
+  clients_delete(client);
+  return -1;
+ }
+
+ if ( streams_get(stream, &ss) == -1 ) {
+  streams_delete(stream);
+  clients_delete(client);
+  return -1;
+ }
+
+ s = ROAR_STREAM(ss);
+
+ if ( client_stream_add(client, stream) == -1 ) {
+  streams_delete(stream);
+  clients_delete(client);
+  return -1;
+ }
+
+ memcpy(&(s->info), g_sa, sizeof(struct roar_audio_info));
+
+ ss->codec_orgi = s->info.codec = ROAR_CODEC_DEFAULT;
+
+ if ( streams_set_dir(stream, ROAR_DIR_PLAY, 1) == -1 ) {
+  clients_delete(client);
+  return -1;
+ }
+
+/*
+ if ( client_stream_exec(client, stream) == -1 ) {
+  clients_delete(client);
+  return -1;
+ }
+*/
+
+ if ( client_stream_set_fh(client, stream, data) == -1 ) {
+  streams_delete(stream);
+  clients_delete(client);
+  return -1;
+ }
+
+ return 0;
+}
+
+#endif
+
+//ll
Index: roard/include/emul_rsound.h
===================================================================
--- roard/include/emul_rsound.h	(revision 3684)
+++ roard/include/emul_rsound.h	(revision 3684)
@@ -0,0 +1,39 @@
+//emul_rsound.h:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
+ *
+ *  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.
+ *
+ */
+
+#ifndef _EMUL_RSOUND_H_
+#define _EMUL_RSOUND_H_
+
+#include <roaraudio.h>
+
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND
+
+int emul_rsound_on_connect  (int fh, struct roard_listen * lsock);
+
+#endif
+
+#endif
+
+//ll
Index: roard/include/roard.h
===================================================================
--- roard/include/roard.h	(revision 3572)
+++ roard/include/roard.h	(revision 3684)
@@ -99,4 +99,5 @@
 #include "emul_esd.h"
 #include "emul_simple.h"
+#include "emul_rsound.h"
 #include "sources.h"
 #include "sample.h"
Index: roard/network.c
===================================================================
--- roard/network.c	(revision 3603)
+++ roard/network.c	(revision 3684)
@@ -96,4 +96,18 @@
  ROAR_DBG("net_get_new_client(void): fh = %i", fh);
 
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND
+ if ( lsock->proto == ROAR_PROTO_RSOUND ) {
+  client = emul_rsound_on_connect(fh, lsock);
+  switch (client) {
+   case -1: return -1; break;
+   case -2: return  0; break;
+   default: // TODO: write error handling
+     clients_get(client, &c);
+     fh = c->fh;
+    break;
+  }
+ } else {
+#endif
+
  client = clients_new();
 
@@ -107,4 +121,7 @@
   return -1;
  }
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND
+ }
+#endif
 
  if ( clients_get(client, &c) != -1 ) {
@@ -166,4 +183,8 @@
    break;
 #endif
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND
+  case ROAR_PROTO_RSOUND: // nothing to do here.
+   break;
+#endif
   default:
     // OS independiend code to close the socket:
Index: roard/roard.c
===================================================================
--- roard/roard.c	(revision 3613)
+++ roard/roard.c	(revision 3684)
@@ -216,4 +216,7 @@
  printf("  simple        WM LRX - PulseAudio simple protocol\n");
 #endif
+#ifndef ROAR_WITHOUT_DCOMP_EMUL_RSOUND
+ printf("  rsound        W      - RSound emulation\n");
+#endif
 }
 
