Problem running HelloIntersection

Hello (my first post here)



I get this NullPointerException while trying to run HelloIntersection :



java.lang.NullPointerException

at com.jmex.sound.fmod.objects.Sample3D.<init>(Unknown Source)

at com.jmex.sound.fmod.objects.Sample3D.<init>(Unknown Source)

at com.jmex.sound.fmod.SoundSystem.create3DSample(Unknown Source)

at jmetest.TutorialGuide.HelloIntersection.setupSound(Unknown Source)

at jmetest.TutorialGuide.HelloIntersection.simpleInitGame(Unknown Source)

at com.jme.app.SimpleGame.initGame(Unknown Source)

at com.jme.app.BaseGame.start(Unknown Source)

at jmetest.TutorialGuide.HelloIntersection.main(Unknown Source)



And since I cannot get JME source code from here (firewall prevents me to connect to CVS servers), I cannot check what's wrong. A missing ressource ?



I'm running with the nightly build version of JME (d/l last week) and last version of LWJGL on Windows 2000 using Eclipse. All jME libs are included in the classpath.



Thanks for your help.



PS: by the way, someone should add a word in the quick start guide about the need of downloading fmod.dll separately. That's not explicit, even at runtime.


I have had some strange issues with sound in jME myself.  I think the sound system needs to be re-examined and re-worked but it's at a moderately functional state now.  Without line references I don't think I can be much help debugging it.



Have you had any luck making any other examples work?  Unless you are wanting to learn how to do sound in your games right now I would suggest for the moment just avoiding the sound examples and focusing on the graphical aspects until you can either get access to CVS or we can get something more stable out of the box.



Also, I'm assuming it's mojo that is doing the nightly builds.  I would recommend that we turning debugging on when building the nightly builds so we can have line references.  As for official releases I can understand why you would want to turn that off for performance reasons, but nightly I think is beneficial to have that for reasons such as this.



darkfrog

darkfrog said:

I have had some strange issues with sound in jME myself.  I think the sound system needs to be re-examined and re-worked but it's at a moderately functional state now.  Without line references I don't think I can be much help debugging it.

I finally got the source and here are the faulty lines as they are in the CVS :


targetSound = SoundSystem.create3DSample("D:/eclipse/workspace/JMonkeyEngine/src/jmetest/data/sound/explosion.wav");
laserSound=SoundSystem.create3DSample("D:/eclipse/workspace/JMonkeyEngine/src/jmetest/data/sound/laser.ogg");



So I tried to make the class get these ressources from the classpath with the famous class.getRessource(...) stuff but it wouldn't work better. I tracked the problem down to the Sample3D(String file) constructor that creates a URL from the given file path. Then it gives the URL.getFile() to the native interface FSound.FSOUND_Sample_Load(...).
I think the problem is that getFile() always gives a result of the type "file:<path>" (Well it did in my tests whatever). And it must be that "file:" part that causes the problem because the native lib may not be able to understand it.
So I don't think the Sample3D(String file) constructor would work at all. Here it is :


    public Sample3D(String file){
        URL fileU = Sample3D.class.getClassLoader().getResource(file);
        fmodSample=FSound.FSOUND_Sample_Load(FSound.FSOUND_UNMANAGED, fileU.getFile(), FSound.FSOUND_HW3D |FSound.FSOUND_FORCEMONO | FSound.FSOUND_ENABLEFX, 0, 0);
        LoggingSystem.getLogger().log(Level.INFO,"Load file:"+fileU.getFile()+ " Success="+(fmodSample !=null));
    }



When ressource exists, it gives a success=false result. And when not, a NullPointerException due to the getFile() on the null URL object.


Have you had any luck making any other examples work?  Unless you are wanting to learn how to do sound in your games right now I would suggest for the moment just avoiding the sound examples and focusing on the graphical aspects until you can either get access to CVS or we can get something more stable out of the box.


Everything seems ok except this. And I can wait for sound.


Also, I'm assuming it's mojo that is doing the nightly builds.  I would recommend that we turning debugging on when building the nightly builds so we can have line references.  As for official releases I can understand why you would want to turn that off for performance reasons, but nightly I think is beneficial to have that for reasons such as this.

darkfrog


I'm not sure it is usefull to turn it off for demo jars at all.  :wink:

Thanks for your help.

Oh yeah, I forgot that the examples are in a separate jar entirely.  Good point.



Personally I've never even tried using FMOD as I intend to eventually release my games commercially and FMOD is only free for non-commercial use.  The problem I've had specifically with OpenAL is that WAVs do not currently work with it on Windows.  The only sound example I've run is the Pong example and if I change it to use OGG instead of WAV it works fine.  I would encourage you to try out OpenAL if you're interested in sound and even though the sound support is not the greatest in jME currently it should be functional at least.



darkfrog

the problem is not wav exactly but how they are formatted explosion and turn.wav have issues footsteps worked fine see http://www.jmonkeyengine.com/jmeforum/index.php?topic=1873.0