Index: libroardsp/Makefile
===================================================================
--- libroardsp/Makefile	(revision 922)
+++ libroardsp/Makefile	(revision 979)
@@ -4,5 +4,5 @@
 OBJS=libroardsp.o filter.o filterchain.o alaw.o mulaw.o
 OLDROAR=midi.o
-FILTER=lowp.o highp.o amp.o
+FILTER=lowp.o highp.o amp.o quantify.o add.o clip.o
 
 #DEFINES        = -DDEBUG
Index: libroardsp/filter.c
===================================================================
--- libroardsp/filter.c	(revision 882)
+++ libroardsp/filter.c	(revision 979)
@@ -35,8 +35,14 @@
  {ROARDSP_FILTER_AMP, "AMP", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, {
            {NULL, NULL, NULL},{roardsp_amp_calc8, NULL, NULL},{roardsp_amp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
+ {ROARDSP_FILTER_ADD, "Add", roardsp_add_init, roardsp_amp_uninit, roardsp_amp_ctl, {
+           {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_add_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
  {ROARDSP_FILTER_LOWP, "Lowpass", roardsp_lowp_init, roardsp_lowp_uninit, roardsp_lowp_ctl, {
            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_lowp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
  {ROARDSP_FILTER_HIGHP, "Highpass", roardsp_highp_init, roardsp_highp_uninit, roardsp_highp_ctl, {
            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_highp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
+ {ROARDSP_FILTER_QUANTIFY, "Quantifier", roardsp_quantify_init, NULL, roardsp_quantify_ctl, {
+           {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_quantify_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
+ {ROARDSP_FILTER_CLIP, "Clip", roardsp_clip_init, NULL, roardsp_clip_ctl, {
+           {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_clip_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
  {-1, NULL, NULL, NULL, NULL, {
       // ?                  8Bit               16Bit              24Bit              32Bit
Index: libroardsp/filter_add.c
===================================================================
--- libroardsp/filter_add.c	(revision 979)
+++ libroardsp/filter_add.c	(revision 979)
@@ -0,0 +1,58 @@
+//add.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - December 2008
+ *
+ *  This file is part of libroardsp 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.
+ *
+ *  libroardsp 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, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "libroardsp.h"
+
+int roardsp_add_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) {
+ struct roardsp_amp * self = malloc(sizeof(struct roardsp_amp));
+ int32_t fac;
+
+ if ( self == NULL )
+  return -1;
+
+ memset(self, 0, sizeof(struct roardsp_amp));
+
+ filter->inst = (void*) self;
+
+ fac = 0;
+ roardsp_amp_ctl(filter, ROARDSP_FCTL_MUL, &fac);
+ fac = 1;
+ roardsp_amp_ctl(filter, ROARDSP_FCTL_DIV, &fac);
+
+ return 0;
+}
+
+int roardsp_add_calc16  (struct roardsp_filter * filter, void * data, size_t samples) {
+ struct roardsp_amp * self = (struct roardsp_amp *) filter->inst;
+ int16_t * samp = (int16_t *) data;
+ size_t i;
+
+ for (i = 0; i < samples; i++) {
+  samp[i] += self->mul / self->div;
+ };
+
+ return 0;
+}
+
+//ll
Index: libroardsp/filter_clip.c
===================================================================
--- libroardsp/filter_clip.c	(revision 979)
+++ libroardsp/filter_clip.c	(revision 979)
@@ -0,0 +1,69 @@
+//clip.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - December 2008
+ *
+ *  This file is part of libroardsp 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.
+ *
+ *  libroardsp 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, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "libroardsp.h"
+
+int roardsp_clip_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) {
+ int n = 64;
+
+ roardsp_amp_ctl(filter, ROARDSP_FCTL_N, &n);
+
+ return 0;
+}
+
+int roardsp_clip_calc16  (struct roardsp_filter * filter, void * data, size_t samples) {
+ int16_t * samp = (int16_t *) data;
+ register int32_t s = (int32_t)filter->inst;
+ size_t i;
+
+ for (i = 0; i < samples; i++) {
+  if ( samp[i] > s ) {
+   samp[i]  = s;
+  } else if ( -samp[i] > s ) {
+   samp[i]  = -s;
+  }
+ }
+
+ ROAR_DBG("roardsp_quantify_calc16(*) = 0");
+ return 0;
+}
+
+int roardsp_clip_ctl   (struct roardsp_filter * filter, int cmd, void * data) {
+ int32_t old;
+
+ if ( cmd == ROARDSP_FCTL_LIMIT ) {
+  old = (int32_t)filter->inst;
+  filter->inst = (void*)labs(*(int32_t*)data);
+  *(int32_t*)data = old;
+ } else {
+  ROAR_DBG("roardsp_clip_ctl(*) = -1");
+  return -1;
+ }
+
+
+ ROAR_DBG("roardsp_clip_ctl(*) = 0");
+ return 0;
+}
+
+//ll
Index: libroardsp/filter_quantify.c
===================================================================
--- libroardsp/filter_quantify.c	(revision 979)
+++ libroardsp/filter_quantify.c	(revision 979)
@@ -0,0 +1,73 @@
+//quantify.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - December 2008
+ *
+ *  This file is part of libroardsp 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.
+ *
+ *  libroardsp 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, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "libroardsp.h"
+
+int roardsp_quantify_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) {
+ int n = 64;
+
+ roardsp_amp_ctl(filter, ROARDSP_FCTL_N, &n);
+
+ ROAR_DBG("roardsp_quantify_init(*) = 0");
+ return 0;
+}
+
+int roardsp_quantify_calc16  (struct roardsp_filter * filter, void * data, size_t samples) {
+ int16_t * samp = (int16_t *) data;
+ register float s;
+ size_t i;
+
+ for (i = 0; i < samples; i++) {
+  s        = samp[i];
+  s       /= 32768;
+  s       *= (int32_t)filter->inst;
+  s        = (int16_t)s;
+//  ROAR_WARN("roardsp_quantify_calc16(*): s=%f", s);
+  s       /= (int32_t)filter->inst;
+  s       *= 32768;
+  samp[i]  = s;
+ };
+
+ ROAR_DBG("roardsp_quantify_calc16(*) = 0");
+ return 0;
+}
+
+int roardsp_quantify_ctl   (struct roardsp_filter * filter, int cmd, void * data) {
+ int32_t old;
+
+ if ( cmd == ROARDSP_FCTL_N ) {
+  old = (int32_t)filter->inst;
+  filter->inst = (void*)*(int32_t*)data;
+  *(int32_t*)data = old;
+ } else {
+  ROAR_DBG("roardsp_quantify_ctl(*) = -1");
+  return -1;
+ }
+
+
+ ROAR_DBG("roardsp_quantify_ctl(*) = 0");
+ return 0;
+}
+
+//ll
