3 var <>key, <>value, <>busNumChannels, <>isMultiChannel=false, <>isMapped=false, <>mappedRate;
5 *new { arg key, value, busNumChannels;
6 ^super.newCopyArgs(key, value, busNumChannels)
11 isMultiChannel = false;
15 mapn { arg index, numChannels;
17 busNumChannels = numChannels;
18 isMultiChannel = true;
25 mapan { arg index, numChannels;
26 this.map(index, numChannels);
32 isMultiChannel = val.isSequenceableCollection;
34 getValue { // unmapped, single channel only
35 ^if(this.isMapped.not and: { this.isMultiChannel.not }) { value } { nil }
38 addToEvent { arg event;
41 mapPrefix = if(mappedRate === \audio) { "a" } { "c" };
42 event.put(key, { |i| mapPrefix ++ (i + this.index) }.dup(busNumChannels))
49 updateNodeMap { arg nodeMap;
51 if(this.isNeutral) { nodeMap.upToDate = false; ^this }; // ignore setting
52 this.updateBusNumChannels;
54 if(mappedRate === \audio) {
55 nodeMap.mapanArgs = nodeMap.mapanArgs.addAll([key,this.index,busNumChannels])
57 nodeMap.mapnArgs = nodeMap.mapnArgs.addAll([key, this.index, busNumChannels])
60 if(mappedRate === \audio) {
61 nodeMap.mapaArgs = nodeMap.mapaArgs.addAll([key, this.index]);
63 nodeMap.mapArgs = nodeMap.mapArgs.addAll([key, this.index]);
69 nodeMap.setnArgs = nodeMap.setnArgs.addAll([key, value.size]++value)
71 nodeMap.setArgs = nodeMap.setArgs.addAll([key, value])
78 ^this.class.prNew(key, value, busNumChannels, isMultiChannel, isMapped, mappedRate)
81 isEmpty { ^value.isNil }
84 updateBusNumChannels {}
86 storeArgs { ^[key, value, busNumChannels] }
89 stream << this.storeArgs
92 *prNew { arg key, value, busNumChannels, isMultiChannel=false, isMapped=false, mappedRate;
93 ^super.newCopyArgs(key, value, busNumChannels, isMultiChannel, isMapped, mappedRate)
98 ProxyNodeMapSetting : NodeMapSetting {
99 var <>rate; // rate is the synthDef "rate" arg, value is a proxy !
101 index { ^value.index }
103 ^value.isNil and: { rate.isNil }
109 // stays neutral if both mappedRate, busNumChannels are nil
110 if(proxy.isNeutral) { proxy.initBus(mappedRate, busNumChannels) }; // could add a test
111 busNumChannels = proxy.numChannels;
112 busNumChannels !? { isMultiChannel = busNumChannels > 1 };
113 mappedRate = proxy.rate; // here we determine the rate simply from the input proxy
116 isNeutral { ^value.isNeutral }
117 storeArgs { ^[value, busNumChannels, rate] }
118 updateBusNumChannels {
119 if(isMultiChannel and: { busNumChannels.isNil }) {
120 busNumChannels = value.numChannels;