diff options
author | Holger Zickner <[email protected]> | 2004-11-03 20:15:02 +0000 |
---|---|---|
committer | Holger Zickner <[email protected]> | 2004-11-03 20:15:02 +0000 |
commit | fd7c569aa7e2390b30ce69855122b73b4426380e (patch) | |
tree | dddc33b209f79a37a4d7ee0f34074dca395227b1 | |
parent | 43d091b2a919d8b6192a97fcdfb9bcf630d3ca78 (diff) |
use native order sample format
-rw-r--r-- | src/jake2/sound/WaveLoader.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/jake2/sound/WaveLoader.java b/src/jake2/sound/WaveLoader.java index 7f77168..a5aad55 100644 --- a/src/jake2/sound/WaveLoader.java +++ b/src/jake2/sound/WaveLoader.java @@ -2,7 +2,7 @@ * SND_MEM.java * Copyright (C) 2004 * - * $Id: WaveLoader.java,v 1.2 2004-10-29 16:38:36 cawe Exp $ + * $Id: WaveLoader.java,v 1.3 2004-11-03 20:15:02 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,10 +28,10 @@ package jake2.sound; import jake2.Defines; import jake2.qcommon.Com; import jake2.qcommon.FS; -import jake2.sys.Sys; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.nio.ByteOrder; import javax.sound.sampled.*; @@ -40,7 +40,15 @@ import javax.sound.sampled.*; */ public class WaveLoader { - private static final AudioFormat sampleFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 22050, 16, 1, 2, 22050, false); + 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); + } + + } /* ============== |