diff --git a/ModPlay3.java b/ModPlay3.java index e43084e..100fd00 100644 --- a/ModPlay3.java +++ b/ModPlay3.java @@ -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 ) { @@ -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 ] );