summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/build.xml2
-rw-r--r--src/java/net/java/games/joal/ALC.java2
-rw-r--r--src/java/net/java/games/joal/ALCImpl.java38
-rw-r--r--src/java/net/java/games/joal/ALFactory.java8
-rw-r--r--src/java/net/java/games/joal/OpenALException.java50
-rw-r--r--src/java/net/java/games/joal/util/ALut.java5
-rw-r--r--src/java/net/java/games/sound3d/AudioSystem3D.java13
-rw-r--r--src/java/net/java/games/sound3d/Sound3DException.java50
8 files changed, 142 insertions, 26 deletions
diff --git a/src/java/build.xml b/src/java/build.xml
index 9e6eca7..44a11ae 100644
--- a/src/java/build.xml
+++ b/src/java/build.xml
@@ -40,7 +40,7 @@
</target>
<target name="compile" depends="init">
- <javac srcdir="." destdir="../../classes" optimize="${optimize}"/>
+ <javac srcdir="." destdir="../../classes" debug="${debug}" optimize="${optimize}"/>
</target>
<target name="all" depends="init,compile">
diff --git a/src/java/net/java/games/joal/ALC.java b/src/java/net/java/games/joal/ALC.java
index 36dfee1..f8855c6 100644
--- a/src/java/net/java/games/joal/ALC.java
+++ b/src/java/net/java/games/joal/ALC.java
@@ -254,6 +254,8 @@ public interface ALC extends ALCConstants {
final int pointer;
Context(ALC impl, int pointer) {
+ System.out.println("Pointer = " + pointer);
+ System.out.println("ALC = " + impl);
this.pointer = pointer;
this.alcContext = impl;
}
diff --git a/src/java/net/java/games/joal/ALCImpl.java b/src/java/net/java/games/joal/ALCImpl.java
index cca3959..38a1b6e 100644
--- a/src/java/net/java/games/joal/ALCImpl.java
+++ b/src/java/net/java/games/joal/ALCImpl.java
@@ -48,20 +48,17 @@ final class ALCImpl implements ALC {
}));
}
-
- public Device alcOpenDevice(String deviceName) {
- System.out.println("Entering alcOpenDevice()");
- Device result = null;
- int pointer = openDeviceNative(deviceName);
- if(pointer != 0) {
- System.out.println("In alcOpenDevice: Device Pointer = " + pointer);
- result = new Device(pointer);
- }
- System.out.println("Exiting alcOpenDevice()");
- return result;
- }
-
+
+ public Device alcOpenDevice(String deviceName) {
+ System.out.println("Entering alcOpenDevice2()");
+ Device result = openDeviceNative(deviceName);
+ System.out.println("Exiting alcOpenDevice2()");
+ return result;
+ }
+ /*
private native int openDeviceNative(String deviceName);
+*/
+ private native Device openDeviceNative(String deviceName);
public void alcCloseDevice(Device device) {
if(device != null) {
@@ -70,7 +67,7 @@ final class ALCImpl implements ALC {
}
private native void closeDeviceNative(int pointer);
-
+/*
public Context alcCreateContext(Device device, int[] attrs) {
Context result = null;
if(device != null) {
@@ -82,8 +79,19 @@ final class ALCImpl implements ALC {
}
return result;
}
-
+*/
+/*
private native int createContextNative(int pointer, int[] attrs);
+*/
+ public Context alcCreateContext(Device device, int[] attrs) {
+ Context result = null;
+ if(device != null) {
+ result = createContextNative(device.pointer, attrs);
+ contextMap.put(new Integer(result.pointer), result);
+ }
+ return result;
+ }
+ private native Context createContextNative(int pointer, int[] attrs);
public int alcMakeContextCurrent(Context context) {
int result = 0;
diff --git a/src/java/net/java/games/joal/ALFactory.java b/src/java/net/java/games/joal/ALFactory.java
index 8d364e4..80d1cdb 100644
--- a/src/java/net/java/games/joal/ALFactory.java
+++ b/src/java/net/java/games/joal/ALFactory.java
@@ -55,7 +55,7 @@ public class ALFactory {
* @return true is OpenAL was able to initialize,
* false if OpenAL was not able to intialize
*/
- public static boolean initialize() {
+ public static boolean initialize() throws OpenALException {
String osProperty = System.getProperty("os.name");
if(osProperty.startsWith("Win")) {
isInitialized = init(new String[] { "OpenAL32.dll" });
@@ -67,7 +67,7 @@ public class ALFactory {
return isInitialized;
}
- private static native boolean init(String[] oalPaths);
+ private static native boolean init(String[] oalPaths) throws OpenALException;
/**
* Deinitialize the OpenAL environment
@@ -83,7 +83,7 @@ public class ALFactory {
*
* @return the AL object
*/
- public static AL getAL() {
+ public static AL getAL() throws OpenALException {
if(!isInitialized) {
initialize();
}
@@ -99,7 +99,7 @@ public class ALFactory {
*
* @return the ALC object
*/
- public static ALC getALC() {
+ public static ALC getALC() throws OpenALException{
if(!isInitialized) {
initialize();
}
diff --git a/src/java/net/java/games/joal/OpenALException.java b/src/java/net/java/games/joal/OpenALException.java
new file mode 100644
index 0000000..f8a7732
--- /dev/null
+++ b/src/java/net/java/games/joal/OpenALException.java
@@ -0,0 +1,50 @@
+/*
+ * Created on Nov 22, 2003
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package net.java.games.joal;
+
+/**
+ * @author athomas
+ *
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public class OpenALException extends Exception {
+
+ /**
+ *
+ */
+ public OpenALException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public OpenALException(String arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public OpenALException(Throwable arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public OpenALException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/java/net/java/games/joal/util/ALut.java b/src/java/net/java/games/joal/util/ALut.java
index 62b04c8..cd89e0c 100644
--- a/src/java/net/java/games/joal/util/ALut.java
+++ b/src/java/net/java/games/joal/util/ALut.java
@@ -43,6 +43,7 @@ import javax.sound.sampled.UnsupportedAudioFileException;
import net.java.games.joal.AL;
import net.java.games.joal.ALC;
import net.java.games.joal.ALFactory;
+import net.java.games.joal.OpenALException;
/**
* @author Athomas Goldberg
@@ -54,13 +55,13 @@ public final class ALut {
private ALut() { }
- public static void alutInit() {
+ public static void alutInit() throws OpenALException {
System.out.println("Go TEAM!");
System.out.println("Entering alutInit()");
ALFactory.initialize();
alc = ALFactory.getALC();
//String deviceName = null;
- String deviceName = "MMSYSTEM";
+ String deviceName = null;
/*
String os = System.getProperty("os.name");
if (os.startsWith("Windows")) {
diff --git a/src/java/net/java/games/sound3d/AudioSystem3D.java b/src/java/net/java/games/sound3d/AudioSystem3D.java
index b356b6b..8dc4ba3 100644
--- a/src/java/net/java/games/sound3d/AudioSystem3D.java
+++ b/src/java/net/java/games/sound3d/AudioSystem3D.java
@@ -36,6 +36,7 @@ package net.java.games.sound3d;
import net.java.games.joal.AL;
import net.java.games.joal.ALC;
import net.java.games.joal.ALFactory;
+import net.java.games.joal.OpenALException;
import net.java.games.joal.util.WAVData;
import net.java.games.joal.util.WAVLoader;
@@ -59,10 +60,14 @@ public class AudioSystem3D {
* Iniitalize the Sound3D environment. This must be called before
* other methods in the class can be used.
*/
- public static void init() {
- ALFactory.initialize();
- al = ALFactory.getAL();
- alc = ALFactory.getALC();
+ public static void init() throws Sound3DException {
+ try {
+ ALFactory.initialize();
+ al = ALFactory.getAL();
+ alc = ALFactory.getALC();
+ } catch (OpenALException e) {
+ throw new Sound3DException("Could not initialize AudioSystem3D: ",e);
+ }
}
/**
diff --git a/src/java/net/java/games/sound3d/Sound3DException.java b/src/java/net/java/games/sound3d/Sound3DException.java
new file mode 100644
index 0000000..6b927ca
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Sound3DException.java
@@ -0,0 +1,50 @@
+/*
+ * Created on Nov 22, 2003
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+package net.java.games.sound3d;
+
+/**
+ * @author athomas
+ *
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public class Sound3DException extends Exception {
+
+ /**
+ *
+ */
+ public Sound3DException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public Sound3DException(String arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public Sound3DException(Throwable arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public Sound3DException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ // TODO Auto-generated constructor stub
+ }
+
+}