I think it should follow normal scope rules, i.e. local first. So:
1 NamedControl or addSpec (I think these should be treated as equivalent in precedence, so if you supply a spec for a NamedControl that replaces a previous spec added by either method ) 2 [Maybe intermediate levels?] 3 Global Specs Dict 4 Guess
This seems least surprising to me. (At 3 we might actually improve the heuristics a bit, i.e. freq2 could reasonably be matched with \freq assuming the val is within range, though of course that’s not a JITLib issue!) 1 answers the question of what happens when source is redefined. In keeping with existing practice though, I think it shouldn’t change the value unless it’s now outside the spec range?
What do you think?
Makes sense - so for clarity, any spec given in an internal NamedControl always also gets put into addSpec (Halo)?
I think so. Will this be dependant on JITLibExtensions btw? Would be nice to have it in core.
This only gets weird when people use both addSpec and \ param.kr(spec: ) constructions; then the latest one decides, which is fine I guess.
/// quick code sketch for trying out how this feels:
// ---------- extFindSpec.sc :
+ AbstractPlayControl { findSpec { ^nil } } + SynthDefControl { findSpec { |paramKey| var specs = synthDef.metadata[\specs]; if (specs.isNil) { ^nil }; ^specs[paramKey] } }
+ NodeProxy { findSpec { |paramKey| var spec; this.objects.do { |obj| spec = obj.findSpec(paramKey); if (spec.notNil) { ^spec } }; ^spec }
// does not put this in addSpec yet, // does not work for gui yet! getSpec { ^this.getSpec ?? { this.findSpec } } } // ----------
Ndef('a', Pbind()).play;
Ndef('a', Pbind(\degree, Pbrown(0, 14, 3), \dur, 0.25)).play;
Ndef('a').put(5, \filter -> { |in| var decay = \ decay.kr(3, spec: [1, 100, \exp]); [0.08333, 0.1667], decay ) });
Ndef('a').findSpec(\decay); // finds spec Ndef('a').findSpec(\nope); // nil
Nice. NdefGui doesn’t pick it up for me though?
///// noticed a bug: ///// when jumping to spec arg, this works Ndef(\x, { x = \ coef.kr(0, spec: [-0.99, 0.99]); }); // specs exist Ndef('x').objects[0].synthDef.metadata
Ndef(\x, { x = \ coef.kr(0, lag: 1, spec: [-0.99, 0.99]); }); // now they don't: why? Ndef('x').objects[0].synthDef.metadata
Super odd! I’m guessing perhaps to do with the fact that the latter produces a LagControl rather than a Control?
S.
|