View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

avoid clicks in Shaper with HarmonicsDialog

(
var v1,v2,w,z,h, plug;
v1 = Wavetable.chebyFill(512, #[1,0]);
v2 = v1.copy;
w = GUIWindow.new("wavetable", Rect.newBy(10, 372, 300, 250));
z = WavetableView.new(w, Rect.newBy(8,8,280,200), v2).hElastic.vElastic;
h = HarmonicsDialog.new(v2);
Updater(v2,{ plug.gate(1, 0.1);  });

Synth.play({
	plug = Plug.kr(0,0);
	TrigXFade.ar({ arg spawn, i, synth;
		v1 = v2.copy;
		Shaper.ar(v1, SinOsc.ar(220, 0, 0.5));
	}, plug);
});

w.close;
h.close;

)


//this needs a modified Updater class (crucial lib):
Updater {

	var <>model,<>refreshFunc;

	*new { arg model,refreshFunc,layoutOfView;

	^super.new.model_(model).refreshFunc_(refreshFunc).init(layoutOfView)
	}

	init {arg layoutOfView;
		model.addDependant(this);
		// when the layout closes, we need to break the dependancy
		// so the GC troll can drag off the corpse
		if(layoutOfView.notNil, {layoutOfView.autorelease(this) });
	}

	update { arg ... args;
		refreshFunc.valueArray(args)
	}
	remove {
		model.removeDependant(this);
	}

}
***
/*
authors so far:

andrew hayleck
jrh
*/
//sc2 code


Link to this Page