Nifty

Hello,



I use this function for nifty, It’s work in eclipse but not in a Applet



Thank you



[java]

public void jouerson(String binding)

{

if (!enabled)

return;



if (binding.equals(“play”) && niftyElement2.isVisible())

{

audio_nature = new AudioNode(assetManager, “Ressource/musique1.ogg”, false);

audio_nature.setLooping(true);

audio_nature.setPositional(true);

audio_nature.setLocalTranslation(Vector3f.ZERO.clone());

// Volume goes from 0.1f to 1.0f. At 0 it’s muted.

audio_nature.setVolume(1f);

audioRenderer.playSource(audio_nature); // play continuously!

niftyElement2.setVisible(false);

niftyElement3.setVisible(true);

}



else

{

audio_nature.setVolume(0);

niftyElement2.setVisible(true);

niftyElement3.setVisible(false);

}

}

[/java]



24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: error: null

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: sun.reflect.NativeMethodAccessorImpl:null:invoke0:-2

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: sun.reflect.NativeMethodAccessorImpl:null:invoke:-1

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: sun.reflect.DelegatingMethodAccessorImpl:null:invoke:-1

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: java.lang.reflect.Method:null:invoke:-1

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.NiftyMethodInvoker:NiftyMethodInvoker.java:callMethod:203

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.NiftyMethodInvoker:NiftyMethodInvoker.java:performInvoke:137

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.Nifty$DelayedMethodInvoke:Nifty.java:perform:1052

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.Nifty:Nifty.java:invokeMethods:1028

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.Nifty:Nifty.java:handleDynamicElements:235

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.Nifty:Nifty.java:processMouseEvent:217

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.niftygui.InputSystemJme:InputSystemJme.java:onMouseButtonEventQueued:114

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.niftygui.InputSystemJme:InputSystemJme.java:forwardEvents:156

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: de.lessvoid.nifty.Nifty:Nifty.java:render:184

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.niftygui.NiftyJmeDisplay:NiftyJmeDisplay.java:postQueue:138

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.renderer.RenderManager:RenderManager.java:renderViewPort:717

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.renderer.RenderManager:RenderManager.java:render:745

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: Test.TestAppStates:TestAppStates.java:update:528

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.system.lwjgl.LwjglAbstractDisplay:LwjglAbstractDisplay.java:runLoop:146

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.system.lwjgl.LwjglCanvas:LwjglCanvas.java:runLoop:225

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: com.jme3.system.lwjgl.LwjglAbstractDisplay:LwjglAbstractDisplay.java:run:208

24 avr. 2011 14:37:45 de.lessvoid.nifty.NiftyMethodInvoker callMethod

ATTENTION: java.lang.Thread:null:run:-1

I have this error



25 avr. 2011 23:59:28 com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread

INFO: AudioRenderer supports 64 channels

25 avr. 2011 23:59:28 com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread

INFO: Audio effect extension version: 1.0

25 avr. 2011 23:59:28 com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread

INFO: Audio max auxilary sends: 1

Initialize

25 avr. 2011 23:59:28 com.jme3.asset.DesktopAssetManager loadAsset

ATTENTION: No loader registered for type ogg.

Exception in thread “LWJGL Renderer Thread” java.lang.NullPointerException

at com.jme3.audio.lwjgl.LwjglAudioRenderer.playSource(LwjglAudioRenderer.java:848)

at HelloAudio.initaudio(HelloAudio.java:68)

at HelloAudio.initialize(HelloAudio.java:36)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:136)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:193)

at java.lang.Thread.run(Unknown Source)



The loader is in audio.plugin ?

I try with HelloAudio in a Applet and I have this code



Exception in thread “LWJGL Renderer Thread” java.lang.NullPointerException

at HelloAudio.initAudio(HelloAudio.java:55)

at HelloAudio.simpleInitApp(HelloAudio.java:37)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:218)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:136)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:193)

at java.lang.Thread.run(Unknown Source)



Thank you

The NullPointer exception is in your own code.

You’re welcome

Thank you,



but why It work in eclipse but not with an applet ?

Line 55 is:

[java]audio_nature = new AudioNode(assetManager, “Sound/Environment/Nature.ogg”, false);

audio_nature.setLooping(true);

audio_nature.setPositional(true);

audio_nature.setLocalTranslation(Vector3f.ZERO.clone());

audio_nature.setVolume(3);

audio_nature.updateGeometricState(); // <— line 55

audioRenderer.playSource(audio_nature);[/java]



If you’re deploying as an applet, you might not have access to the assets included with the jme3 tests. You may have to copy them to the assets folder of your jMP project

You have to use jMP to deploy as an applet … Otherwise the natives will not be loaded.

As for your error, it happens because the ogg vorbis libraries are not on the classpath