summaryrefslogtreecommitdiff
path: root/lib/GenEvent.ck
blob: 63328eaa7d9a5d61e6919352e62171cfe275a4c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Base class for controller events
 */
public class GenEvent extends Event {
	/* normalized value between [0, 1] */
	float value;

	/*
	 * Getter functions to scale `value'
	 */
	fun float
	getFloat()
	{
		return value;
	}
	fun float
	getFloat(float max)
	{
		return max*value;
	}
	fun float
	getFloat(float min, float max)
	{
		return min + (max - min)*value;
	}

	fun dur
	getDur(dur max)
	{
		return max*value;
	}
	fun dur
	getDur(dur min, dur max)
	{
		return min + (max - min)*value;
	}

	fun int
	getBool()
	{
		return value $ int;
	}
}