Blame view

VRGNYMusicLights/Sources/ApplicationJava/Music.java 706 Bytes
742429d1   pfrison   VRGNYMusicLight b...
1
2
3
  
  public class Music {
  	private MusicPattern pattern;
d175ba55   pfrison   VRGNYMusicLight a...
4
  	public MusicPath path;
a89c030d   pfrison   VRGNYMusicLights ...
5
6
  	private int[] lightTickDelais;
  	private double volume;
742429d1   pfrison   VRGNYMusicLight b...
7
  
a89c030d   pfrison   VRGNYMusicLights ...
8
  	public Music(MusicPattern pattern, MusicPath path, double volume) {
742429d1   pfrison   VRGNYMusicLight b...
9
  		this.pattern = pattern;
d175ba55   pfrison   VRGNYMusicLight a...
10
  		this.path = path;
a89c030d   pfrison   VRGNYMusicLights ...
11
12
13
  		this.lightTickDelais = path.calculateTickDelais();
  		this.volume = volume;
  	}
d175ba55   pfrison   VRGNYMusicLight a...
14
  
278cdee0   pfrison   VRGNYMusicLights ...
15
  	public MusicPattern getMusicPattern() { return pattern; }
d175ba55   pfrison   VRGNYMusicLight a...
16
17
  	public MusicPath getMusicPath() { return path; }
  	public double getVolume() { return volume; }
278cdee0   pfrison   VRGNYMusicLights ...
18
  	
a89c030d   pfrison   VRGNYMusicLights ...
19
20
21
22
23
  	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;
742429d1   pfrison   VRGNYMusicLight b...
24
25
  	}
  }