Hi all,
I am currently trying to recall a collection of event values and convert them into a Pbindef. I'm using a simple class that Daniel Mayer put together a few years ago, but I don't think it's been integrated into SC yet. This is a shame, since it is an extremely useful class! I'll share the class and code at the bottom of the message.
If anyone could help me, it would be greatly appreciated - I've been beating my head against the wall for many hours on this.
Essentially, I get an error on the first evaluation, but on the second evaluation, it seems to execute as expected:
ERROR: Primitive '_IdentDict_Put' failed.
Wrong type.
RECEIVER:
This is the code:
(
~patt = "( 'sus': Pwhite(0.5, 0.8), 'rel': Pwhite(0.01, 0.3), 'degree': Pseq([ 0, 2, 3, 4 ], inf), 'dur': Pseq([ 0.2 ], inf),
'octave': Prand([ 5 ], inf), 'dec': Pseq([ 0, 2, 3, 4 ], inf), 'instrument': 'nil')";
~patt = ~patt.interpret;
~patt = ~patt.array;
~finalPatt = {|m| ~patt};
);
(
n = Pbindef(\d, *~finalPatt.());
e = PbindefEvent(n);
);
This is the class:
PbindefEvent : Event {
var <>pbindef;
*new { |pbindef| ^super.new.pbindef_(pbindef).initPbindefEvent }
initPbindefEvent {
var e =
pbindef.source.pairs.as(Event);
e.keysValuesChange { |k,v| v.pattern };
^this.putAll(e)
}
put { |k,v|
Pbindef(pbindef.key, k, v);
^this.superPerform(\put, k, v);
}
}