changeset 4186:833e5faa5847

Make sample rate conversion work with mono files. (Bugzilla #88)
author William Pitcock <nenolod@atheme.org>
date Sat, 12 Jan 2008 06:39:56 -0600
parents d52fe5ff19a4
children 1e287282889c
files src/audacious/output.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/output.c	Sat Jan 12 06:35:45 2008 -0600
+++ b/src/audacious/output.c	Sat Jan 12 06:39:56 2008 -0600
@@ -437,7 +437,7 @@
 #ifdef USE_SRC
     if(src_state != NULL&&length > 0)
       {
-        int lrLength = length/2;
+        int lrLength = length / nch;
         int overLrLength = (int)floor(lrLength*(src_data.src_ratio+1));
 	if(lengthOfSrcIn < lrLength)
 	  {
@@ -457,8 +457,8 @@
         src_data.data_in = srcIn;
         src_data.data_out = srcOut;
         src_data.end_of_input = 0;
-        src_data.input_frames = lrLength/2;
-        src_data.output_frames = overLrLength/2;
+        src_data.input_frames = lrLength / nch;
+        src_data.output_frames = overLrLength / nch;
         if ((srcError = src_process(src_state, &src_data)) > 0)
           {
             fprintf(stderr, "src_process(): %s\n", src_strerror(srcError));
@@ -467,7 +467,7 @@
           {
             src_float_to_short_array(srcOut, wOut, src_data.output_frames_gen*2);
             ptr = wOut;
-            length = src_data.output_frames_gen*4;
+            length = src_data.output_frames_gen * (nch * 2);
           }
       }
 #endif