Index: libroardsp/filter.c
===================================================================
--- libroardsp/filter.c	(revision 5173)
+++ libroardsp/filter.c	(revision 5177)
@@ -48,5 +48,6 @@
            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_quantify_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
  {ROARDSP_FILTER_CLIP, "Clip", roardsp_clip_init, roardsp_clip_uninit, roardsp_clip_ctl, roardsp_clip_reset, {
-           {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_clip_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
+           {NULL, NULL, NULL},{roardsp_clip_calc8, NULL, NULL},{roardsp_clip_calc16, NULL, NULL},
+           {NULL, NULL, NULL},{roardsp_clip_calc32, NULL, NULL}}},
  {ROARDSP_FILTER_DOWNMIX, "downmix", roardsp_quantify_init, NULL, roardsp_downmix_ctl, roardsp_downmix_reset, {
            {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, roardsp_downmix_calc162},{NULL, NULL, NULL},{NULL, NULL, NULL}}},
Index: libroardsp/filter_clip.c
===================================================================
--- libroardsp/filter_clip.c	(revision 5175)
+++ libroardsp/filter_clip.c	(revision 5177)
@@ -38,45 +38,55 @@
 }
 
-static inline int16_t _clip16(int16_t s, struct roardsp_clip * self) {
- switch (self->mode) {
-  case ROARDSP_CLIP_MODE_LIMIT:
-    return s > 0 ? self->limit : -self->limit;
-   break;
-  case ROARDSP_CLIP_MODE_ZERO:
-    return 0;
-   break;
-  case ROARDSP_CLIP_MODE_WARP:
-    if ( s > 0 ) {
-     return s - 2*self->limit;
-    } else {
-     return s + 2*self->limit;
-    }
-   break;
-  case ROARDSP_CLIP_MODE_NOISE:
-    return (s > 0 ? 1 : -1) * (self->limit - (roar_random_uint16() & 0xFF));
-   break;
- }
-
- ROAR_WARN("_clip16(s=%i, self=%p{.mode=%i, ...}) = 0 // ERROR: Bad mode", (int)s, self, (int)self->mode);
- return 0;
+#define _clipX(bits) \
+static inline int##bits##_t _clip##bits (int##bits##_t s, struct roardsp_clip * self) { \
+ switch (self->mode) { \
+  case ROARDSP_CLIP_MODE_LIMIT: \
+    return s > 0 ? self->limit : -self->limit; \
+   break; \
+  case ROARDSP_CLIP_MODE_ZERO: \
+    return 0; \
+   break; \
+  case ROARDSP_CLIP_MODE_WARP: \
+    if ( s > 0 ) { \
+     return s - 2*self->limit; \
+    } else { \
+     return s + 2*self->limit; \
+    } \
+   break; \
+  case ROARDSP_CLIP_MODE_NOISE: \
+    return (s > 0 ? 1 : -1) * (self->limit - (roar_random_uint16() & 0xFF)); \
+   break; \
+ } \
+\
+ ROAR_WARN("_clip16(s=%i, self=%p{.mode=%i, ...}) = 0 // ERROR: Bad mode", (int)s, self, (int)self->mode); \
+ return 0; \
 }
 
-int roardsp_clip_calc16  (struct roardsp_filter * filter, void * data, size_t samples) {
- struct roardsp_clip * self = filter->inst;
- int16_t * samp = (int16_t *) data;
- register int32_t s = self->limit;
- size_t i;
+#define _calcX(bits) \
+int roardsp_clip_calc##bits  (struct roardsp_filter * filter, void * data, size_t samples) { \
+ struct roardsp_clip * self = filter->inst; \
+ int##bits##_t * samp = (int##bits##_t *) data; \
+ register int32_t s = self->limit; \
+ size_t i; \
+\
+ for (i = 0; i < samples; i++) { \
+  if ( samp[i] > s ) { \
+   samp[i]  = _clip##bits (samp[i], self); \
+  } else if ( -samp[i] > s ) { \
+   samp[i]  = _clip##bits (samp[i], self); \
+  } \
+ } \
+\
+ ROAR_DBG("roardsp_quantify_calc16(*) = 0"); \
+ return 0; \
+}
 
- for (i = 0; i < samples; i++) {
-  if ( samp[i] > s ) {
-   samp[i]  = _clip16(samp[i], self);
-  } else if ( -samp[i] > s ) {
-   samp[i]  = _clip16(samp[i], self);
-  }
- }
+#define _setX(bits) \
+ _clipX(bits) \
+ _calcX(bits)
 
- ROAR_DBG("roardsp_quantify_calc16(*) = 0");
- return 0;
-}
+_setX(8)
+_setX(16)
+_setX(32)
 
 int roardsp_clip_ctl   (struct roardsp_filter * filter, int cmd, void * data) {
@@ -107,9 +117,19 @@
 
 int roardsp_clip_reset (struct roardsp_filter * filter, int what) {
- int32_t n = 16384;
  int32_t mode = ROARDSP_CLIP_MODE_LIMIT;
+ int32_t n;
 
  if ( filter == NULL )
   return -1;
+
+ switch (filter->bits) {
+  case  8: n =         64L; break;
+  case 16: n =      16384L; break;
+  case 32: n = 1073741824L; break;
+  default:
+    roar_err_set(ROAR_ERROR_NOTSUP);
+    return -1;
+   break;
+ }
 
  switch (what) {
