!!!INCOMPLETE!!!
Note: please use the abstraction layer GUI.peakMeterView if possible! (see GUI). See also JSCView.
(
w = JSCWindow( "Meter", Rect( 200, 200, 128, 225 ), false );
b = JSCPeakMeterView( w, Rect( 4, 4, 56, 217 ));
b.bus = Bus( \audio, s.options.numOutputBusChannels, 2, s );
w.front;
)
b.border = true;
b.border = false;
b.caption = true;
b.caption = false;
b.caption = true;
b.font = JFont( "Eurostile", 11 );
b.font = JFont( "Andale Mono", 13 );
b.captionVisible = false;
b.captionVisible = true;
b.captionPosition = \right;
b.captionPosition = \left;
b.captionPosition = \center;
b.rmsPainted = false;
b.rmsPainted = true;
b.holdPainted = false;
b.holdPainted = true;
b.bus = Bus( \audio, s.options.numOutputBusChannels, 4, s );
b.bounds = Rect( 4, 4, 72, 217 );
b.refresh;
b.bounds = Rect( 4, 4, 128, 217 );
b.refresh;
g.reboot;
s.boot;
b.mouseDownAction = { "Doing!".postln };
(
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 ]);
}).send( s );
)
//x = Synth( "eisk-meter", [ \i_aInBs, b.bus.index, \i_kOtBs, ~cbus.index ], target: ~group );
b.active = true;
x = 2.collect({ arg i; Synth.basicNew( "eisk-meter", s )});
s.listSendBundle( nil, x.collect({ arg synth, i; synth.newMsg( ~group, [ \i_aInBs, b.bus.index + i, \i_kOtBs, ~cbus.index + (i << 1) ])}));
b.active = false;
x.do(_.free)