/************************************************************************************/
/* Making multiple "sub windows"(eg. sliders) in a main GUI window                                                       */
/*                                                                                                                                                                     */
/************************************************************************************/
GUI window coordinates are absolute and subwindows such as sliders are relative
to main GUI Window

(
var w, numberOfRep;
var leftEnd, topEnd, rightEnd, bottomEnd;
var minKnob, maxKnob;
var xOffset, yOffset;

// horizontal and vertical shift of main GUI window
xOffset = 300; yOffset = 200;

minKnob = 10; maxKnob = 1000;

// these are absolute values on screen(monitor)
leftEnd   = 40 + xOffset;
topEnd    = 80 + yOffset;
rightEnd  = 300 + xOffset;
bottomEnd = 365 + yOffset;

// number of sliders you want to have
numberOfRep = 10;

w = GUIWindow.new("Multi Sliders", Rect.new(leftEnd,topEnd,rightEnd,bottomEnd));

numberOfRep.do({ arg i; // i will increment by 1 n times
   SliderView.new(w, Rect.new(  (10+10),   // these coords are relative to GUIWindow
         (28 * i + 8),
         (240),
         (28 * i + 24)
         ), nil,
   minKnob+(maxKnob-100).rand,minKnob,maxKnob); // random values for initial knob position
   });
)

/************************************************************************************/
/* this is an example shows how to control frequency of sine wave with a slider                                          */
/*                                                                                                                                                                    */
/************************************************************************************/
ControlIn: read an external control source
ControlIn.kr(source, lagTime)
For more info, see the ExternalControlSource help file.

source - an instance of ExternalControlSource which includes MIDI and Mouse sources, or anything
else that responds to the value message with a Float.
lagTime - an exponential lag time used to smooth the signal. This is useful for de-zippering Mouse
and MIDI controllers. A lag time of zero means no smoothing is done.

{
 var w, a, b, z;

 w = GUIWindow.new("Single Slider", Rect.newBy( 196, 73, 199, 126 ));

 b = SliderView.new( w, Rect.newBy( 33, 62, 131, 31 ), "SliderView", 440, 60, 1000, 10, 'linear');
 a = NumericalView.new( w, Rect.newBy( 33, 28, 131, 29 ), "NumericalView", 440, 60, 1000, 10, 'linear');

 a.action = { b.value = a.value };
 b.action = { a.value = b.value };
 
 play({
   SinOsc.ar( ControlIn.kr(a) )      // control values passed to Sine oscillator
 }) ;
 
 w.close;          //closing window
}