Index: include/libroardsp/convert.h
===================================================================
--- include/libroardsp/convert.h	(revision 850)
+++ include/libroardsp/convert.h	(revision 852)
@@ -56,13 +56,13 @@
 int roar_conv_chans (void * out, void * in, int samples, int from, int to, int bits);
 
-                                                                           // implmented?
-int roar_conv_chans_1ton8  (void * out, void * in, int samples, int to);   // yes
-int roar_conv_chans_1ton16 (void * out, void * in, int samples, int to);   // yes
-int roar_conv_chans_1to28  (void * out, void * in, int samples);           // yes
-int roar_conv_chans_1to216 (void * out, void * in, int samples);           // yes
-int roar_conv_chans_nto18  (void * out, void * in, int samples, int from); // yes
-int roar_conv_chans_nto116 (void * out, void * in, int samples, int from); // yes
-int roar_conv_chans_2to18  (void * out, void * in, int samples);           // yes
-int roar_conv_chans_2to116 (void * out, void * in, int samples);           // yes
+                                                                           // implmented?  working
+int roar_conv_chans_1ton8  (void * out, void * in, int samples, int to);   // yes          ?
+int roar_conv_chans_1ton16 (void * out, void * in, int samples, int to);   // yes          yes
+int roar_conv_chans_1to28  (void * out, void * in, int samples);           // yes          yes
+int roar_conv_chans_1to216 (void * out, void * in, int samples);           // yes          yes
+int roar_conv_chans_nto18  (void * out, void * in, int samples, int from); // yes          ?
+int roar_conv_chans_nto116 (void * out, void * in, int samples, int from); // yes          ?
+int roar_conv_chans_2to18  (void * out, void * in, int samples);           // yes          yes
+int roar_conv_chans_2to116 (void * out, void * in, int samples);           // yes          yes
 
 int roar_conv_rate    (void * out, void * in, int samples, int from, int to, int bits, int channels);
Index: libroardsp/convert.c
===================================================================
--- libroardsp/convert.c	(revision 850)
+++ libroardsp/convert.c	(revision 852)
@@ -203,11 +203,11 @@
 int roar_conv_chans_1to28  (void * out, void * in, int samples) {
  char * ip = (char*) in, * op = (char*) out;
- int i;
-
- samples = (samples - 1) * 2;
-
- for (i = samples; i >= 0; i -= 2) {
-  op[i + 0] = ip[i];
-  op[i + 1] = ip[i];
+ int i, h;
+
+ samples--;
+
+ for (i = (h = samples) * 2; i >= 0; i -= 2, h--) {
+  op[i + 0] = ip[h];
+  op[i + 1] = ip[h];
  }
 
@@ -229,11 +229,11 @@
 int roar_conv_chans_1to216 (void * out, void * in, int samples) {
  int16_t * ip = (int16_t*) in, * op = (int16_t*) out;
- int i;
-
- samples = (samples - 1) * 2;
-
- for (i = samples; i >= 0; i -= 2) {
-  op[i + 0] = ip[i];
-  op[i + 1] = ip[i];
+ int i, h;
+
+ samples--;
+
+ for (i = (h = samples) * 2; i >= 0; i -= 2, h--) {
+  op[i + 0] = ip[h];
+  op[i + 1] = ip[h];
  }
 
@@ -264,10 +264,10 @@
 int roar_conv_chans_2to18  (void * out, void * in, int samples) {
  int8_t * ip = (int8_t*) in, * op = (int8_t*) out;
- int i;
+ int i, h;
 
  samples -= 2;
 
- for (i = samples; i >= 0; i -= 2)
-  op[i] = ((int)ip[i + 0] + (int)ip[i + 1]) / 2;
+ for (h = (i = samples) / 2; i >= 0; i -= 2, h--)
+  op[h] = ((int)ip[i + 0] + (int)ip[i + 1]) / 2;
 
  return 0;
@@ -297,10 +297,10 @@
 int roar_conv_chans_2to116  (void * out, void * in, int samples) {
  int16_t * ip = (int16_t*) in, * op = (int16_t*) out;
- int i;
+ int i, h;
 
  samples -= 2;
 
- for (i = samples; i >= 0; i -= 2)
-  op[i] = ((int)ip[i + 0] + (int)ip[i + 1]) / 2;
+ for (h = (i = samples) / 2; i >= 0; i -= 2, h--)
+  op[h] = ((int)ip[i + 0] + (int)ip[i + 1]) / 2;
 
  return 0;
@@ -341,5 +341,5 @@
   if ( ins && !outs ) {
    switch (bits) {
-    case  8: roar_conv_codec_s2u8( out, in, samples);  break;
+    case  8: roar_conv_codec_s2u8( out, in, samples); break;
     case 16: roar_conv_codec_s2u16(out, in, samples); break;
     case 32: roar_conv_codec_s2u32(out, in, samples); break;
@@ -350,5 +350,5 @@
   } else if ( !ins && outs ) {
    switch (bits) {
-    case  8: roar_conv_codec_u2s8( out, in, samples);  break;
+    case  8: roar_conv_codec_u2s8( out, in, samples); break;
     case 16: roar_conv_codec_u2s16(out, in, samples); break;
     case 32: roar_conv_codec_u2s32(out, in, samples); break;
@@ -445,4 +445,11 @@
  }
 
+ if ( from->codec != to->codec ) {
+  if ( raor_conv_codec (out, ip, samples, from->codec, to->codec, to->bits) == -1 )
+   return -1;
+  else
+   ip = out;
+ }
+
  if ( from->rate != to->rate ) {
   if ( roar_conv_rate(out, ip, samples, from->rate, to->rate, to->bits, from->channels) == -1 )
@@ -454,11 +461,4 @@
  if ( from->channels != to->channels ) {
   if ( roar_conv_chans(out, ip, samples, from->channels, to->channels, to->bits) == -1 )
-   return -1;
-  else
-   ip = out;
- }
-
- if ( from->codec != to->codec ) {
-  if ( raor_conv_codec (out, ip, samples, from->codec, to->codec, to->bits) == -1 )
    return -1;
   else
