Index: ChangeLog
===================================================================
--- ChangeLog	(revision 4807)
+++ ChangeLog	(revision 4809)
@@ -4,4 +4,5 @@
 	* Added source radionoise to roard. This is used to generate low energy noise
 	  so codecs do not drop to (near) zero bitrate.
+	* Added aRts (artsc) driver to roard.
 
 v. 0.4beta4 - Sun Mar 20 2011 12:15 CET
Index: roard/Makefile
===================================================================
--- roard/Makefile	(revision 4773)
+++ roard/Makefile	(revision 4809)
@@ -3,5 +3,5 @@
 OBJ=roard.o driver.o mixer.o output.o signals.o loop.o clients.o streams.o network.o commands.o req.o sources.o sample.o meta.o codecfilter.o lib.o ssynth.o container_framework.o plugins.o memlock.o hwmixer.o auth.o caps.o
 SUBSYS=midi.o light.o raw.o rdtcs.o waveform.o beep.o
-DRV=driver_esd.o driver_ao.o driver_roar.o driver_raw.o driver_oss.o driver_shout.o driver_sndio.o driver_dmx.o driver_pwmled.o driver_sysclock.o driver_wmm.o driver_dstr.o driver_alsa.o driver_rsound.o driver_portaudio.o driver_pulsesimple.o driver_jack.o
+DRV=driver_esd.o driver_ao.o driver_roar.o driver_raw.o driver_oss.o driver_shout.o driver_sndio.o driver_dmx.o driver_pwmled.o driver_sysclock.o driver_wmm.o driver_dstr.o driver_alsa.o driver_rsound.o driver_portaudio.o driver_pulsesimple.o driver_jack.o driver_artsc.o
 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 codecfilter_flac.o
 CF_CONTAINER=codecfilter_wave.o codecfilter_raum.o codecfilter_au.o
@@ -20,5 +20,5 @@
 CFLAGS   += -g -Wall $(OPTI_O) $(DEFINES) $(PKGDEFINES) $(INCLUDE) $(INCPATH)
 LDFLAGS  += -g -rdynamic -L../lib/ $(LDPATH)
-DRVLIBS   = $(lib_esd) $(lib_ossaudio) $(lib_ao) $(lib_shout) $(lib_sndio) $(lib_rsound) $(lib_portaudio) $(lib_pablio) $(lib_asound) $(lib_winmm) $(lib_pulse_simple) $(lib_pulse) $(lib_jack)
+DRVLIBS   = $(lib_esd) $(lib_ossaudio) $(lib_ao) $(lib_shout) $(lib_sndio) $(lib_rsound) $(lib_portaudio) $(lib_pablio) $(lib_asound) $(lib_winmm) $(lib_pulse_simple) $(lib_pulse) $(lib_jack) $(lib_artsc)
 CODEC_CELT= $(lib_celt) $(lib_celt0)
 CODECLIBS = $(lib_vorbisfile) $(lib_vorbisenc) $(lib_vorbis) $(lib_fishsound) $(lib_speex) $(lib_speexdsp) $(CODEC_CELT) $(lib_flac)
Index: roard/driver.c
===================================================================
--- roard/driver.c	(revision 4708)
+++ roard/driver.c	(revision 4809)
@@ -105,4 +105,8 @@
   NULL, NULL, driver_jack_open_vio},
 #endif
+#endif
+#ifdef ROAR_HAVE_LIBARTSC
+ {"artsc", "aRts plain C API", "(none)", DRV_FLAG_NONE, ROAR_SUBSYS_WAVEFORM,
+  NULL, NULL, driver_artsc_open_vio},
 #endif
  {NULL, NULL, NULL, DRV_FLAG_NONE, 0, NULL, NULL, NULL} // end of list
Index: roard/driver_artsc.c
===================================================================
--- roard/driver_artsc.c	(revision 4809)
+++ roard/driver_artsc.c	(revision 4809)
@@ -0,0 +1,171 @@
+//driver_artsc.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011
+ *
+ *  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"
+
+#ifdef ROAR_HAVE_LIBARTSC
+
+#define INIT     +1
+#define SHUTDOWN -1
+
+static int driver_artsc_init_shutdown (int action) {
+ static int state = 0;
+
+ if ( action != INIT && action != SHUTDOWN )
+  return -1;
+
+ if ( state == 0 && action == INIT ) {
+  if ( arts_init() != 0 )
+   return -1;
+ } else if ( state == 1 && action == SHUTDOWN ) {
+  arts_free();
+ }
+
+ state += action;
+
+ return 0;
+}
+
+int     driver_artsc_open_vio(struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream) {
+ struct roar_artsc * self = NULL;
+
+ (void)sstream;
+
+ if ( fh != -1 || device != NULL )
+  return -1;
+
+ self = roar_mm_malloc(sizeof(struct roar_artsc));
+
+ if ( self == NULL )
+  return -1;
+
+ memset(self, 0, sizeof(struct roar_artsc));
+
+ if ( driver_artsc_init_shutdown(INIT) == -1 ) {
+  roar_mm_free(self);
+  return -1;
+ }
+
+ info->codec = ROAR_CODEC_DEFAULT;
+
+ self->info   = info;
+ self->stream = arts_play_stream(info->rate, info->bits, info->channels, "roard");
+
+ if ( self->stream == NULL ) {
+  roar_mm_free(self);
+  driver_artsc_init_shutdown(SHUTDOWN);
+  return -1;
+ }
+
+ memset(inst, 0, sizeof(struct roar_vio_calls));
+
+ inst->inst     = (void*) self;
+ inst->write    = driver_artsc_write;
+ inst->close    = driver_artsc_close;
+ inst->ctl      = driver_artsc_ctl;
+ inst->nonblock = driver_artsc_nonblock;
+
+ return 0;
+}
+
+ssize_t driver_artsc_write   (struct roar_vio_calls * vio, void *buf, size_t count) {
+ struct roar_artsc * self = vio->inst;
+ int ret = arts_write(self->stream, buf, count);
+
+ if ( ret >= 0 )
+  return ret;
+
+ return -1;
+}
+
+int     driver_artsc_close   (struct roar_vio_calls * vio) {
+ struct roar_artsc * self = vio->inst;
+
+ arts_close_stream(self->stream);
+
+ roar_mm_free(self);
+
+ return driver_artsc_init_shutdown(SHUTDOWN);
+}
+
+int     driver_artsc_nonblock(struct roar_vio_calls * vio, int state) {
+ struct roar_artsc * self = vio->inst;
+ int ret;
+
+ switch (state) {
+  case ROAR_SOCKET_NONBLOCK:
+    ret = arts_stream_set(self->stream, ARTS_P_BLOCKING, 0);
+    if ( ret == 0 )
+     return 0;
+   break;
+  case ROAR_SOCKET_BLOCK:
+    ret = arts_stream_set(self->stream, ARTS_P_BLOCKING, 1);
+    if ( ret == 1 )
+     return 0;
+   break;
+ }
+
+ return -1;
+}
+
+int     driver_artsc_ctl     (struct roar_vio_calls * vio, int cmd, void * data) {
+ struct roar_artsc * self = vio->inst;
+ ssize_t bps;
+ int ret;
+ uint_least32_t tmp;
+
+ switch (cmd) {
+  case ROAR_VIO_CTL_GET_DBLKSIZE:
+    ret = arts_stream_get(self->stream, ARTS_P_PACKET_SIZE);
+    if ( ret > 0 ) {
+     *(uint_least32_t *)data = ret;
+     return 0;
+    }
+   break;
+  case ROAR_VIO_CTL_GET_DELAY:
+    ret = arts_stream_get(self->stream, ARTS_P_TOTAL_LATENCY);
+    if ( ret < 0 )
+     return -1;
+    bps = roar_info2bitspersec(self->info);
+    if ( bps < 0 )
+     return -1;
+
+    tmp  = bps / (ssize_t)8;
+    tmp *= ret;
+    tmp /= (uint_least32_t)1000;
+
+    *(uint_least32_t *)data = tmp;
+
+    return 0;
+  default:
+    return -1;
+ }
+
+ return -1;
+}
+
+#endif
+
+//ll
Index: roard/include/driver.h
===================================================================
--- roard/include/driver.h	(revision 4764)
+++ roard/include/driver.h	(revision 4809)
@@ -139,4 +139,9 @@
 #endif
 
+#ifdef ROAR_HAVE_LIBARTSC
+#include <kde/artsc/artsc.h>
+#include "driver_artsc.h"
+#endif
+
 #define DRV_FLAG_NONE           0x00
 #define DRV_FLAG_FHSEC          0x01
Index: roard/include/driver_artsc.h
===================================================================
--- roard/include/driver_artsc.h	(revision 4809)
+++ roard/include/driver_artsc.h	(revision 4809)
@@ -0,0 +1,42 @@
+//driver_artsc.h:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011
+ *
+ *  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 _DRIVER_ARTSC_H_
+#define _DRIVER_ARTSC_H_
+
+struct roar_artsc {
+ arts_stream_t stream;
+ struct roar_audio_info * info;
+};
+
+int     driver_artsc_open_vio(struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream);
+ssize_t driver_artsc_write   (struct roar_vio_calls * vio, void *buf, size_t count);
+int     driver_artsc_close   (struct roar_vio_calls * vio);
+int     driver_artsc_nonblock(struct roar_vio_calls * vio, int state);
+int     driver_artsc_ctl     (struct roar_vio_calls * vio, int cmd, void * data);
+
+#endif
+
+//ll
