I’ve tried to do a simplified version of
which would not register an event type but use \finish
instead. Alas it doesn’t seem to work: \set
doesn’t seem to see the id
set, even though I can read it later in the callback. Any ideas why (neither of these) works properly?
// Make a dummy Ndef for testing
(Ndef(\jpjp, {|a1, a2|
[a1, a2].poll(0.5);
}))
(Pbind(
\type, \set,
\ndef, \jpjp,
\finish, { ~id = Ndef(~ndef).group.nodeID; ~id.postln },
\a1, Pwhite(0.0,1.0, 3),
\a2, Pwhite(0.0,1.0),
\callback, { (~id.asString + "called back" + Main.elapsedTime).postln }
).play;) // doesn't set
Output like
-> Ndef('jpjp')
UGen Array [0]: 0
UGen Array [1]: 0
UGen Array [0]: 0
UGen Array [1]: 0
-> an EventStreamPlayer
1077
1077 called back 174952.1678335
UGen Array [0]: 0
UGen Array [1]: 0
1077
1077 called back 174953.16815606
1077
1077 called back 174954.16821785
UGen Array [0]: 0
UGen Array [1]: 0
The id clearly gets set, but that doesn’t actually seem to influence the actual \set
event… Any ideas why this doesn’t work?
Also, I’ve tried:
(Pbind(
\type, \set,
\ndef, \jpjp,
\finish, { |ev| ev.id = Ndef(~ndef).group.nodeID; ev.id.postln }, // still not set in the actual event!
\a1, Pwhite(0.0,1.0, 4),
\a2, Pwhite(0.0,1.0),
\callback, { |ev| (ev.id.asString + "called back" + Main.elapsedTime).postln }
).play;)
but it doesn’t work either.