Adding a ControlSpec for an Array inside of SynthDef

Is there a way to set a ControlSpec for an array inside of a SynthDef?

For example, this throws an error:

SynthDef(\specTest, { |test = #[0.1, 0.1]| test.spec = \amp.asSpec; Out.ar(0, test * SinOsc.ar(440)) }).add

// error message:
ERROR: Message 'spec_' not understood.
Perhaps you misspelled 'sect', or meant to call 'spec_' on another receiver?
RECEIVER:
Instance of Array {    (0x7fad18fc4b48, gc=1C, fmt=01, flg=00, set=02)
  indexed slots [2]
      0 : instance of OutputProxy (0x7fad0832ea18, size=11, set=4)
      1 : instance of OutputProxy (0x7fad19e285f8, size=11, set=4)
}
.....

This evaluates, and sees a spec, but throws an error when trying to makeWindow:

// this works
(
z = SynthDef(\specTest, { |test = #[0.1, 0.1]| test[0].spec = \amp.asSpec; Out.ar(0, test * SinOsc.ar(440)) }).add;
z.specs // -> ( 'test': a ControlSpec(0, 1, 'amp', 0, 0, "") )
)
// this doesn't
SynthDescLib.global.at(\specTest).makeWindow

// error message:
ERROR: Message 'isNaN' not understood.
Perhaps you misspelled 'isNil', or meant to call 'isNaN' on another receiver?
RECEIVER:
Instance of Array {    (0x7fad29549448, gc=20, fmt=01, flg=00, set=02)
  indexed slots [2]
      0 : Float 0.100000   9999999A 3FB99999
      1 : Float 0.100000   9999999A 3FB99999
}
......

This gives an error, though does seem to compile the SynthDef, but it still doesn’t work:

(
z = SynthDef(\specTest, { |test = #[0.1, 0.1]|
    test[0].spec = \amp.asSpec;
    test[1].spec = \amp.asSpec;
    Out.ar(0, test * SinOsc.ar(440))
}).add;
)
// post window:
ERROR: Cannot set spec on a non-Control
-> SynthDef:specTest
//////

// evaluating this:
z.specs
-> ( 'test': a ControlSpec(0, 1, 'amp', 0, 0, "") )


// this errors out in the same way as the previous example:
SynthDescLib.global.at(\specTest).makeWindow

edit:
this also doesn’t work:

(
z = SynthDef(\specTest, { |test = #[0.1, 0.1]|
	test.spec = [\amp.asSpec, \amp.asSpec]; 
	Out.ar(0, test * SinOsc.ar(440)) 
}).add
)
// ERROR: Message 'spec_' not understood.

SynthDef array arguments were a later development in SC. Hence, much of this is not supported. To my knowledge, e.g., from the main gui variants including quark extensions, only VarGui from miSCellaneous_lib supports array args for sliders (Luckily, I was late. So it was also a motivation to integrate it. Probably I wouldn’t have extended it from a non-array version. Exceptions for array args are a troublemaker …).

(
SynthDef(\specTest, { |amps = #[0.1, 0.1]|
	Out.ar(0, amps * SinOsc.ar(440))
}, metadata: (
	specs: (
		amps: [0, 1, \db, 0, 0.1]
	)
)
).add
)

// a) VarGui ordinary syntax

// same spec for both indices

VarGui(synth: \specTest).gui

// specify spec per index

(
VarGui(
	synthCtr: [\amps, { |i| [0, 1, \db, 0, 0.1 * (i+1)] } ! 2],
	synth: \specTest
).gui
)



// b) VarGui shortcut syntax (see separate helpfile)

// same spec for both indices

\specTest.sVarGui.gui

// specify spec per index

\specTest.sVarGui(ctrReplace: [\amps, { |i| [0, 1, \db, 0, 0.1 * (i+1)] } ! 2] ).gui


I also found this behavior:

Spec.add(\test, [0, 1, \amp]);
e = (test: [0.5, 0.5]);
EnvirGui(e);

e

Which seems to create a RangeSlider. If there was a way to invert the range between the two indices, and/or easily slide it when the range is very narrow it could nearly work as well.

I’ll dig in to VarGui though. It seems like the thing. Thanks very much!