Index: include/libroardsp/float.h
===================================================================
--- include/libroardsp/float.h	(revision 4513)
+++ include/libroardsp/float.h	(revision 4514)
@@ -39,9 +39,9 @@
 #include "libroardsp.h"
 
-int roar_conv_int32_float(float   * dst, int32_t * src, size_t len);
-int roar_conv_float_int32(int32_t * dst, float   * src, size_t len);
+int roar_conv_int32_float(float   * dst, const int32_t * src, size_t len);
+int roar_conv_float_int32(int32_t * dst, const float   * src, size_t len);
 
-int roar_conv_int32_float_deint(float   ** dst, int32_t * src, size_t len, size_t channels);
-int roar_conv_float_int32_enint(int32_t ** dst, float   * src, size_t len, size_t channels);
+int roar_conv_int32_float_deint(float   ** dst, const int32_t * src, size_t len, size_t channels);
+int roar_conv_float_int32_enint(int32_t  * dst, const float   ** src, size_t len, size_t channels);
 
 #endif
Index: libroardsp/float.c
===================================================================
--- libroardsp/float.c	(revision 4513)
+++ libroardsp/float.c	(revision 4514)
@@ -25,9 +25,134 @@
 #include "libroardsp.h"
 
-int roar_conv_int32_float(float   * dst, int32_t * src, size_t len);
-int roar_conv_float_int32(int32_t * dst, float   * src, size_t len);
+static inline float   _si32_to_float (int32_t src) {
+ if ( src > 0 ) {
+  return (float)src / 2147483647.f;
+ } else {
+  return (float)src / 2147483648.f;
+ }
+}
 
-int roar_conv_int32_float_deint(float   ** dst, int32_t * src, size_t len, size_t channels);
-int roar_conv_float_int32_enint(int32_t ** dst, float   * src, size_t len, size_t channels);
+static inline int32_t _float_to_si32 (float   src) {
+ if ( src > 0 ) {
+  return (src * 2147483647.f);
+ } else {
+  return (src * 2147483648.f);
+ }
+}
+
+int roar_conv_int32_float(float   * dst, const int32_t * src, size_t len) {
+ size_t i;
+
+ if ( len == 0 )
+  return 0;
+
+ if ( dst == NULL || src == NULL )
+  return -1;
+
+ for (i = 0; i < len; i++)
+  dst[i] = _si32_to_float(src[i]);
+
+ return 0;
+}
+
+int roar_conv_float_int32(int32_t * dst, const float   * src, size_t len) {
+ size_t i;
+
+ if ( len == 0 )
+  return 0;
+
+ if ( dst == NULL || src == NULL )
+  return -1;
+
+ for (i = 0; i < len; i++)
+  dst[i] = _float_to_si32(src[i]);
+
+ return 0;
+}
+
+int roar_conv_int32_float_deint(float   ** dst, const int32_t * src, size_t len, size_t channels) {
+ register size_t i, c, o;
+
+ ROAR_DBG("roar_conv_int32_float_deint(*) = ?");
+
+ if ( len == 0 )
+  return 0;
+
+ ROAR_DBG("roar_conv_int32_float_deint(*) = ?");
+
+ if ( dst == NULL || src == NULL )
+  return -1;
+
+ ROAR_DBG("roar_conv_int32_float_deint(*) = ?");
+
+ // check if len is a multiple of channels:
+ if ( (len % channels) != 0 )
+  return -1;
+
+ ROAR_DBG("roar_conv_int32_float_deint(*) = ?");
+
+ for (c = 0; c < channels; c++)
+  if ( dst[c] == NULL )
+   return -1;
+
+ ROAR_DBG("roar_conv_int32_float_deint(*) = ?");
+
+ switch (channels) {
+  case  1:
+    return roar_conv_int32_float(dst[0], src, len);
+   break;
+  case  2:
+    for (i = o = 0; i < len; i += 2, o += 1) {
+     dst[0][o] = _si32_to_float(src[i+0]);
+     dst[1][o] = _si32_to_float(src[i+1]);
+    }
+   break;
+  default:
+    for (i = c = o = 0; i < len; i++) {
+     dst[c][o] = _si32_to_float(src[i]);
+     c++;
+     if ( c == channels ) {
+      c = 0;
+      o++;
+     }
+    }
+   break;
+ }
+
+ return 0;
+}
+
+int roar_conv_float_int32_enint(int32_t  * dst, const float   ** src, size_t len, size_t channels) {
+ size_t i, c, o;
+
+ if ( len == 0 )
+  return 0;
+
+ if ( dst == NULL || src == NULL )
+  return -1;
+
+ // check if len is a multiple of channels:
+ if ( (len % channels) != 0 )
+  return -1;
+
+ for (c = 0; c < channels; c++)
+  if ( src[c] == NULL )
+   return -1;
+
+ switch (channels) {
+  default:
+    for (i = c = o = 0; o < len; o++) {
+     dst[o] = _float_to_si32(src[c][i]);
+     c++;
+     if ( c == channels ) {
+      c = 0;
+      i++;
+     }
+    }
+   break;
+ }
+
+ return 0;
+}
 
 //ll
