[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] [BUG] bugs with n_setn and s_getn?




1) Node.setn does not work with integer control indices

in Node.sc i found

args.pairsDo({ arg control, moreVals;
nargs.addAll([control.asSymbol, moreVals.size, moreVals].flat)});

control.asSymbol makes a symbol out of every input, which makes it
impossible to get an integer argument into the osc message by this
method.

I had a temporary workaround which is too ugly to post it here, but
I talked to Julian who will find a solution for a .flat-message which
does not flatten a string.


my take on this would be:

===================================================================
--- Node.sc     (revision 6742)
+++ Node.sc     (working copy)
@@ -90,9 +90,9 @@
                var nargs;
                args = args.asUGenInput;
                nargs = List.new;
-               args.pairsDo({ arg control, moreVals;
- nargs.addAll([control.asSymbol, moreVals.size, moreVals].flat)}
-               );
+               args.pairsDo { arg control, moreVals;
+ nargs.addAll([control, moreVals.size, moreVals].flatIf { |x| x.isString.not })
+               };
                ^[16, nodeID] ++ nargs;
                        // "n_setn"
        }

===================================================================
--- SequenceableCollection.sc   (revision 6742)
+++ SequenceableCollection.sc   (working copy)
@@ -371,6 +371,19 @@
                });
                ^list
        }
+
+       flatIf { arg func;
+               var list;
+               list = this.species.new;
+               this.do({ arg item, i;
+ if (item.respondsTo('flat') and: { func.value(item, i) }, {
+                               list = list.addAll(item.flat);
+                       },{
+                               list = list.add(item);
+                       });
+               });
+               ^list
+       }

--





.