Fix audio resampling in some cases.
authorRyan C. Gordon
Tue, 10 Jun 2014 19:37:59 -0400
changeset 88565da12bedaace
parent 8855 127fb2272098
child 8857 6ec57a81e5d6
Fix audio resampling in some cases.

Fixes Bugzilla #2389.
src/audio/sdlgenaudiocvt.pl
     1.1 --- a/src/audio/sdlgenaudiocvt.pl	Mon Jun 09 17:37:59 2014 +0200
     1.2 +++ b/src/audio/sdlgenaudiocvt.pl	Tue Jun 10 19:37:59 2014 -0400
     1.3 @@ -383,6 +383,7 @@
     1.4      my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize';
     1.5      my $incr = '';
     1.6      my $incr2 = '';
     1.7 +    my $block_align = $channels * $fsize/8;
     1.8  
     1.9  
    1.10      # !!! FIXME: DEBUG_CONVERT should report frequencies.
    1.11 @@ -395,7 +396,7 @@
    1.12  #endif
    1.13  
    1.14      const int srcsize = cvt->len_cvt - $fudge;
    1.15 -    const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr);
    1.16 +    const int dstsize = (int) (((double)(cvt->len_cvt/${block_align})) * cvt->rate_incr) * ${block_align};
    1.17      register int eps = 0;
    1.18  EOF
    1.19