-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTestBus.sc
49 lines (35 loc) · 1.44 KB
/
TestBus.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
TestBus : UnitTest {
test_free {
var s,busses,numBusses;
s = Server.default;
s.newAllocators;
numBusses = s.options.numAudioBusChannels - (s.options.numOutputBusChannels + s.options.numInputBusChannels);
busses = Array.fill( numBusses,{
Bus.audio(s,1);
});
this.assert(busses.every(_.notNil),"should be able to allocate all busses");
this.assertEquals( busses.select(_.notNil).size, numBusses," should be numAudioBusChannels busses");
busses.do({ |b| b.free });
busses = Array.fill( numBusses,{
Bus.audio(s,1);
});
this.assert(busses.every(_.notNil),"after freeing, should be able to re-allocate all busses");
this.assertEquals( busses.select(_.notNil).size, numBusses," should be numAudioBusChannels busses");
}
test_controlFree {
var s,busses;
s = Server.default;
s.newAllocators;
busses = Array.fill( s.options.numControlBusChannels,{
Bus.control(s,1);
});
this.assertEquals( busses.select(_.notNil).size, s.options.numControlBusChannels," should be numControlBusChannels busses");
busses.do({ |b| b.free });
busses = Array.fill( s.options.numControlBusChannels,{
Bus.control(s,1);
});
this.assertEquals( busses.select(_.notNil).size, s.options.numControlBusChannels," should be numControlBusChannels busses able to allocate again after freeing all");
}
// note: server reboot does not de-allocate busses
// and isn't supposed to
}