Update of /cvsroot/jake2/jake2/src/jake2/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30792/src/jake2/sound
Modified Files:
WaveLoader.java
Log Message:
use native order sample format
Index: WaveLoader.java
===================================================================
RCS file: /cvsroot/jake2/jake2/src/jake2/sound/WaveLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** WaveLoader.java 29 Oct 2004 16:38:36 -0000 1.2
--- WaveLoader.java 3 Nov 2004 20:15:02 -0000 1.3
***************
*** 29,36 ****
import jake2.qcommon.Com;
import jake2.qcommon.FS;
- import jake2.sys.Sys;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.sound.sampled.*;
--- 29,36 ----
import jake2.qcommon.Com;
import jake2.qcommon.FS;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+ import java.nio.ByteOrder;
import javax.sound.sampled.*;
***************
*** 41,45 ****
public class WaveLoader {
! private static final AudioFormat sampleFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 22050, 16, 1, 2, 22050, false);
/*
--- 41,53 ----
public class WaveLoader {
! private static AudioFormat sampleFormat;
! static {
! if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
! sampleFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 22050, 16, 1, 2, 22050, false);
! } else {
! sampleFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 22050, 16, 1, 2, 22050, true);
! }
!
! }
/*
|