« Return to Thread: [approve, 3.3] Node:map backward compat fix
What do the rest of you think? Does this warrant a new RC if this is the only change?JoshOn Apr 23, 2009, at 8:24 PM, James Harkins wrote:in Node.sc, right?yes it appears to work..thank you~OK to check in then?Sorry I didn't catch this earlier - if I realized compatibility would be broken on a basic feature, I would have spoken up before RC. I feel rather strongly we should not let 3.3 go out losing backward compat on what was, in 3.2, normal and expected usage (especially since the fix is simple and wouldn't break anything else).Corner case: no arguments supplied. Should it fail with error on "bundle[0].isString" or fail silently?aSynth.map; // die, or no-op?Actually better -- bus = bus.asBus -- to allow polymorphic substitution. Then we wouldn't need the scalar branch, I think. (I just realized, in current svn, the usage "aSynth.map(\anArg, aGenericGlobalControl)" got broken [GenericGlobalControl is in my lib], where it would have worked in 3.3 betas. GenericGlobalControl can masquerade as a Bus using asBus, so this would fix that case.)map { arg ... args;var bundle = this.mapMsg(*args);if(bundle[0].isString) {server.sendBundle(nil, bundle);} {server.sendBundle(nil, *bundle);};}mapMsg { arg ... args;var krVals, arVals, result;krVals = List.new;arVals = List.new;result = Array.new(2);args.pairsDo({ arg control, bus;bus = bus.asBus;switch(bus.rate){ \control } {krVals.addAll([control.asControlInput, bus.index, bus.numChannels])}// maybe we don't need this anymore// { \scalar } {// if(bus.isNumber) { krVals.addAll([control.asControlInput, bus, 1]) };// }{ \audio } {arVals.addAll([control.asControlInput, bus.index, bus.numChannels]);};// no default case, ignore others});if(krVals.size > 0, { result = result.add(["/n_mapn", nodeID] ++ krVals) });if(arVals.size > 0, { result = result.add(["/n_mapan",nodeID] ++ arVals) });if(result.size < 2, { result = result.flatten; });^result;}hjh
: H. James Harkins.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:"Come said the Muse,Sing me a song no poet has yet chanted,Sing me the universal." -- Whitman******************************************/* Joshua D. Parmenter“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono*/
« Return to Thread: [approve, 3.3] Node:map backward compat fix
| Free embeddable forum powered by Nabble | Forum Help |