sound3d package status

Hi,
I downloaded latest joal release so I found that it has sound3d package. I love its architecture, it is much more object oriented and “java style”, so I hoped I could use it in my game. But, it just doesn’t work.
this is the code:

try
{
AudioSystem3D.init();
AudioSystem3D.generateBuffers(1);
AudioSystem3D.generateSources(1);
Buffer buff = AudioSystem3D.loadBuffer(“data/audio/Explode.wav”);
Source source = AudioSystem3D.generateSource(buff);
source.setPosition(0, 0, 0);
AudioSystem3D.getListener().setPosition(0, 0, 0);
source.setMaxDistance(100);
source.play();
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

it doesnt rise exception, it just doesnt play anything. file is defenetly there and it works good with lwjgl’s joal wrapper.

One another thing bothers me. In joal windows binaries there is joal.jar and joal.dll, but without OpenAL.dll (from lwjgl libraries) it rises exception: net.java.games.joal.OpenALException: Could not load openal library.

So my questions are:

  1. what is the status of net.java.games.sound3d package
  2. what’s wrong with my code above
  3. which dll’s I need to use joal

The Sound3D toolkit isn’t really under active development. However, we can certainly make changes if you have suggestions.

The following slightly modified version of your test case works. Note the creation of the Device and Context which were missing. Additionally the program was exiting before the sound had finished playing. This shouldn’t be a problem in a normal game.

Please try downloading the new JOAL binaries which are now linked to from the JOAL home page. The API has changed somewhat from the older releases, but the new version should be stable and the implementation should also be more robust than the older one.

Java Web Start binaries, etc. still to come.


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

public class ASTest {
  public static void main(String[] args) {
    try
      {
        AudioSystem3D.init();
        Device dev = AudioSystem3D.openDevice(null);
        Context ctx = AudioSystem3D.createContext(dev);
        AudioSystem3D.makeContextCurrent(ctx);
        AudioSystem3D.generateBuffers(1);
        AudioSystem3D.generateSources(1);
        Buffer buff = AudioSystem3D.loadBuffer("FancyPants.wav");
        Source source = AudioSystem3D.generateSource(buff);
        source.setPosition(0, 0, 0);
        AudioSystem3D.getListener().setPosition(0, 0, 0);
        source.setMaxDistance(100);
        source.play();
        Thread.sleep(5000);
      }
    catch (Exception e)
      {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } 
  }
}

Hi, Ken, thanx for your help.

I made my code work in another way. i just added ALut.alutInit() after AudioSystem3D.init(); and it works now. Which way is right way, my or yours?

My code was actually inside of class constructor and that class extends JFrame, so my program wasn’t really exiting untill I close the window.

I foud sound3d package very helpfull and much cleaner designed for use in java apps.

as java programer I prefer calling methods like AudioSystem3D.getListener().setPosition(0, 0, 0); then AL10.alListener(AL10.AL_POSITION, listenerPosition);

I think that is the direction in wich you should go with joal development. If I can help i n any way I would be glad.

That will have the side-effect of working but the more correct way given the current Sound3D APIs is to manually create the Device and Context and make the Context current.

Agreed that it’s a cleaner, more object-oriented API. If you have suggestions for how to improve the API please post them.

For now I don’t have suggestions, It is really good and simple.
I am bit confused with versions, because I recently downloaded joal1.1b0.4, but now I see joal1.1b01 as latest release…
Another thing that bothers me is that javadoc for joal1.1b0.1 doesn’t contain sound3d package doc. Why is that so?

Sorry for the confusion. I think we need to reset the version numbering because the old autogenerated binaries were incorrect and “1.1” is the best version number to indicate that JOAL has been upgraded with OpenAL 1.1 support.

[qupte]
Another thing that bothers me is that javadoc for joal1.1b0.1 doesn’t contain sound3d package doc. Why is that so?

Sorry about that, just a bug. I’ll fix it.