tuning with other songs
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user