I’m using .fork with Pdef instead of .play, to create multiple layers.
Is there a way to query the value of the ‘key’ of a Pdef instantiated in this way?
If we do a=Pdef(\myPattern).play, then a.key returns the key, ‘myPattern’. But if I do a=Pdef(\myPattern).fork, a.key returns ‘an EventStreamPlayer’.
I’m sure I’m misunderstanding the relation between Pdef and EventStreamPlayer and what is actually going on here, but if anyone has a solution that’d be great!
Yeah I knew that about Pdef, but wanted to use .fork to kind of spawn multiple instances.
It works, but I can’t now stop that forked Pdef with a.stop.
Maybe I need to find a different way. I was wanting to have an array of instances of Pdefs randomly allocated, then query which ones were which in the array. Maybe I need to use Pspawn.
a=List[]
a.add(Pdef(\ttt).fork) // do a bunch of times
a.do(_.stop) //stops them all
FWIW this works:
a=Pdef(\ttt).fork // a points to an EventStreamPlayer
a.stop // call stop on EventStreamPlayer to stop it
when you evaluate that first line a bunch of times though you lose any reference to the earlier EventStreamPlayers - which is why I suggested storing them in a List