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.
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
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