aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/openal/util/WAVLoader.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-03-26 22:47:51 +0100
committerGitHub <[email protected]>2019-03-26 22:47:51 +0100
commit5a66f7f505fab5526f1b8d3b8ccfa24bb5a5ceee (patch)
tree6d0c0a06798eefc7287432d2e42e78f989cafc28 /src/java/com/jogamp/openal/util/WAVLoader.java
parent03e964cc9fecc6ec96d9c21ee3a478d74869a2ae (diff)
parent52ae4377ddc9676fda5eb8f9ac5d93b0521e8aba (diff)
Merge pull request #15 from mattharris/bug_1280
Proposed fix for bug_1280
Diffstat (limited to 'src/java/com/jogamp/openal/util/WAVLoader.java')
-rw-r--r--src/java/com/jogamp/openal/util/WAVLoader.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java/com/jogamp/openal/util/WAVLoader.java b/src/java/com/jogamp/openal/util/WAVLoader.java
index ef8d12a..48ff62a 100644
--- a/src/java/com/jogamp/openal/util/WAVLoader.java
+++ b/src/java/com/jogamp/openal/util/WAVLoader.java
@@ -123,6 +123,7 @@ public class WAVLoader {
short sChannels = 0, sSampleSizeInBits = 0;
long sampleRate = 0;
long chunkLength = 0;
+ int dataLength = 0;
while (!foundData) {
final int chunkId = (int)bs.readUInt32(true /* bigEndian */);
@@ -150,6 +151,7 @@ public class WAVLoader {
throw new ALException("WAV fmt chunks must be before data chunks: "+bs);
}
foundData = true;
+ dataLength = Bitstream.uint32LongToInt(chunkLength);
break;
default:
// unrecognized chunk, skips it
@@ -160,8 +162,8 @@ public class WAVLoader {
final int channels = sChannels;
final int sampleSizeInBits = sSampleSizeInBits;
final float fSampleRate = sampleRate;
- return WAVData.loadFromStream(bs.getSubStream(), riffLenI, channels, sampleSizeInBits,
- Math.round(fSampleRate), bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN, false);
+ return WAVData.loadFromStream(bs.getSubStream(), dataLength, channels, sampleSizeInBits,
+ Math.round(fSampleRate), bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN, false, dataLength);
} finally {
bs.close();
}