Commit 7fcd8b75 authored by Sam Lantinga's avatar Sam Lantinga

Fixed crashing loading 48KHz audio, contributed by Terry Welsh

parent 200c3c74
This diff is collapsed.
...@@ -38,7 +38,7 @@ sub outputHeader { ...@@ -38,7 +38,7 @@ sub outputHeader {
/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
...@@ -400,15 +400,19 @@ ${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format) ...@@ -400,15 +400,19 @@ ${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
register int eps = 0; register int eps = 0;
EOF EOF
my $endcomparison = '!=';
# Upsampling (growing the buffer) needs to work backwards, since we # Upsampling (growing the buffer) needs to work backwards, since we
# overwrite the buffer as we go. # overwrite the buffer as we go.
if ($upsample) { if ($upsample) {
$endcomparison = '>'; # dst > target
print <<EOF; print <<EOF;
$fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels; $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
const $fctype *target = ((const $fctype *) cvt->buf) - $channels; const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
EOF EOF
} else { } else {
$endcomparison = '<'; # dst < target
print <<EOF; print <<EOF;
$fctype *dst = ($fctype *) cvt->buf; $fctype *dst = ($fctype *) cvt->buf;
const $fctype *src = ($fctype *) cvt->buf; const $fctype *src = ($fctype *) cvt->buf;
...@@ -432,7 +436,7 @@ EOF ...@@ -432,7 +436,7 @@ EOF
} }
print <<EOF; print <<EOF;
while (dst != target) { while (dst $endcomparison target) {
EOF EOF
if ($upsample) { if ($upsample) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment