List of usage examples for javax.media.j3d BackgroundSound setEnable
public void setEnable(boolean state)
From source file:SimpleSounds.java
/** * This adds a continuous background sound to the branch group. * //w w w . jav a2s . c o m * @param b * BranchGroup to add the sound to. * @param soundFile * String that is the name of the sound file. */ protected void addBackgroundSound(BranchGroup b, String soundFile) { //Create a media container to load the file MediaContainer droneContainer = new MediaContainer(soundFile); //Create the background sound from the media container BackgroundSound drone = new BackgroundSound(droneContainer, 1.0f); //Activate the sound drone.setSchedulingBounds(bounds); drone.setEnable(true); //Set the sound to loop forever drone.setLoop(BackgroundSound.INFINITE_LOOPS); //Add it to the group b.addChild(drone); }