Bugs in JOAL Sound?

Hi all,
I have used xith3d for about two years to build a game. I think I have found some bugs and done some private fixes. Nowadays when you guys are doing heavy modifications to code I would like fixes to be put directly to xith3d version control so I do not need to fix these manually every time I get a new build. :wink:

I think one bug is in JOALSoundDriverImpl.java:


 public void setListenerOrientation(Tuple3f direction, Tuple3f up) {
  208 
  209         al.alListenerfv(AL.AL_ORIENTATION,new float[]{direction.z, direction.y, direction.z,
  210         up.x,up.y,up.z});
  211 
  212         // To change body of implemented methods use Options | File Templates.
  213     }

First direction.z should be direction.x:


  209         al.alListenerfv(AL.AL_ORIENTATION,new float[]{direction.x, direction.y, direction.z,
  210         up.x,up.y,up.z});

As a side effect sound directions are not not working correctly. In my game player is looking to -Z coordinate. After fixing the alListenerfv-call sounds are coming from wrong direction. I have had to do this in View.java


private void updateSound() {

        getTransform().get(listenerPosition);
        listenerOrientation.set(1,0,0);
        Matrix3f m = new Matrix3f();
        getTransform().getRotation(m);
        m.transform(listenerOrientation);
        listenerOrientation.normalize();
        listenerOrientation.set(0, 0, -1);        // NOTE! Set orientation manually. Otherwise direction is somehow wrong!
        soundDriver.setListenerOrientation(listenerOrientation, new Vector3f(0,1,0));
        soundDriver.setListenerPosition(listenerPosition);
    }

I noticed that in SVN this logic is moved to SoundProcessor.java. Do you guys have had issues with sound orientation with JOAL?

Another problem in JOALSoundDriverImpl.java is:


  185         System.out.println("Making sound context current");
  186         alc.alcMakeContextCurrent(context);

When I call soundDriver.shutdown(); execution hangs in the line 186. To get JOAL working I have had to comment the line out. I am not sure if this is bug in xith but I have not got it working otherwise :slight_smile:

Currently I have not bothered to do those changes in local xith3d sources but fixed them inside the game extending base classes and creating FixedView, FixedJOALSoundDriver, FixedJOALSoundSourceImpl etc. Now I have noticed that there are all kinds of new functionality added like Xith3DEnvironment and HUD. When using those Fixed classes usage of new functionality is harder. It would be great if someone could check if there really is bugs in xith3d and fix them with the help of my code snippets. 8)

-ari

First ruoat, it’s really cool to have you here !

What kind of game are you working on ? Can we play/have screenies ?

Do you want SVN access for xith3d & xith-tk ?

I do not have the time to review your changes right now but as of tomorrow I’ll do the required changes. (I have digged sound support, see rafa_es game)

One more time, really great to have you here.

Hi Amos,
thanks for the interest. :slight_smile: There is one screenshot in http://atr.dy.fi/~atr/aos/. The game can also be played using web start or downloaded. Even though I have developed it so long time the game is still very immature. But basic dogfight should be able to be played in multiplayer.
Too bad I have so few time that I would like to develop my game more instead of contributing much to xith3d. I appreciate your hard work but I like to be like a parasite who enjoys other’s work doing nothing itself :stuck_out_tongue:

-ari

Welcome to the forum ;D.

Isn’t it always better to commit the fixes to the original code base? That’s Open Source, isn’t it?

Marvin

EDIT: Do you have more bugs fixed? If so, please share your fixes.

That’s not a problem. Your game seems cool, would you want it to be mentioned on http://www.xith.org/ “Featured Projects” page ?

I guess some people believed once that Xith3D was dead and they all had their local homemodified version. But more and more are coming back with their fixes and that’s fine.

+1

Yes I agree. I posted my modifications here because I would like you to review my changes and not just commit something to SVN and possibly break other things. I am not very familiar with xith internals and have been concentrating to game logic instead. I don’t have any other fixes. Some Fixed classes (like FixedJOALSoundSourceImpl) are basically just copy pasted code with new name to get rid of issues caused by extending xith3d classes.
Because I am not familiar with xith internals maybe someone could know what’s wrong with updateSound after fixing the setSoundOrientation. The change in my version is not suitable to be put in version control, because of just manual setting

listenerOrientation.set(0, 0, -1);

. That would work with my game, but someone other’s game might break. :slight_smile:

And someone might know what consequences of skipping the call alc.alcMakeContextCurrent(context); has.

Thanks, but I think the game is not yet ready for public. :slight_smile:

-ari

OK. The listener-orientation thingy also seemed strange to me. It’s surprising that it won’t work correctly when you compute it from point-of-view.

Will test it if I have time.

So I think, but look my game project (Stratagem) appears on Xith.org yet it’s really not ready for public. Remember xith.org is primarily a developer place. Who knows some developer finding your project cool could contact you and contribute?
And second, it demonstrates that some people actually use Xith3D
 and that attracts more developers and so it’s 100% advantage for you ^^