Setting IEnvGen's env on Synth creation

Hello everyone!

I was having a play with the IEnvGen class but I ran into this problem. If I try to set the envelope on Synth instantiation, the server crashes.

(
s.waitForBoot({
	SynthDef(\testIEnvGen, {
		var env = \env.kr(Env.newClear(2).asArray);
		Out.ar(0, IEnvGen.ar(env, LFSaw.ar(1).range(0, 1) * \envTimesSum.kr(1)))
	}).add;
	
	s.sync;
	
	~env = Env([0, 1], 1);
	a = Synth(\testIEnvGen, [\env, ~env, \envTimesSum, ~env.times.sum]);
})
)

Is there a way to set the env without having to include it in the SynthDef, as it’s possible with EnvGen?

For anyone coming across this, the solution is to actually run the conversions that convertEnv would do inside of the IEnvGen's constructor manually. Perhaps, this can be extended directly as a method for IEnvGen:

(
s.waitForBoot({
	SynthDef(\testIEnvGen, {
		var env = \env.kr(Env.newClear(2).asArray);
		Out.ar(0, IEnvGen.ar(env, LFSaw.ar(1).range(0, 1) * \envTimesSum.kr(1)))
	}).add;
	
	s.sync;
	
	~env = Env([0, 1], 1);
	a = Synth(\testIEnvGen, [\env, ~env.asArrayForInterpolation.collect(_.reference).unbubble, \envTimesSum, ~env.times.sum]);
})
)