-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXY4Controller.sc
131 lines (110 loc) · 3.56 KB
/
XY4Controller.sc
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
SoundXY4 - a musical tabletop interface for ambisonics spatialisation
Author:
Copyright (c) 2013 Anna Xambó <anna.xambo@open.ac.uk>
Computing Department
Faculty of Maths, Computing and Technology
The Open University
Milton Keynes, UK
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
XY4Controller {
var id, classID, pos, rotAxis, rotEuler, velocity, acceleration;
var <>synth;
var maxidplys, minidfxs;
*new {
^super.new.init ();
}
init {
maxidplys = 36;
minidfxs = 107;
132.do({|item|
SETODictObj.setAction(item,
{|me|
if(XY4.objects[me.classID].isNil, // new objects
{
XY4.file.write("% set % % % % %\n".postf(me.tStamp, me.classID, me.id, me.pos[0], me.pos[1], me.rotEuler[0]));
if(me.classID < maxidplys, {
XY4.objects.add(me.classID -> XY4Player.new(me));
if (XY4.pathsamples[me.classID].notNil,
{
XY4.objects[me.classID].playsynth();
});
});
if(me.classID > minidfxs, {
var fx;
switch (me.classID % 6,
0, { fx = XY4FXAM.new(me)},
1, { fx = XY4FXBP.new(me)},
2, { fx = XY4FXCombC.new(me)},
3, { fx = XY4FXHP.new(me)},
4, { fx = XY4FXLP.new(me)},
5, { fx = XY4FXRate.new(me)}
);
XY4.objects.add(me.classID -> fx);
fx.playsynth;
});
},{ // update objects
XY4.file.write("% update % % % % %\n".postf(me.tStamp, me.classID, me.id, me.pos[0], me.pos[1], me.rotEuler[0]));
if(me.classID < maxidplys, {
XY4.objects[me.classID].setvolume();
XY4.objects[me.classID].setpan4();
});
if(me.classID > maxidplys, {
if (XY4.objects[me.classID].isKindOf(XY4FXHP),
{
XY4.objects[me.classID].setfreq()
});
if (XY4.objects[me.classID].isKindOf(XY4FXLP),
{
XY4.objects[me.classID].setfreq()
});
if (XY4.objects[me.classID].isKindOf(XY4FXRate),
{
XY4.objects[me.classID].setps()
});
if (XY4.objects[me.classID].isKindOf(XY4FXBP),
{
XY4.objects[me.classID].setfreq()
});
if (XY4.objects[me.classID].isKindOf(XY4FXAM),
{
XY4.objects[me.classID].setfreq()
});
if (XY4.objects[me.classID].isKindOf(XY4FXCombC),
{
XY4.objects[me.classID].setfreq()
});
});
XY4.manageConnections();
}
);
},
{|me| // delete objects
XY4.file.write("% del % % % % %\n".postf(me.tStamp, me.classID, me.id, me.pos[0], me.pos[1], me.rotEuler[0]));
XY4.objects[me.classID].removesynth();
XY4.objects.removeAt(me.classID);
}
);
});
}
print {|tuiobj|
id = tuiobj.id;
classID = tuiobj.classID;
pos = tuiobj.pos;
rotAxis = tuiobj.rotAxis;
rotEuler = tuiobj.rotEuler;
velocity = tuiobj.velocity;
acceleration = tuiobj.acceleration;
[id, classID, pos, rotAxis, rotEuler, velocity, acceleration].postln;
}
}