Java Reference
In-Depth Information
Figure 9-3. Bars effect
In Figure 9-3 the bars visualizer is displayed. There are 20 bars; each bar's height is proportional to
the sound at one of the 20 frequencies presented by the class SoundPlayer . Let's take a look at the source
code in Listing 9-8.
Listing 9-8. Bars.fx
public class Bars extends AudioVisualization{
for (i in [0.. <sizeof(soundPlayer.levels)]){
var rect = Rectangle{
translateX: 500-i*25
translateY: bind -soundPlayer.levels[i]*200
width: 20;
height: bind soundPlayer.levels[i]*200
arcHeight: 10
Search WWH ::

Custom Search