src/audio/sdlgenaudiocvt.pl
changeset 3602 bfa8d34ce03a
parent 3032 77c3e67f0740
child 4889 8c9cbb623d55
     1.1 --- a/src/audio/sdlgenaudiocvt.pl	Thu Dec 24 21:00:42 2009 +0000
     1.2 +++ b/src/audio/sdlgenaudiocvt.pl	Mon Dec 28 08:28:24 2009 +0000
     1.3 @@ -537,15 +537,19 @@
     1.4      const int dstsize = cvt->len_cvt $lencvtop $multiple;
     1.5  EOF
     1.6  
     1.7 +    my $endcomparison = '!=';
     1.8 +
     1.9      # Upsampling (growing the buffer) needs to work backwards, since we
    1.10      #  overwrite the buffer as we go.
    1.11      if ($upsample) {
    1.12 +        $endcomparison = '>';  # dst > target
    1.13          print <<EOF;
    1.14      $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
    1.15      const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
    1.16      const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
    1.17  EOF
    1.18      } else {
    1.19 +        $endcomparison = '<';  # dst < target
    1.20          print <<EOF;
    1.21      $fctype *dst = ($fctype *) cvt->buf;
    1.22      const $fctype *src = ($fctype *) cvt->buf;
    1.23 @@ -562,7 +566,7 @@
    1.24      }
    1.25  
    1.26      print <<EOF;
    1.27 -    while (dst != target) {
    1.28 +    while (dst $endcomparison target) {
    1.29  EOF
    1.30  
    1.31      for (my $i = 0; $i < $channels; $i++) {