prko
March 7, 2024, 12:35pm
1
Hi there,
I made a PR to add an extra argument to define the window position for s.scope:
supercollider:develop
← prko:topic/add_position_to_scope
opened 05:05AM - 06 Mar 24 UTC
## Purpose and Motivation
`.scope` has no argument to define its window locatio… n. Often it is good to see this window on the centre of the screen, but sometimes it is not so optical.
This modification adds one more argument for this feature. Thus, the following code is available (I intentionally paste all code to present the necessity of this feature):
```
(
Window.closeAll;
s.waitForBoot {
var sigs = {
[
SinOsc.ar(440),
(SinOsc.ar(440 * (1..48)) * (1..48).reciprocal / 16).sum,
Resonz.ar(Resonz.ar(WhiteNoise.ar, 440, 0.1, 5), 440, 0.2, 5),
Resonz.ar(
Resonz.ar(WhiteNoise.ar, 440 * (1..48), 0.2, 5),
440 * (1..48), 0.2, (1..48).reciprocal
).sum,
WhiteNoise.ar
] * Env.perc(0.01, 0.79, 0.2).ar(Done.freeSelf)
};
FreqScope();
sigs.().size.do { |i|
{ sigs.()[i] ! 2 }.scope(position: 605@0); // <- look at this!
{ sigs.()[i] }.plot(0.04, bounds:Rect(230 * i, 355 + 175, 230, 150));
{ sigs.()[i] }.plot(1, bounds:Rect(230 * i, 355, 230, 150));
2.wait
}
}
)
```
demo video:
https://www.dropbox.com/scl/fi/qj0337im08mqyzcj2k4fx/Screen-Recording-2024-03-06-at-14.03.44.mov?rlkey=k82z5kwoi2w0nj23sy56nfxht&dl=0
## Types of changes
- Documentation
- New feature
## To-do list
- [x] Code is tested
- [x] All tests are passing
- [x] Updated documentation
- [x] This PR is ready for review
Would adding the same to s.meter
, s.plotTree
, s.freqscope
be useful for many users? For me, it seems to be useful…
4 Likes
Yes that would be very useful. Would it also be an idea to include a window/view argument which defaults to nil but if specified would allow these windows to appear inside a user defined window or view?
3 Likes
prko
March 8, 2024, 4:20am
3
I did this for s.meter
, s.plotTree
, but left s.freqscope
as it is:
supercollider:develop
← prko:topic/add_position_to_scope
@mtmccrea
Thanks! I fixed all the problems!
I also did the same for Server … plotTree and Server meter. However, I am not sure if I should upload these changes here or make two other separate PRs.
https://www.dropbox.com/scl/fi/6wzqzldir2kebqjx5jx20/SC-bounds-added-for-plotTree-scope-and-meter.mov?rlkey=8rpxmwrz1et6659e59zrl1fe9&dl=0
I am not sure if I should add the changes for s.meter
and s.plotTree
to the PR above or separately as some of them are in the same source files.
A demo video is included in the article above.
prko
March 8, 2024, 5:11am
4
I think there are corresponding classes for each method to do what you mention, except for the .plotTree
method:
.meter
: ServerMeterView
.freqscope
: FreqScopeView
.scope
: ScopeView | SuperCollider 3.12.2 Help
.plotTree
: no corresponding Class, I believe. Previously, I did the following thing to change window bounds:(
s.plotTree;
Window.allWindows.do{ |win| if (win.name == "localhost Node Tree") { win.bounds = Rect(0, 0, 300, 800) }
}
)
1 Like
prko
March 9, 2024, 3:16am
5
I also added bounds
argument to the plotTree
method in the same PR. I am not sure which of the following is better for the `.meter’ method because the size of a meter is calculated automatically:
the argument `bounds
the argument point
.
I prefer point
, but would like to know what other users think.
supercollider:develop
← prko:topic/add_position_to_scope
The `bounds` argument has also been added to the `.plotTree` method.
The size… of `s.meter` is automatically calculated by the number of input and output channels. So I think it would be better to give a point argument instead of bounds. However, I will wait for a response from other contributors for a few days. @mtmccrea What do you think?
1 Like