Music.java
706 Bytes
public class Music {
private MusicPattern pattern;
public MusicPath path;
private int[] lightTickDelais;
private double volume;
public Music(MusicPattern pattern, MusicPath path, double volume) {
this.pattern = pattern;
this.path = path;
this.lightTickDelais = path.calculateTickDelais();
this.volume = volume;
}
public MusicPattern getMusicPattern() { return pattern; }
public MusicPath getMusicPath() { return path; }
public double getVolume() { return volume; }
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;
}
}