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 {
/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */
/*
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
modify it under the terms of the GNU Lesser General Public
......@@ -400,15 +400,19 @@ ${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
register int eps = 0;
EOF
my $endcomparison = '!=';
# Upsampling (growing the buffer) needs to work backwards, since we
# overwrite the buffer as we go.
if ($upsample) {
$endcomparison = '>'; # dst > target
print <<EOF;
$fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
EOF
} else {
$endcomparison = '<'; # dst < target
print <<EOF;
$fctype *dst = ($fctype *) cvt->buf;
const $fctype *src = ($fctype *) cvt->buf;
......@@ -432,7 +436,7 @@ EOF
}
print <<EOF;
while (dst != target) {
while (dst $endcomparison target) {
EOF
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