36 sub outputHeader { |
36 sub outputHeader { |
37 print <<EOF; |
37 print <<EOF; |
38 /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ |
38 /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ |
39 /* |
39 /* |
40 SDL - Simple DirectMedia Layer |
40 SDL - Simple DirectMedia Layer |
41 Copyright (C) 1997-2009 Sam Lantinga |
41 Copyright (C) 1997-2010 Sam Lantinga |
42 |
42 |
43 This library is free software; you can redistribute it and/or |
43 This library is free software; you can redistribute it and/or |
44 modify it under the terms of the GNU Lesser General Public |
44 modify it under the terms of the GNU Lesser General Public |
45 License as published by the Free Software Foundation; either |
45 License as published by the Free Software Foundation; either |
46 version 2.1 of the License, or (at your option) any later version. |
46 version 2.1 of the License, or (at your option) any later version. |
398 const int srcsize = cvt->len_cvt - $fudge; |
398 const int srcsize = cvt->len_cvt - $fudge; |
399 const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); |
399 const int dstsize = (int) (((double)cvt->len_cvt) * cvt->rate_incr); |
400 register int eps = 0; |
400 register int eps = 0; |
401 EOF |
401 EOF |
402 |
402 |
|
403 my $endcomparison = '!='; |
|
404 |
403 # Upsampling (growing the buffer) needs to work backwards, since we |
405 # Upsampling (growing the buffer) needs to work backwards, since we |
404 # overwrite the buffer as we go. |
406 # overwrite the buffer as we go. |
405 if ($upsample) { |
407 if ($upsample) { |
|
408 $endcomparison = '>'; # dst > target |
406 print <<EOF; |
409 print <<EOF; |
407 $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels; |
410 $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels; |
408 const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; |
411 const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; |
409 const $fctype *target = ((const $fctype *) cvt->buf) - $channels; |
412 const $fctype *target = ((const $fctype *) cvt->buf) - $channels; |
410 EOF |
413 EOF |
411 } else { |
414 } else { |
|
415 $endcomparison = '<'; # dst < target |
412 print <<EOF; |
416 print <<EOF; |
413 $fctype *dst = ($fctype *) cvt->buf; |
417 $fctype *dst = ($fctype *) cvt->buf; |
414 const $fctype *src = ($fctype *) cvt->buf; |
418 const $fctype *src = ($fctype *) cvt->buf; |
415 const $fctype *target = (const $fctype *) (cvt->buf + dstsize); |
419 const $fctype *target = (const $fctype *) (cvt->buf + dstsize); |
416 EOF |
420 EOF |