Hi list,
just a quick one: Is the default clock for {}.fork TempoClock.default?
This is not entirely clear from the docs to me.
thanks!
Peter
Hi list,
just a quick one: Is the default clock for {}.fork TempoClock.default?
This is not entirely clear from the docs to me.
thanks!
Peter
You need (just a little bit) detective work here.
First, with the cursor in the work “fork” hit cmd-i (or ctrl-i) and you get something like this:
Because a default argument is not defined anywhere here, it must be in Routine. Hit cmd-i on “play” and you get this horribly long list, and knowing that Routine is a Stream, you find this:
So the answer is TempoClock.default
.
But if you don’t already know which play
method it will be in, this is tricky!
For that, you can use an inspection method:
Routine.findRespondingMethodFor(\play); // returns -> Stream:play
Then you can select “Stream:play” and again hit cmd-i.
The idea of a primary class browser where all the detective work could take place never took over sc?
Thanks Julian for this nice and detailed description of solving similar
questions by myself in the future!
Oh, note that screenshots are not forwarded to recipients of this list in
email mode (like me).
all the best,
Peter
There is a searchable class browser, though it doesn’t show everything for this question. Features could be added to it if someone has the time or inclination. Finding both of those is the tricky part, isn’t it.
hjh
Here is an interesting dicovery: when you write
Routine:play
select it, and then hit cmd-i it finds the responding method (Stream::play).
Curious: Some people are reviving ideas, including this for vscode inspired by SmallTalk’s Class Browser.
https://www.reddit.com/r/vscode/comments/w4afh5/extension_class_browser_in_vscode_inspired_by/
Maybe we’ll come full circle, and the SuperCollider vscode plugins will use some of this work. The prophecy would be fulfilled with SC3 with an IDE experience closer to the Smalltalk environment. ))
// we could make a shortcut that finds it, a bit hacky, but maybe it works …
(
f = { |str|
var classi, i, classname, methodname, class;
i = str.detectIndex { |c| c.isUpper };
if(i.notNil) {
str = str[i..];
i = str.detectIndex { |c| c.isAlphaNum.not } ?? { str.lastIndex };
classname = str[..i-1];
i = str.find(".");
if(i.notNil) {
i = i + 1;
if(str[i] == $() { methodname = "value" };
str = str[i..];
str.postln;
i = str.detectIndex { |c| c.isAlphaNum.not } ?? { str.lastIndex };
methodname = str[..i-1];
};
};
[classname, methodname].join(":")
};
f.(" ^Routine(this, stackSize).play(clock, quant);")
)
It works! Well done, very useful. It looks like an emacs function; except you can’t set the keybinding with the code. Maybe there should be a way to do it.
Should be possible using MainMenu
?