Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add currentSettingsAsCompileString #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions classes/extNodeProxyDocument.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
+ NodeProxy {
accessStr { | envir |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling it accessString reads better, and we know that it is not a stream.

var accessStr = "a", nameStr, isAnon;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not "a ="?


envir = envir ? currentEnvironment;

nameStr = envir.use { this.asCompileString };
isAnon = nameStr.beginsWith("a = ");
if (isAnon.not) { accessStr = nameStr };

^accessStr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can drop the semicolon if you like.

}

currentSettingsAsCompileString {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settingsAsCompileString would be better. Settings are always current, just like any object.

Copy link
Contributor

@adcxyz adcxyz Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, I would propose settingsAsCode.
on N/P/Tdefs, asCompileString only posts the access string,
while asCode fully reconstructs the object.

Also for consistency, PatternProxy should have a settingsAsCode method.

And all asCode and settingsAsCode methods should allow passing in an accessString
that overrides the auto-generated (or guessed) ones, since users might know better.
I can try that here, or in a different PR.

2c, adc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please try :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!
Until this is finalized, you could do:

Ndef(\x, { LFSaw.ar(\freq.kr) }).set(\freq, 123);
Ndef(\x).nodeMap.asCode(Ndef(\x), true); 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, so wow; I was not aware of ProxyNodeMap:asCode, somehow...

so would

+ NodeProxy {
	settingsAsCode{|namestring, dropOut = true| 
		namestring = namestring ?? {this.asCompileString};
		^this.nodeMap.asCode(namestring, dropOut); 
}

do the trick?

^this.nodeMap.asCode(this.accessStr, true);
}

}