Skip to content

Commit

Permalink
fix invalid loops in WAV loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Mukunda Johnson committed Dec 14, 2008
1 parent 7ae2a01 commit 82af2fc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,21 @@ int Load_WAV( Sample* samp, bool verbose, bool fix )
samp->loop_start = read32();
samp->loop_end = read32();

// clip loop start against sample length
if( samp->loop_end > samp->sample_length ) {
samp->loop_end = samp->sample_length;
}

// disable tiny loop
// catch invalid loop
if( (samp->loop_start > samp->sample_length) ||
(samp->loop_end - samp->loop_start < 16) ) {

samp->loop_type = 0;
samp->loop_start = 0;
samp->loop_end = 0;
}

// ignore fractional
// ignore play count
pos += 8;
Expand Down

0 comments on commit 82af2fc

Please sign in to comment.