aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/openal/test/manual/OpenALTest.java18
-rw-r--r--src/test/com/jogamp/openal/test/resources/ResourceLocation.java38
-rw-r--r--src/test/com/jogamp/openal/test/resources/aa.cdbin0 -> 846704 bytes
-rw-r--r--src/test/com/jogamp/openal/test/resources/aa.cdrbin0 -> 846704 bytes
-rw-r--r--src/test/com/jogamp/openal/test/resources/aa.wavbin0 -> 846748 bytes
5 files changed, 50 insertions, 6 deletions
diff --git a/src/test/com/jogamp/openal/test/manual/OpenALTest.java b/src/test/com/jogamp/openal/test/manual/OpenALTest.java
index 1bc8b78..eac1d46 100644
--- a/src/test/com/jogamp/openal/test/manual/OpenALTest.java
+++ b/src/test/com/jogamp/openal/test/manual/OpenALTest.java
@@ -34,6 +34,7 @@ package com.jogamp.openal.test.manual;
* design, construction, operation or maintenance of any nuclear facility.
*/
import java.io.IOException;
+import java.nio.ByteOrder;
import java.nio.IntBuffer;
import com.jogamp.common.nio.Buffers;
@@ -70,8 +71,7 @@ public class OpenALTest {
device = alc.alcOpenDevice(null);
context = alc.alcCreateContext(device, null);
alc.alcMakeContextCurrent(context);
- al = ALFactory.getAL();
-
+ al = ALFactory.getAL();
System.out.println("output devices:");
{
final String[] outDevices = alc.alcGetDeviceSpecifiers();
@@ -98,7 +98,12 @@ public class OpenALTest {
int[] buffers = new int[1];
al.alGenBuffers(1, buffers, 0);
- WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream0(), 1, 8, 22050);
+ // WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream0(), ResourceLocation.getTestStream0Size(), 1, 8, 22050, ByteOrder.LITTLE_ENDIAN, true);
+ // WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream1(), ResourceLocation.getTestStream1Size(), 2, 16, 44100, ByteOrder.BIG_ENDIAN, true);
+ WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream2(), ResourceLocation.getTestStream2Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true);
+ // WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream3(), ResourceLocation.getTestStream3Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true);
+ System.out.println("*** size "+wd.data.limit());
+
al.alBufferData(buffers[0], wd.format, wd.data, wd.size, wd.freq);
sources = new int[1];
@@ -126,6 +131,7 @@ public class OpenALTest {
return;
}
System.out.println("play direct");
+ al.alSourceRewind(sources[0]);
al.alSourcePlay(sources[0]);
}
@@ -134,6 +140,8 @@ public class OpenALTest {
return;
}
System.out.println("play3f "+x+", "+y+", "+z);
+ al.alSourceRewind(sources[0]);
+ al.alSourcePlay(sources[0]);
al.alSource3f(sources[0], AL.AL_POSITION, x, y, z);
}
@@ -150,7 +158,7 @@ public class OpenALTest {
}
if( null != sources ) {
al.alSourceStop(sources[0]);
- al.alDeleteSources(1, sources, 0);
+ al.alDeleteSources(1, sources, 0);
sources = null;
}
if( null != context ) {
@@ -178,7 +186,7 @@ public class OpenALTest {
Thread.sleep(5000);
demo.play3f(0f, 0f, 0f);
- Thread.sleep(10000);
+ Thread.sleep(5000);
demo.dispose();
}
diff --git a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java
index 9b2eb75..ba4ea99 100644
--- a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java
+++ b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java
@@ -10,8 +10,19 @@ import com.jogamp.common.util.IOUtil;
/** just a tag to locate the resources */
public class ResourceLocation {
+ /** WAV 22050Hz, 1 channel, S8_LE */
public static final String lewiscarrol_wav = "lewiscarroll.wav";
-
+ public static final int lewiscarrol_wav_size = 1025476;
+ /** CDR 44100Hz, 2 channels, S16_BE */
+ public static final String aa_cdr = "aa.cdr";
+ public static final int aa_cdr_size = 846704;
+ /** CDR 44100Hz, 2 channels, S16_LE */
+ public static final String aa_cd = "aa.cd";
+ public static final int aa_cd_size = 846704;
+ /** CDR 44100Hz, 2 channels, S16_LE */
+ public static final String aa_wav = "aa.wav";
+ public static final int aa_wav_size = 846748;
+
static final ResourceLocation rl;
static {
@@ -19,9 +30,34 @@ public class ResourceLocation {
}
+ /** WAV 22050Hz, 1 channel, S8_LE */
public static InputStream getTestStream0() {
return getInputStream(lewiscarrol_wav, true);
}
+ public static int getTestStream0Size() {
+ return lewiscarrol_wav_size;
+ }
+ /** CDR 44100Hz, 2 channels, S16_BE */
+ public static InputStream getTestStream1() {
+ return getInputStream(aa_cdr, true);
+ }
+ public static int getTestStream1Size() {
+ return aa_cdr_size;
+ }
+ /** CDR 44100Hz, 2 channels, S16_LE */
+ public static InputStream getTestStream2() {
+ return getInputStream(aa_cd, true);
+ }
+ public static int getTestStream2Size() {
+ return aa_cd_size;
+ }
+ /** WAV 44100Hz, 2 channels, S16_LE */
+ public static InputStream getTestStream3() {
+ return getInputStream(aa_wav, true);
+ }
+ public static int getTestStream3Size() {
+ return aa_wav_size;
+ }
public static InputStream getInputStream(String fileName) {
return getInputStream(fileName, false);
diff --git a/src/test/com/jogamp/openal/test/resources/aa.cd b/src/test/com/jogamp/openal/test/resources/aa.cd
new file mode 100644
index 0000000..497831c
--- /dev/null
+++ b/src/test/com/jogamp/openal/test/resources/aa.cd
Binary files differ
diff --git a/src/test/com/jogamp/openal/test/resources/aa.cdr b/src/test/com/jogamp/openal/test/resources/aa.cdr
new file mode 100644
index 0000000..21e8a53
--- /dev/null
+++ b/src/test/com/jogamp/openal/test/resources/aa.cdr
Binary files differ
diff --git a/src/test/com/jogamp/openal/test/resources/aa.wav b/src/test/com/jogamp/openal/test/resources/aa.wav
new file mode 100644
index 0000000..8d607c2
--- /dev/null
+++ b/src/test/com/jogamp/openal/test/resources/aa.wav
Binary files differ