JOAL not working in windows

Hello. So I am trying to initialize the SoundEngine3D object. I am able to do this succesfully with the Linux version (release version 1.1.0). The code snip below is what I use to do this.


        AudioSystem3D.init();
        // is the input here right?
        dev = AudioSystem3D.openDevice(null);
        ctx = AudioSystem3D.createContext(dev);
        AudioSystem3D.makeContextCurrent(ctx);

The above code works fine under Linux; however, for Windows XP, I get the following exception.


Exception in thread "main" java.lang.RuntimeException: 
Can not get proc address for method "alcCaptureCloseDevice": 
Coldn't set value of field "_addressof_alcCaptureCloseDevice" in class net.java.games.joal.imp.ALCProcAddressTable

Note, for windows I include joal.jar and gluegen-rt.jar in my classpath.
I also include the gluegen-rt.dll and joal_native.dll in the Library path.

Anyone have any hints to what I might need to do extra in windows?

Thanks

Well I can’t replicate the issue on my machine. Your setup of JOAL on Windows seems fine to me.

Do you know at which line in that code it throws this error? Also, is there more code than just those e lines you’ve given? (I find the error a bit strange, because none of source code in the Sound3D package uses the alcCaptureCloseDevice method of OpenAL)

Alrighty, here is the test class. Below it is the output of the exception.

Thanks for your help!!!


package test;

import net.java.games.joal.*;
import net.java.games.sound3d.*;

public class JOALDemo{
    public static void main(String[] args){
        AudioSystem3D.init();
        Device dev = AudioSystem3D.openDevice(null);
        Context ctx = AudioSystem3D.createContext(dev);
        AudioSystem3D.makeContextCurrent(ctx);

        AudioSystem3D.getListener().setPosition(0,0,0);

        ctx.destroy();
        dev.close();
    }
}


java -cp build_test;lib\sound\gluegen-rt.jar;lib\sound\joal.jar -Djava.library.path=lib\native\win test.JOALDemo 
 
Exception in thread "main" java.lang.RuntimeException: Can not get proc address for method "alcCaptureCloseDevice": Couldn't set value of fie
ld "_addressof_alcC
aptureCloseDevice" in class net.java.games.joal.impl.ALCProcAddressTable
        at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:68)
        at net.java.games.joal.impl.ALProcAddressLookup.resetALCProcAddressTable(ALProcAddressLookup.java:100)
        at net.java.games.joal.impl.ALCImpl.alcOpenDevice(ALCImpl.java:342)
        at net.java.games.sound3d.AudioSystem3D.openDevice(AudioSystem3D.java:105)
        at test.JOALDemo.main(Unknown Source)
Caused by: java.lang.RuntimeException: Unable to find and load OpenAL library
        at net.java.games.joal.impl.ALProcAddressLookup$DynamicLookup.dynamicLookupFunction(ALProcAddressLookup.java:64)
        at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:64)
        ... 4 more

OK, there’s your problem. The ‘Unable to find and load OpenAL library’ does mean there’s something wrong with your setup. You said you’ve already put the DLLs on the library path, so I guess the only thing left to find-out is if you’ve installed OpenAL drivers for your sound hardware.

If your vendor doesn’t provide OpenAL drivers, you can download a sofware OpenAL wrapper from http://www.openal.org/ (which then links to this Creative Labs article for the download: http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=46 )

AHHHHHHHHHHHHH.

Thats percicly what the problem was. I didn’t think about it in Linux since I guess OpenAL gets installed by dependancy (I’m running gentoo). So I never explicity emerge it.

So how do other folks handle Installing OpenAL for the user? For instance, games.

Thanks for all your help man!

In the Java Web Start extension for JOAL, we ship an OpenAL implementation along with the JOAL native libraries. We supplied a patch a while ago to the OpenAL source tree to allow the OpenAL wrapper library to find an OpenAL implementation in the same directory it’s loaded from, which basically means that you don’t have to have OpenAL installed in order to use it.

If it’s working correctly, the Java Web Start links for the Devmaster demos on the joal-demos web site should work without an OpenAL implementation pre-installed.

Let us know whether this is working for you. If you deploy via Java Web Start you should be able to just point to our extension JNLP file in your JNLP with no other work.

Sounds like Ken’s solution is a much better way to ensure the user has OpenAL installed. Whereas I’ve always just put a note before the download link, telling people that they need an OpenAL installed for their sound hardware, or get the OpenAL wrapper from that link I gave you a few posts up ::slight_smile:

Well, I will be releasing my game via JWS so his solution is very much preferable. I was just testing the game on windows via a command line script that the user will not have access to. I’ll let you know if I have any problems with JOAL and JWS once I add that in (which should be in about 2 - 3 weeks).

Thanks guys.

So I have finally tried to use joal via web start.

I have put the following line in my jnlp “” element.


<extension name="joal" href="http://download.java.net/media/joal/webstart/joal.jnlp"/>

However, it seems that I am unable to load audio files (.wavs).
Note, I am using the below code to get the URL of the audio file


return Thread.currentThread().getContextClassLoader().getResource(file);

Here is the error that I am getting while trying to load ts/data/sounds/engine/JetEngine.wav


Creating a buffer for ts/data/sounds/fx/engine/JetEngine.wav
java.io.FileNotFoundException: file:/home/mspeth/.java/deployment/cache/javaws/http/Doutlawstar/P8888/DMwebstart/DMlib/RMts_data.jar!/ts/data/sounds/fx/engine/JetEngine.wav (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at com.sun.media.sound.WaveFileReader.getAudioInputStream(WaveFileReader.java:205)
	at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1162)
	at net.java.games.joal.util.WAVLoader.loadFromFile(WAVLoader.java:68)
	at net.java.games.sound3d.AudioSystem3D.loadBuffer(AudioSystem3D.java:149)

Do I need to do something different with JOAL and Webstart?

Please look at the code in the joal-demos source tree to see examples of loading audio files in a Java Web Start compatible way.

So it seems the problem is that according to the demos, you are required to load the files as a stream shown by the example code below.


SingleStaticSource.class.getClassLoader().getResourceAsStream("demos/data/FancyPants.wav")

The problem with my code is that I’m using the net.java.games.sound3d package. The only option I have for loading a buffer is to provide a String.

Is there any way to do JWS and sound3d?

Thanks