Re: getting sound on side of the preferred size
On 01/20/2012 02:45 PM, Michael Adedeji wrote:
Hey guys, I want the sound in this program to sound at six different
places on the preffered size of the screen. There should be upper
right and lower right sound, upper and lower left sound and last upper
and lower middle sound. Currently the sound below is just for the four
sides of the prefferred size of the screen...but am thinking of a way
to divide the sound into six different part. any help is
appreciated :)
import java.awt.geom.Area;
import java.awt.geom.Point2D;
import java.util.HashSet;
import java.util.Set;
import javax.sound.sampled.Clip;
public class Scratch {
private class MyRegion {
private Area area;
private Clip clip;
public MyRegion(Area area, Clip clip) {
this.area = area;
this.clip = clip;
}
public boolean contains(Area area) {
return false;
}
public boolean contains(Point2D point) {
return false;
}
public void playClip() {
}
}
public static void main(String[] args) {
Set<MyRegion> regions = new HashSet<MyRegion>();
// setup some regions
Point2D bouncingBallLocation = null;
// initialize bouncingBallLocation
while(true) {
for(MyRegion region : regions) {
if(region.contains(bouncingBallLocation)) {
region.playClip();
}
}
// bouncingBallLocation changes
}
}
}