Hi Matthieu, >From the line numbers, it looks like you are using Java 3D 1.2.1. Can you try this on Java 3D 1.3 beta2.
Thanks, Doug Twilleager Java 3D Team Sun Microsystems >Subject: [JAVA3D] Pb to initialize j3d.sound >To: [EMAIL PROTECTED] >MIME-version: 1.0 >Content-transfer-encoding: 8BIT >Delivered-to: [EMAIL PROTECTED] > > >Hi, >I get a exception when I'm trying to initialize J3d.Sound. I haven't found any examples or tutorials. This is the exception thrown after a call to System.out.println("Channels used for sound : " + s.getNumberOfChannelsUsed()) : > > >java.lang.NullPointerException at javax.media.j3d.SoundRetained.getNumberOfChannelsUsed(SoundRetained.java:779) at javax.media.j3d.Sound.getNumberOfChannelsUsed(Sound.java:845) at montageHansatome.createSceneGraph(montageHansatome.java:140) at montageHansatome.init(montageHansatome.java:68) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) > > >This is my code : > > PhysicalEnvironment pe = simpleU.getViewer().getPhysicalEnvironment(); > AudioEngine ae = new AudioEngine(pe); > pe.setAudioDevice(ae); > > if (ae.initialize()) > System.out.println("audio initialized"); > else > System.out.println("audio not initialized"); > > System.out.println("Nb channels available : " + ae.getChannelsAvailable()); > System.out.println("PlaybackType : " + ae.getAudioPlaybackType()); > > MediaContainer mediaContainer = new MediaContainer(getCodeBase() + "/test.wav"); > Sound s = new BackgroundSound(mediaContainer, 1.0f); > s.setLoop(100); > s.setSchedulingBounds(bounds); > System.out.println("Channels used for sound : " + s.getNumberOfChannelsUsed()); > s.setEnable(true); > > if (s.isReady()) > System.out.println("ready"); > else > System.out.println("not ready"); > > objRoot.addChild(s); > > >If I commentthe line System.out.println("Channels used for sound : " + s.getNumberOfChannelsUsed()), I get another exception and the screen is black : > >java.lang.ClassCastException: com.sun.j3d.audioengines.AudioEngine > at javax.media.j3d.SoundScheduler.checkAudioDevice3D(SoundScheduler.java:2566) > at javax.media.j3d.SoundScheduler.attachSoundData(SoundScheduler.java:2612) > at javax.media.j3d.SoundScheduler.processSoundAtom(SoundScheduler.java:1285) > at javax.media.j3d.SoundScheduler.calcSchedulingAction(SoundScheduler.java:1577) > at javax.media.j3d.SoundScheduler.renderChanges(SoundScheduler.java:787) > at javax.media.j3d.SoundScheduler.processMessages(SoundScheduler.java:229) > at javax.media.j3d.StructureUpdateThread.doWork(StructureUpdateThread.java:83) > at javax.media.j3d.J3dThread.run(J3dThread.java:256) > >Thanks for your help >Matthieu Beghin > > > > > >--------------------------------- >Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français ! ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".