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

Re: [Sc-devel] SCScope changed?




On 2 Feb 2008, at 23:33, Jan Trutzschler wrote:

Hi Thor,
there is an error in your code:
you are using
SCScope(...).bufnum_(b);

but should be

SCScope(...).bufnum_(b.bufnum)

Yes I discovered this.

I thought b and b.bufnum had become equivalent use, but I remember
now that Scott talked about an exception where one would have to pass
the buffer number.

Cheers
thor



the code below works fine.
best,
Jan

(
s = Server.internal;
s.waitForBoot({
	var sc;
	b = Buffer.alloc(s,2048,2);
	a = SynthDef(\scopeExample, { arg freq=400, rate=2, amp=0.4, pan=0;
		var signal;
		signal = [LFSaw.ar(freq, 0, amp/2)*SinOsc.ar(rate),
				Pulse.ar( freq, 0.51, amp)*SinOsc.ar(rate)];
		signal = Balance2.ar(signal[0], signal[1], pan);
		ScopeOut.ar( signal, b);
		Out.ar(0, signal);
	}).play(s);
	
	w = SCWindow.new("scope in a gui", Rect(100, 400, 400, 300))
		.onClose_({a.free;}) // free synth on closing window
		.front;

	SCMultiSliderView(w, Rect(10, 10, 90, 120))
		.value_([0.4, 0.5, 0.6, 0.5])
		.indexIsHorizontal_(false)
		.isFilled_(true)
		.strokeColor_(Color.new255(10, 55, 10))
		.fillColor_(Color.new255(110, 155, 110).alpha_(0.6))
		.indexThumbSize_(26)
		.gap_(4)
		.valueThumbSize_(1)
		.action_({|sl|
			sl.index.switch
				{0} { a.set(\freq, 400+(sl.value[sl.index]*400)) }
				{1} { a.set(\rate, (sl.value[sl.index]*10)) }
				{2} { a.set(\amp, sl.value[sl.index]) }
				{3} { a.set(\pan, (sl.value[sl.index]*2)-1) };
		});
	
	SCStaticText(w, Rect(10, 0, 90, 140))
		.string_(" Freq \n\n Rate \n\n Amp \n\n Pan");

	SCStaticText(w, Rect(10, 140, 90, 16))
		.string_("xZoom:");

	SCSlider(w, Rect(10, 160, 90, 16))
		.action_({|sl| sc.xZoom_(sl.value*4)});

	sc = SCScope(w, Rect(120,10,260,260))
		.bufnum_(b.bufnum)
		.background_(Color.white)
		.waveColors_([Color.black, Color.black]);
});
)

On Jan 28, 2008, at 11:20 PM, thor wrote:


Hi all

Has something changed recently in SCScope?

This is an example I made for SCScope that used to have white
background
and black waves.

The xZoom_ does not work either.

Any ideas?

thor


(
s = Server.internal;
s.waitForBoot({
	var sc;
	b = Buffer.alloc(s,2048,2);
	a = SynthDef(\scopeExample, { arg freq=400, rate=2, amp=0.4, pan=0;
		var signal;
		signal = [LFSaw.ar(freq, 0, amp/2)*SinOsc.ar(rate),
				Pulse.ar( freq, 0.51, amp)*SinOsc.ar(rate)];
		signal = Balance2.ar(signal[0], signal[1], pan);
		ScopeOut.ar( signal, b);
		Out.ar(0, signal);
	}).play(s);
	
	w = SCWindow.new("scope in a gui", Rect(100, 400, 400, 300))
		.onClose_({a.free;}) // free synth on closing window
		.front;

	SCMultiSliderView(w, Rect(10, 10, 90, 120))
		.value_([0.4, 0.5, 0.6, 0.5])
		.indexIsHorizontal_(false)
		.isFilled_(true)
		.strokeColor_(Color.new255(10, 55, 10))
		.fillColor_(Color.new255(110, 155, 110).alpha_(0.6))
		.indexThumbSize_(26)
		.gap_(4)
		.valueThumbSize_(1)
		.action_({|sl|
			sl.index.switch
				{0} { a.set(\freq, 400+(sl.value[sl.index]*400)) }
				{1} { a.set(\rate, (sl.value[sl.index]*10)) }
				{2} { a.set(\amp, sl.value[sl.index]) }
				{3} { a.set(\pan, (sl.value[sl.index]*2)-1) };
		});
	
	SCStaticText(w, Rect(10, 0, 90, 140))
		.string_(" Freq \n\n Rate \n\n Amp \n\n Pan");

	SCStaticText(w, Rect(10, 140, 90, 16))
		.string_("xZoom:");

	SCSlider(w, Rect(10, 160, 90, 16))
		.action_({|sl| sc.xZoom_(sl.value*4)});

	sc = SCScope(w, Rect(120,10,260,260))
		.bufnum_(b)
		.background_(Color.white)
		.waveColors_([Color.black, Color.black]);
});
)


_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel

_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel