Fix audio resampling in some cases.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 10 Jun 2014 19:37:59 -0400
changeset 8856 5da12bedaace
parent 8855 127fb2272098
child 8857 6ec57a81e5d6
Fix audio resampling in some cases. Fixes Bugzilla #2389.
src/audio/sdlgenaudiocvt.pl
--- a/src/audio/sdlgenaudiocvt.pl	Mon Jun 09 17:37:59 2014 +0200
+++ b/src/audio/sdlgenaudiocvt.pl	Tue Jun 10 19:37:59 2014 -0400
@@ -383,6 +383,7 @@
     my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize';
     my $incr = '';
     my $incr2 = '';
+    my $block_align = $channels * $fsize/8;
 
 
     # !!! FIXME: DEBUG_CONVERT should report frequencies.
@@ -395,7 +396,7 @@
 #endif
 
     const int srcsize = cvt->len_cvt - $fudge;
-    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
+    const int dstsize = (int) (((double)(cvt->len_cvt/${block_align})) * cvt->rate_incr) * ${block_align};
     register int eps = 0;
 EOF