Skip to content

Commit

Permalink
Improved handling of nan/inf
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Dec 26, 2018
1 parent dd6d4a5 commit 2239dc3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/core/MixHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,23 @@ bool sanitize( sampleFrame * src, int frames )
{
if( isinff( src[f][c] ) || isnanf( src[f][c] ) )
{
src[f][c] = 0.0f;
#ifdef LMMS_DEBUG
printf("Bad data, clearing buffer. frame: ");
printf("%d: value %f\n", f, src[f][c]);
#endif
for( int f = 0; f < frames; ++f )
{
for( int c = 0; c < 2; ++c )
{
src[f][c] = 0.0f;
}
}
found = true;
return found;
}
else
{
src[f][c] = qBound( -4.0f, src[f][c], 4.0f );
src[f][c] = qBound( -100.0f, src[f][c], 100.0f );
}
}
}
Expand Down

0 comments on commit 2239dc3

Please sign in to comment.