[sc-users] changing ugen with SCPopUpMenu

kukumi kokumii at fastmail.fm
Fri Jul 27 01:55:12 PDT 2007


hi people, im new with supercollider, im trying to change the ugen of a
synthdef with gui using scpopmenu

what i want to do is something like this:

	SynthDef(\holii, {arg freq=333, oso="SinOsc" ,amp= 0.9, pan=0.0 ;
var signal, env;
signal= oso.ar(freq, 0, amp) ;
signal= Pan2.ar(signal, pan) ;
Out.ar(0,signal);
}).load(s);



and then change oso variable with other ugen using the scpopupmenu:



var lb, sbsb,win;


	win = SCWindow("sonificol",Rect(192, 256, 1000, 390));
		win.view.background = Color(0.2,0.0,0.7);
	
	win.front;
	
	lb = [
	"saw","grain" , "sine" ,"noise"
	];
	sbsb = SCPopUpMenu(win,Rect(400,140,120,20));
	sbsb.items = lb;
	sbsb.background_(Color.white);
	sbsb.action = { arg sbs;
		[sbs.value, lb.at(sbs.value)].postln;	// .value returns the integer
		
			
if (sbs.value == 0 ,{
oso = SinOsc;

};);

if (sbs.value ==1 ,{ "uno".postln;
oso = Saw;
});             
	};




what am i doing wrong?
how can i make it work?

many thanks
-- 
  kukumi
  kokumii at fastmail.fm

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own



More information about the sc-users mailing list