Patrick,

Make sure you have all these calls, and in this order:

SimpleUniverse u = new SimpleUniverse(c);
AudioDevice audioDev = u.getViewer().createAudioDevice();
BranchGroup scene = createSceneGraph();
u.addBranchGraph(scene);

There is an ordering dependency creating the AudioDevice. You also need to note that:

"A Sound is scheduled for activation when its scheduling region intersects the 
ViewPlatform's activation volume. This is used when the scheduling bounding leaf is 
set to null."

So call: ViewPlatform.setActivationRadius(float activationRadius)

I had quite some problems getting Sound to work, but it did work in the end, at least 
after a fashion. Check the bug list for a list of known issues with Sound. Start with 
the SimpleSounds example and make gradually changes to it.

Hope that helps (sorry if you already knew all that!).

Sincerely,

Daniel Selman

[EMAIL PROTECTED]
http://www.tornadolabs.com

> -----Original Message-----
> From: Discussion list for Java 3D API
> [mailto:[EMAIL PROTECTED]]On Behalf Of ing. P.W.L. JANSSEN
> Sent: 20 September 1999 09:24
> To: [EMAIL PROTECTED]
> Subject: How can I set a sound node live?
>
>
> Hi 3d developers,
>
> I try to get sound in my 3d object. But untill now I don't hear a xxxxx
> thing. I read in a book that to play a sound, at least the sound node
> must be live. Can somebody tell me how to do that?
> Here is my code:
>
> BackgroundSound back_sound;
> MediaContainer back_song;
>
> back_song=new MediaContainer();
>
> try{
>     back_song = new MediaContainer(new
> java.net.URL("http://......logon.wav"));
> }catch (java.net.MalformedURLException me){
>     System.err.println("can't load back song "+me);
> }
>
> System.err.println("back song is "+back_song);
> back_song.setCacheEnable(true);
> float volume = 20.0f;
> back_sound = new BackgroundSound(back_song,volume);
> back_sound.setSoundData(back_song);
> back_sound.setEnable(true);
> back_sound.setInitialGain(0.5f);
> back_sound.setCapability(PointSound.ALLOW_ENABLE_WRITE);
> back_sound.setCapability(PointSound.ALLOW_INITIAL_GAIN_WRITE);
> back_sound.setCapability(PointSound.ALLOW_SOUND_DATA_WRITE);
> back_sound.setCapability(PointSound.ALLOW_SCHEDULING_BOUNDS_WRITE);
> back_sound.setCapability(PointSound.ALLOW_CONT_PLAY_WRITE);
> back_sound.setCapability(PointSound.ALLOW_RELEASE_WRITE);
> back_sound.setCapability(PointSound.ALLOW_DURATION_READ);
> back_sound.setCapability(PointSound.ALLOW_IS_PLAYING_READ);
> back_sound.setCapability(PointSound.ALLOW_LOOP_WRITE);
> back_sound.setSchedulingBounds(new BoundingSphere(new Point3d(0.0, 0.0,
> 0.0), 100.0));
>
> objRoot.addChild(back_sound);
> try{
>     System.err.println("Sound is ready: "+back_sound.isReady());
> }catch (javax.media.j3d.CapabilityNotSetException cnse){
>     System.err.println("No capability is set");
> }
>
> objRoot.compile();
> System.err.println("Sound is live: "+back_sound.isLive());
> System.err.println("Sound is playing: "+back_sound.isPlaying());
>
> I get following messages on my Java console:
>
> back song is javax.media.j3d.MediaContainer@d743c001
> Sound is ready: false
> Sound is live: false
> Sound is playing: false
>
> java.lang.NullPointerException:
>  at
> javax.media.j3d.SoundScheduler.findActiveSoundscapes(SoundSchedule
> r.java:377)
>
>  at javax.media.j3d.SoundScheduler.run(SoundScheduler.java:263)
>
> I hope somebody can tell me why I don't hear anything.
> Thanks in advance for your help,
>
> Patrick
>
> ==================================================================
> =========
> 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".
>

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

Reply via email to