From d0506f51c85efdcce1d48f58f95e57d48d22742e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 1 Feb 2013 02:34:39 +0100 Subject: WavData.loadFromStream: Uses IOUtil.copyStream2ByteBuffer which fixes loading on Android; Adding proper byteOrder swapping depending on input format. - Also added a few more test streams - Working Android test activity --- src/java/com/jogamp/openal/util/WAVLoader.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/java/com/jogamp/openal/util/WAVLoader.java') diff --git a/src/java/com/jogamp/openal/util/WAVLoader.java b/src/java/com/jogamp/openal/util/WAVLoader.java index 40ad99e..f997eb4 100644 --- a/src/java/com/jogamp/openal/util/WAVLoader.java +++ b/src/java/com/jogamp/openal/util/WAVLoader.java @@ -37,6 +37,7 @@ package com.jogamp.openal.util; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.ByteOrder; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; @@ -103,7 +104,9 @@ public class WAVLoader { private static WAVData loadFromStreamImpl(AudioInputStream aIn) throws UnsupportedAudioFileException, IOException { final AudioFormat fmt = aIn.getFormat(); - return WAVData.loadFromStream(aIn, fmt.getChannels(), fmt.getSampleSizeInBits(), Math.round(fmt.getSampleRate())); + return WAVData.loadFromStream(aIn, -1, fmt.getChannels(), fmt.getSampleSizeInBits(), + Math.round(fmt.getSampleRate()), + fmt.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN, false); } } -- cgit v1.2.3