Music.java
567 Bytes
public class Music {
private MusicPattern pattern;
private int[] lightTickDelais;
private double volume;
public Music(MusicPattern pattern, MusicPath path, double volume) {
this.pattern = pattern;
this.lightTickDelais = path.calculateTickDelais();
this.volume = volume;
}
public MusicPattern getMusicPattern() { return pattern; }
public double[] render(long tick) {
double[] lights = new double[lightTickDelais.length];
for(int i=0; i<lights.length; i++)
lights[i] = pattern.render(lightTickDelais[i] + tick) * volume;
return lights;
}
}