Java Reference
In-Depth Information
with each phase value multiplied by 100. Shown here is the code snippet that plots
each randomly colored circle:
circle.setCenterX(x + i);
circle.setCenterY(y + (phase * 100));
... // setting the circle
i+=5;
Here is an inner class implementation of an AudioSpectrumListener :
new AudioSpectrumListener() {
@Override
public void spectrumDataUpdate(double timestamp,
double duration, float[] magnitudes, float[]
phases) {
phaseNodes.getChildren().clear();
int i = 0;
int x = 10;
int y = 150;
final Random rand = new
Random(System.currentTimeMillis());
for(float phase:phases) {
int red = rand.nextInt(255);
int green = rand.nextInt(255);
int blue = rand.nextInt(255);
Circle circle = new Circle(10);
circle.setCenterX(x + i);
circle.setCenterY(y + (phase * 100));
circle.setFill(Color.rgb(red, green, blue, .70));
phaseNodes.getChildren().add(circle);
i+=5;
}
}
};
Search WWH ::




Custom Search