[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] [approve] Instr-wrap and default overrides in Patch



I've been threatening to commit this for quite some time, and after just doing a fresh checkout and spending a good 45 minutes merging the changes in by hand, I'm motivated to get these changes checked in properly.

1. The main thing is the ability to wrap Instr's like you can wrap synthdefs, so that unassigned inputs get promoted into patch arguments. It helps me along with a modular construction of synths. I have been using this code for a good year and half now and I'm not aware of any remaining bugs. If you don't use the wrapping method, it doesn't change the behavior of Instr / Patch.

2. Small change to Instr:new -- so that the Instr name is always symbolized when it's stored in the library.

name = this.symbolizeName(name);
previous = Library.atList(name.addFirst(Instr));

3. Allowing a reference to a number to create a control based on the arg's spec rather than a hard coded number. For instance,

Instr("something", { |freq|
SinOsc.ar(freq)
}, [\freq]);

p = Patch("something");  // default freq = 440, defined in spec
p = Patch("something", [880]);  // freq is now fixed at 880 always
p = Patch("something", [KrNumberEditor(880, \freq)]);  // still a frequency control, but default for synthdef is 880

This change allows a shortcut syntax for the third patch.

p = Patch("something", [`880]);  // same as KrNumberEditor using the spec defined in the Instr

Okay to commit? Updated files and diff are at http://www.dewdrop-world.net/sc3/Instr-wrap.zip
James


: H. James Harkins

: jamshark70@xxxxxxxxxxxxxxxxx

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman