1TITLE:: InBus
2summary::Return a range of channels from a bus, irrespective of node order
3categories::UGens>InOut
4related:: Classes/In, Classes/XIn, Classes/InFeedback, Classes/XInFeedback
5
6DESCRIPTION::InBus provides a simple interface to the signal on a bus, crossfading between adjacent values.
7code::
8(
9b = Bus.control(s, 9); // nine channel control rate
10b.setn([244, 737, 20, 271, 382, 172, 4, 2399, 251]);
11{
12	var index = MouseX.kr(0, 30);
13	Blip.ar(InBus.ar(b, 2, index, \wrap)) * 0.1
14}.play;
15)
16::
17
18
19
20CLASSMETHODS::
21
22
23METHOD:: ar, kr
24Return a new instance with the respective rate. If the bus rate doesn't match the signal is converted. Multi channel arguments expand.
25
26ARGUMENT:: bus
27An instance of link::Classes/Bus::
28
29ARGUMENT:: numChannels
30Number of output channels
31
32ARGUMENT:: offset
33Offset to the starting index in the bus.
34
35ARGUMENT:: clip
36If clip is set to 'wrap', the indices into the bus will not be clipped to the last bus channel, but will wrap around.
37
38returns:: A UGen output, usually an array of UGens or, if the arguments are arrays, an array of arrays.
39
40
41INSTANCEMETHODS::
42
43
44EXAMPLES::
45
46code::
47(
48s.waitForBoot({
49	b = Bus.control(s, 3);
50	b.setn([1, 10, 100]);
51})
52)
53{ InBus.kr(b, 1, 0).poll(2, "val"); 0.0 }.play;
54{ InBus.kr(b, 1, 1).poll(2, "val"); 0.0 }.play;
55{ InBus.kr(b, 1, 2).poll(2, "val"); 0.0 }.play;
56{ InBus.kr(b, 1, 3).poll(2, "val"); 0.0 }.play;
57
58
59{ InBus.kr(b, 2, 0).poll(2, "val"); 0.0 }.play;
60{ InBus.kr(b, 3, 0).poll(2, "val"); 0.0 }.play;
61{ InBus.kr(b, 4, 0).poll(2, "val"); 0.0 }.play;
62
63{ InBus.kr(b, 3, 5).poll(2, "val"); 0.0 }.play;
64{ InBus.kr(b, 3, 5, \wrap).poll(2, "val"); 0.0 }.play;
65
66 InBus.kr(b, 2, [1, 3, 4]); // multi channel expansion
67
68{ InBus.kr(b, 1, MouseX.kr(0, 10).round.poll(2, "index")).poll(2, "val"); 0.0 }.play;
69{ InBus.kr(b, 2, MouseX.kr(0, 10).round.poll(2, "index")).postln.poll(2, "val"); 0.0 }.play;
70{ InBus.kr(b, 3, MouseX.kr(0, 10).round.poll(2, "index")).postln.poll(2, "val"); 0.0 }.play;
71{ InBus.kr(b, 4, MouseX.kr(0, 10).round.poll(2, "index")).postln.poll(2, "val"); 0.0 }.play;
72
73{ InBus.kr(b, 1, MouseX.kr(0, 10).round.poll(2, "index"), \wrap).poll(2, "val"); 0.0 }.play;
74{ InBus.kr(b, 2, MouseX.kr(0, 10).round.poll(2, "index"), \wrap).postln.poll(2, "val"); 0.0 }.play;
75{ InBus.kr(b, 3, MouseX.kr(0, 10).round.poll(2, "index"), \wrap).postln.poll(2, "val"); 0.0 }.play;
76{ InBus.kr(b, 4, MouseX.kr(0, 10).round.poll(2, "index"), \wrap).postln.poll(2, "val"); 0.0 }.play;
77
78::
79