File: LIDGui.sc

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (74 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download | duplicates (6)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
LIDGui{
	var <win, <updater;
	var <device;
	var buttons;
	var sliders;
	var relsliders;

	var <bkeys,<akeys,<rkeys;

	*new{ |device|
		^super.new.init(device);
	}

	init{ |dev|
		device = dev;
		win = Window.new( device.info.name, Rect( 0, 0, 400, 400 ));
		win.view.decorator = FlowLayout( win.bounds );

		EZText.new( win, 390@20 , "name", initVal: device.info.name );

		EZText.new( win, 390@20, "findArgs", initVal: device.info.findArgs );

		win.view.decorator.nextLine;

		// buttons:
		if ( device.slots[1].notNil, {
			bkeys = device.slots[1].keys.asArray.sort;
			buttons = bkeys.collect{ |key,it|
				EZNumber.new( win, 30@40, device.slots[1][key].key.asString, [0,1,\linear,1].asSpec, labelWidth: 30, layout: 'line2', gap:0@0, margin: 0@0 );
			};
		});
		win.view.decorator.nextLine;

		// absolute slots:
		if ( device.slots[3].notNil, {
			akeys = device.slots[3].keys.asArray.sort;
			sliders = akeys.collect{ |key,it|
				EZSlider.new( win, 30@80, device.slots[3][key].key.asString, labelWidth: 30, layout: 'vert',gap:0@0,margin:0@0 );
			};
		});
		win.view.decorator.nextLine;

		// relative slots:

		if ( device.slots[2].notNil, {
			rkeys = device.slots[2].keys.asArray.sort;
			relsliders = rkeys.collect{ |key,it|
				EZSlider.new( win, 30@80, device.slots[2][key].key.asString, [-10,10].asSpec, labelWidth: 30, layout: 'vert',gap:0@0,margin:0@0 );
			};
		});

		win.front;

		updater = SkipJack.new( {
			if ( bkeys.notNil, {
				bkeys.do{ |key,k,v| buttons[k].value = device.slots[1][key].value };
			});
			if ( rkeys.notNil, {
				rkeys.do{ |key,k,v| relsliders[k].value = device.slots[2][key].delta };
			});
			if ( akeys.notNil, {
				akeys.do{ |key,k,v| sliders[k].value = device.slots[3][key].value };
			});
		}, 0.1, win.isClosed, name: "LIDGui" );
	}
}

+ LID {

	makeGui{
		^LIDGui.new( this );
	}

}