Kill running patterns without a pointer

Let’s say I play a Pmono pattern without taking a pointer to the EventStremPlayer p.play. There is no way to do a r.stop. So I free the nodes with s.defaultGroup.deepFree or whatever the Pmono gives errors because it is referring to nodes that don’t exist any more,…
And there are plenty of use cases to get in that situation.

So my question is : is there a command to kill some/all running patterns similar to the “Ctrl+.” for the server nodes, even when you don’t have a pointer anymore ?

The command called when you hit ctrl+. is CmdPeriod.run.

If you are wondering, all running patterns or tasks are scheduled on a clock. CmodPeriod.run has code that clear all the clocks, but you can also do it manually for example with TempoClock which is the clock used by patterns:

TempoClock.default.clear;

You can also play patterns on multiple TempoClocks if you want to kill some but keep others running

 a=TempoClock.new();
Pbind(\note,1). play (clock:a);
Pbind(\dur,0.101,\note,2).play(clock:a);
a.tempo_(2);\\both change
a.clear \\kills both
1 Like