aboutsummaryrefslogtreecommitdiff
path: root/chuck/OSCGraphicsPort.ck
blob: 9c81e62119f67ece971504a65209f594e3905e96 (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
public class OSCGraphicsPort extends Chubgraph {
	inlet => blackhole;
	inlet => outlet;

	second/20 => dur poll_interval;

	fun void tick(float in) {} /* virtual */
	fun void
	tick(float in, float prev) /* virtual */
	{
		in => tick;
	}

	fun void
	poll()
	{
		inlet.last() => float prev;

		while (poll_interval => now)
			if (inlet.last() != prev) {
				tick(inlet.last(), prev);
				inlet.last() => prev;
			}
	}
	spork ~ poll();
}