Skip to content

Commit

Permalink
Initialize unused instruments.
Browse files Browse the repository at this point in the history
  • Loading branch information
martincameron committed Mar 10, 2022
1 parent 1c07b27 commit f45d937
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ModPlay3.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public ModPlay3( java.io.InputStream moduleData, boolean soundtracker ) throws j
sampleLoopStart[ idx ] = loopStart * FIXED_POINT_ONE;
sampleLoopLength[ idx ] = loopLength * FIXED_POINT_ONE;
}
for( int idx = numSamples; idx < MAX_SAMPLES; idx++ )
{
instrumentNames[ idx ] = "";
sampleVolume[ idx ] = 64;
sampleData[ idx ] = new byte[ 0 ];
}
songLength = moduleData.read() & 0x7F;
if( songLength < 1 )
{
Expand Down Expand Up @@ -192,7 +198,6 @@ else if( effect == 2 )
patternData[ idx + 2 ] = ( byte ) effect;
patternData[ idx + 3 ] = ( byte ) ( ( param1 << 4 ) | ( param2 & 0xF ) );
}

for( int idx = 1; idx < numSamples; idx++ )
{
sampleData[ idx ] = readBytes( moduleData, sampleLengths[ idx ] );
Expand Down

0 comments on commit f45d937

Please sign in to comment.