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

Re: [Sc-devel] SwingOSC v0.57 beta



also i think getn should call getnMsg ; that way the count argument would also get the missing default value of this.numChannels ...

ciao, -sciss-

Am 25.11.2007 um 22:24 schrieb Sciss:

another appetizer for the near future ;_)

s.boot;

(
var win, ggMeter, meterBus, meterSynth, resp, cond, rout, def, dt, trigSpeed = 0.03;
	
	win = JSCWindow( "Meter", Rect.new( 400, 400, 128, 220 ), false );
		
	def = SynthDef( "eisk-meter", { arg i_aInBs = 0, i_kOtBs, t_trig;
		var in, rms, peak;
		
		in	= In.ar( i_aInBs );
rms = Lag.ar( in.squared, 0.1 ); // Amplitude.ar reports strange things (at least not the RMS)
		// peak nowaday DOES take the abs
	//	peak	= Peak.ar( abs( in ), t_trig );
		peak	= Peak.ar( in, t_trig );
		
		// we are reading the values asynchronously through
		// a /c_getn on the meter bus. each request is followed
		// by a /n_set to re-trigger the latch so that we are
		// not missing any peak values.
		Out.kr( i_kOtBs, [ Latch.kr( peak, t_trig ), rms ]);
		
	});
	
	meterBus	= Bus.control( s, 2 );
	meterSynth = Synth.basicNew( "eisk-meter", s );
def.send( s, meterSynth.newMsg( s, [ \i_aInBs, s.options.numOutputBusChannels, \i_kOtBs, meterBus.index ], \addToTail ));
	cond	= Condition.new;
	
resp = OSCpathResponder( s.addr, [ '/c_setn', meterBus.index ], { arg time, resp, msg;
		var peak, rms, now;
		
		peak	= msg[ 3 ];
		rms	= msg[ 4 ];
//		now	= (thisThread.seconds * 1000) + dt; // + 0x10000000;

//now.postln;
		
//		ggMeter.setPeakAndRMS( peak, rms, now );
		ggMeter.setPeak( peak.min( 1.0 ));
		cond.test = true;
		cond.signal;
	});

JSCPlugView( win, Rect( 4, 4, 20, 203 ), JavaObject ( 'de.sciss.gui.PeakMeterCaption' )); ggMeter = JSCPlugView( win, Rect( 24, 4, 12, 203 ), JavaObject ( 'de.sciss.gui.PeakMeter' ));
ggMeter.setRMSPainted( false );
		
	win.onClose = {
		resp.remove;
		meterSynth.free;
		meterBus.free;
		cond.test = true;
		cond.signal;
	};
		
	win.front;
// ggMeter.setPeakAndRMS( 0.0, 0.0, (thisThread.seconds * 1000).asInteger );
//x = ggMeter;

	resp.add;

	rout = fork { var t1, bndl, sys, sysT;
		bndl = Array( 2 );
		bndl.add( meterBus.getnMsg );
		bndl.add( meterSynth.setMsg( \t_trig, 1 ));
		s.sync;
//		sys  = JavaObject.getClass( 'java.lang.System' );
//		sysT	= sys.currentTimeMillis_;
//		dt	= sysT - (thisThread.seconds * 1000) - 1000;
////		[ sysT, dt ].postln;
//		sys.destroy;
		while({ win.isClosed.not }, {
			t1 = thisThread.seconds;
			cond.test = false;
			s.listSendBundle( nil, bndl );
			cond.wait;
			(trigSpeed - (thisThread.seconds - t1)).max( 0 ).wait;
		});
	};
//y = resp;
//z = cond;
)


Am 25.11.2007 um 17:38 schrieb Sciss:

hello,

i have installed an SVN repository for development versions of SwingOSC. You can download using

$ cd <baseDir>
$ svn co https://swingosc.svn.sourceforge.net/svnroot/swingosc/ trunk/ SwingOSC

and make a clean build

$ cd SwingOSC
$ ant clean jar

(you might need to install Ant from http://ant.apache.org )

i'm asking people who develop GUI based Quarks or are creating crossplatform code for the SC book to check back with this development version (v0.57 BETA) if everything is fine, and to report problems. v0.57 is going to be the version on which i will base the SwingOSC chapter in the book and i consider it the version compatible with SuperCollider 3.2

in this development version, fixes include:

JPen : pen size scales and transforms with the affine transforms
JSCUserView : added support for cleanOnRefresh and relativeOrigin (the mouse coordinates are NOT YET reported in relative coordinates!!) JSCWindow : added the scroll argument, but that is still under construction (i'm not sure the JSCScrollTopView support will be in v0.57 because it is a very tricky thing)

... so in particular check out compatibility of JPen / JSCUserView based code.


thanks! ciao, -sciss-

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

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