aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorathomas <[email protected]>2003-11-19 00:30:26 +0000
committerathomas <[email protected]>2003-11-19 00:30:26 +0000
commite8d650a5cb1e3d80c266271d87788670718b895f (patch)
tree031cca1a335b7529087fcd739d761e322b27d1a3
parent2b098f572821a7a4437c1243f73be1c2815c0cc8 (diff)
Removed a redundant call to alcOpenDevice, Eliminated a call to ReleaseStringUTFChars in the event that null is passed in and added some instrumentation printouts to try to figure out what's causing this crash on people's systems (and not mine!)
git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@60 03bf7f67-59de-4072-a415-9a990d468a3f
-rw-r--r--src/java/net/java/games/joal/ALCImpl.java3
-rw-r--r--src/java/net/java/games/joal/util/ALut.java5
-rw-r--r--src/native/alcbind.c22
3 files changed, 24 insertions, 6 deletions
diff --git a/src/java/net/java/games/joal/ALCImpl.java b/src/java/net/java/games/joal/ALCImpl.java
index 3edfd7e..a2ce1e8 100644
--- a/src/java/net/java/games/joal/ALCImpl.java
+++ b/src/java/net/java/games/joal/ALCImpl.java
@@ -53,7 +53,8 @@ final class ALCImpl implements ALC {
Device result = null;
int pointer = openDeviceNative(deviceName);
if(pointer != 0) {
- result = new Device(openDeviceNative(deviceName));
+ System.out.println("Device Pointer = " + pointer);
+ result = new Device(pointer);
}
return result;
}
diff --git a/src/java/net/java/games/joal/util/ALut.java b/src/java/net/java/games/joal/util/ALut.java
index 7f0772f..5bb13f9 100644
--- a/src/java/net/java/games/joal/util/ALut.java
+++ b/src/java/net/java/games/joal/util/ALut.java
@@ -55,6 +55,7 @@ public final class ALut {
private ALut() { }
public static void alutInit() {
+ System.out.println("Entering alutInit()");
ALFactory.initialize();
alc = ALFactory.getALC();
String deviceName = null;
@@ -67,8 +68,9 @@ public final class ALut {
*/
ALC.Context context;
ALC.Device device;
-
+ System.out.println("In alutInit(): Device Name = " + deviceName);
device = alc.alcOpenDevice(deviceName);
+ System.out.println("In alutInit(): Device = " + device);
context = alc.alcCreateContext(device, null);
alc.alcMakeContextCurrent(context);
/*
@@ -82,6 +84,7 @@ public final class ALut {
+ "for the inconvenience.");
}
*/
+ System.out.println("Exiting alutInit()");
}
public static void alutLoadWAVFile(
diff --git a/src/native/alcbind.c b/src/native/alcbind.c
index d35f292..c598b04 100644
--- a/src/native/alcbind.c
+++ b/src/native/alcbind.c
@@ -43,15 +43,29 @@ JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_alcGetErrorNative
JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative
(JNIEnv *env, jobject obj, jstring deviceName) {
+ printf("Entering openDeviceNative()\n");
+ printf("In openDeviceNative() test 1\n");
jint result;
- ALubyte *str = NULL;
+ ALubyte *str;
+ ALCdevice *device;
if(deviceName != NULL) {
str = (ALubyte*)(*env)->GetStringUTFChars(env,deviceName,NULL);
+ device = alcOpenDevice(str);
+ printf("In openDeviceNative() test 2a -- %s - %i\n", str, (jint)device);
+ } else {
+ device = alcOpenDevice(NULL);
+ printf("In openDeviceNative() test 2b -- NULL - %i\n", (jint)device);
+ }
+ printf("In openDeviceNative() test 3\n");
+ if(deviceName != NULL) {
+ (*env)->ReleaseStringUTFChars(env,deviceName,str);
+ printf("In openDeviceNative() test 4a\n");
+ } else {
+ printf("In openDeviceNative() test 4b\n");
}
- ALCdevice *device;
- device = alcOpenDevice(str);
- (*env)->ReleaseStringUTFChars(env,deviceName,str);
result = (jint)device;
+ printf("In openDeviceNative() test 5\n");
+ printf("Exiting openDeviceNative()\n");
return result;
}