Hi All,
silly question, but I can’t seem to work out how to access values from multi-channel buses in a SynthDef.
s.boot;
(
// Create k-rate bus for parameter control
~midiBus = Bus.control(s, 10);
SynthDef.new(\busTest, {
arg cBus;
Out.ar([0, 1], SinOsc.ar(In.kr(cBus, 1).midicps, 0, mul: 0.5));
});
~p0 = Synth(\busTest, [\cBus: ~midiBus]);
// Connect all available MIDI interfaces
MIDIIn.connectAll;
// Mappings for X-Station (synth mode)
~paramCCs = (
72: (\desc: "Body SINE Level", \busIndex: 0),
73: (\desc: "Body TRIANGLE Level", \busIndex: 1),
74: (\desc: "Body SAWTOOTH Level", \busIndex: 2),
75: (\desc: "Body SQUARE Level", \busIndex: 3),
108: (\desc: "Body AMP Decay", \busIndex: 4),
109: (\desc: "Body AMP Curve", \busIndex: 5),
41: (\desc: "Body PITCH", \busIndex: 6),
110: (\desc: "Body PITCH Env Decay", \busIndex: 7),
111: (\desc: "Body PITCH Env Curve", \busIndex: 8),
44: (\desc: "Body PITCH Env Depth", \busIndex: 9),
);
// Match cc 127, all channels
MIDIdef.cc(\test3, {
arg val, cc, ch;
// Post current CC (debug)
//postln(cc);
if(~paramCCs[cc] !== nil, {
// Set value in 0 - 1 range to bus corresponding to CC number
~midiBus.setAt(~paramCCs[cc][\busIndex], val);
// Post value + description string
//postln(~paramCCs[cc][\desc] + ": " + val);
postln(~midiBus.getn);
});
}, (1..127), 0);
)
Seems to be working great, but I can’t seem to access the values in the other bus channels.
I tried
In.kr(cBus + 1, 1)
…assuming that cBus is just the lowest index of the bus channels, but this doesn’t seem to work.
How do I get to these other values?