Example usage for javax.media.j3d BackgroundSound setSchedulingBounds

List of usage examples for javax.media.j3d BackgroundSound setSchedulingBounds

Introduction

In this page you can find the example usage for javax.media.j3d BackgroundSound setSchedulingBounds.

Prototype

public void setSchedulingBounds(Bounds region) 

Source Link

Document

Set the Sound's scheduling region to the specified bounds.

Usage

From source file:SimpleSounds.java

/**
 * This adds a continuous background sound to the branch group.
 * //from www . j ava  2  s.co  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);
}