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

NamedControl.new() returns single-element array of Lags when it should return a Lag #973

Closed
totalgee opened this issue Oct 8, 2013 · 3 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
Milestone

Comments

@totalgee
Copy link
Contributor

totalgee commented Oct 8, 2013

See this thread for more details. Basically, when using NamedControls with a single lag value in a SynthDef, the Control unexpectedly returns an array.

e.g.

{NamedControl.new('freq', 440, \control).postln}.asSynthDef; ""
// --> an OutputProxy
{NamedControl.new('freq', 440, \control, 1).postln}.asSynthDef; ""
// --> [ a Lag ]  // (why return an Array?)

This causes confusion and "special case" handling when using NamedControls, for example in the following case with Pan2:

{ var sig = Pan2.ar(SinOsc.ar(440, 0, 0.1), \pan.kr(0, 0.1)); sig.poll(1) }.play
// --> UGen Array [0]: 0.00442991
// --> UGen Array [0]: 0.00442991

but we would expect a result like this (note we need to add [0] to the Control, to get it out of the unexpected array:

{ var sig = Pan2.ar(SinOsc.ar(440, 0, 0.1), \pan.kr(0, 0.1)[0]); sig.poll(1) }.play
// --> UGen Array [0]: 0.00442991
// --> UGen Array [1]: 0.00442991
@totalgee
Copy link
Contributor Author

totalgee commented Oct 8, 2013

I just submitted a pull request that fixes this, unless there are any expert objections on the list...

@totalgee
Copy link
Contributor Author

totalgee commented Oct 8, 2013

Julian, you're right, I tested with the current "master" code (before my fix), and the problem wasn't there (I found the bug while using 3.6.5, where there is no unbubble). unbubble does exactly what's needed, and it seems this line has been "fixed" at several moments in the Git history.

So my fix isn't strictly needed, though the removal of the extra "asArray" probably isn't harmful. it's up to you to pull it or skip it.

@scztt scztt added the bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. label Mar 15, 2015
@scztt scztt added this to the 3.7 milestone Mar 15, 2015
@scztt
Copy link
Contributor

scztt commented Mar 15, 2015

pr was merged, so I think it's okay to close this.

@scztt scztt closed this as completed Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs.
Projects
None yet
Development

No branches or pull requests

2 participants