tuning with other songs

This commit is contained in:
2017-07-14 14:37:25 -05:00
parent afd2d1aa41
commit d65b94cd49
5 changed files with 41 additions and 41 deletions

View File

@@ -4,6 +4,7 @@ import java.io.DataInputStream;
import java.io.IOException;
import java.security.InvalidParameterException;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
public class WavDecoder {
@@ -56,10 +57,14 @@ public class WavDecoder {
String moreInfo = readBytesToString(4);
if (moreInfo.equals("LIST")) { // 4
readStream.skip(30);
if (!readBytesToString(4).equals("data")) {
throw new InvalidParameterException("failed to read data with extra info.");
while (true) {
if (readBytesToString(1).equals("d")) {
if (readBytesToString(3).equals("ata")) {
break;
}
}
}
} else if (!moreInfo.equals("data")) {
throw new InvalidParameterException("failed to read data.");
}
@@ -132,7 +137,7 @@ public class WavDecoder {
for (int channel = 0; channel < getChannels(); channel++) {
currentSample += readLittleEndianShort();
}
currentSample /= getChannels()*Short.MAX_VALUE+1;
currentSample /= getChannels() * Short.MAX_VALUE+1;
samples[i] = currentSample;
samplesRead++;
} catch (IOException e) {