I know there are problems but I'd like to try using the Java3D sound nodes. I've got some code which will load a background sound and play it once. The trouble is that it plays even when the node is disabled. It won't loop continuously when enabled with infinite loops. It doesn't play if not added to the Group node.
Here's the code: Group localGroup = new Group(); File file = new File( System.getProperty( "user.dir" ) ); URL url = null; URL soundUrl = null; try { url = file.toURL( ); soundUrl = new URL( url, "mash.wav" ); }catch (Exception e){ System.out.println(e); }
BackgroundSound backgroundSound = null; MediaContainer backgroundMedia = null; try{ backgroundMedia = new MediaContainer(soundUrl); }catch (Exception ex){ System.out.println(ex); } backgroundMedia.setCacheEnable( true ); BoundingSphere worldBounds = new BoundingSphere( new Point3d( 0.0, 0.0, 0.0 ), 1000.0 ); // Background sound backgroundSound = new BackgroundSound( ); backgroundSound.setLoop( Sound.INFINITE_LOOPS ); backgroundSound.setSoundData( backgroundMedia ); backgroundSound.setEnable(true); backgroundSound.setInitialGain( vol ); backgroundSound.setSchedulingBounds( worldBounds ); backgroundSound.setCapability( Sound.ALLOW_ENABLE_WRITE ); backgroundSound.setCapability( Sound.ALLOW_INITIAL_GAIN_WRITE ); localGroup.addChild( backgroundSound ); return localGroup;
It makes no difference whether I enable or disable it, and the number of loops can be changed with no effect. I'm using the Blackdown port for Linux.
Any suggestions?
Tony
=========================================================================== 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".