This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSC-Wonder.sc
60 lines (49 loc) · 1.5 KB
/
SC-Wonder.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
WonderBus {
var <index;
*new{ |plane =false, doppler = false|
var i = WonderCtrl.allocator.alloc;
if(i.notNil){
WonderCtrl.addr.sendMsg('/WONDER/source/type',i,plane.binaryValue);
WonderCtrl.addr.sendMsg('/WONDER/source/dopplerEffect',i,doppler.binaryValue);
WonderCtrl.addr.sendMsg('/WONDER/source/activate',i);
("creating Wonder WFS bus with index "++i).postln;
^super.newCopyArgs(i)
}{
Error("ran out of WFS channels").throw;
}
}
setPos_{ |x,y|
("WonderBus "++index++": setting position to "++x++", "++y).postln;
WonderCtrl.addr.sendMsg('/WONDER/source/position',x,y)
}
free{
if(index.isNil)
{ ("WonderBus has already been freed").warn; }
{
("WonderBus: freeing index "++index).postln;
WonderCtrl.addr.sendMsg('/WONDER/source/deactivate',index);
WonderCtrl.allocator.free(index);
index = nil;
}
}
}
WonderCtrl{
classvar <allocator, <addr, <server;
*startup{ |startIndex = 0,size = 42,scsynthIP = '127.0.0.1',scsynthPort = 57119,makeDefault = true|
var cwonderIP = "192.168.3.254",cwonderPort = 12222, options;
allocator = ContiguousBlockAllocator(size+startIndex,startIndex);
addr = NetAddr(cwonderIP,cwonderPort);
options = ServerOptions()
.numWireBufs_(1024)
.numOutputBusChannels_(42)
.remoteControlVolume_(true);
server = Server("wonderSCSynth",NetAddr(scsynthIP.asString,scsynthPort),options);
if(scsynthIP == '127.0.0.1'){
server.boot
};
server.makeWindow;
if(makeDefault){
Server.default = server;
};
}
}