-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcanto receive.scd
65 lines (43 loc) · 1.41 KB
/
canto receive.scd
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
~canto = ~canto ? EM();
thisProcess.slotPut( \openPorts, [] );
thisProcess.openUDPPort(9000);
~canto.makeRecvWindow = { |evt|
var views, ctrl;
evt.oscFuncs.do(_.remove);
evt.rw = Window("canto", Rect(128, 64, 1400, 900) ).front;
evt.rw.addFlowLayout;
evt.rw.view.background = Color.black;
views = ();
evt.rw.asView.decorator.shift( 180, 100 );
views[ \metro ] = SmoothButton( evt.rw, 270@270 )
.label_( [ "", "" ] )
.hiliteColor_( Color.yellow )
.background_( Color.black.alpha_(0.1) )
.border_(0)
.value_(1)
.canFocus_(false);
evt.rw.asView.decorator.shift( 0, -100 );
views[ \current ] = StaticText( evt.rw, 900@700 )
.string_(
evt.currentCell !? _.id ? "1";
)
.align_( \center )
.font_( Font( Font.defaultSansFace, 600 ) )
.stringColor_( Color.white );
evt.rw.asView.decorator.nextLine;
evt.rw.asView.decorator.shift( 0, -260 );
views[ \beatbar ] = StaticText( evt.rw, 660@160 )
.font_( Font( Font.defaultSansFace, 160 ) )
.align_( \center )
.string_( "1/4" )
.stringColor_( Color.white );
evt.oscFuncs = [
OSCFunc( { |msg| { views[ \current ].string = msg[1].asString }.defer }, '/1/current' ),
OSCFunc( { |msg| { views[ \beatbar ].string = msg[1].asString }.defer }, '/1/position' ),
OSCFunc( { |msg| { views[ \metro ].value = msg[1] }.defer }, '/1/beat' ),
];
evt.rw.onClose_({
evt.oscFuncs.do(_.free);
});
};
~canto.makeRecvWindow;