/************************************************************************************/
/* Example for multi slider, numerical view, and range to control line in signal                                             */
/* This uses input from line in or microphone                                                                                                */
/*                                                                                                                                                                    */
/************************************************************************************/
{
 var w, a, b, c, a1, b1, c1;
 var panelName = "Mic in control";
 
 // window setup and string placement
 w = GUIWindow.new(panelName, Rect.newBy( 616, 63, 241, 217 ));

 StringView.new( w, Rect.newBy( 11, 53, 66, 21 ), "Amplitude")
  .labelColor_(rgb(209,69,12));
 StringView.new( w, Rect.newBy( 8, 20, 219, 26 ), "Input from external mic or line in")
  .labelColor_(rgb(36,42,115));
 StringView.new( w, Rect.newBy( 10, 125, 66, 21 ), "Pan")
  .labelColor_(rgb(25,97,35));

 // numerical view and slider setup for amplitude
 a = NumericalView.new( w, Rect.newBy( 12, 78, 65, 24 ), "Amplitude Numrical", 0, -1e+10, 1e+10, 0, 'exponential');
 b = SliderView.new( w, Rect.newBy( 82, 52, 136, 24 ), "SliderView", 0, 0, 1, 0, 'linear')
  .knobColor_(rgb(250,7,0));
 c = RangeView.new( w, Rect.newBy( 83, 81, 136, 24 ), "RangeView", 0, 0, 0, 1, 0, 'linear')
  .rangeColor_(rgb(215,10,7));

 a.action = { b.value = a.value}; // numerical
 b.action = { a.value = b.value; c.range = b.value  }; // slider
 c.action = { b.value = c.range }; // range

 // numerical view and slider setup for panning
 a1 = NumericalView.new( w, Rect.newBy( 11, 150, 65, 24 ), "Amplitude Numrical", 0, -1, 1, 0, 'exponential');
 b1 = SliderView.new( w, Rect.newBy( 81, 124, 136, 24 ), "SliderView", 0, -1, 1, 0, 'linear')
  .knobColor_(rgb(35,143,28));
 c1 = RangeView.new( w, Rect.newBy( 82, 153, 136, 24 ), "RangeView", 0, 0, -1, 1, 0, 'linear') // init, min, max, resolution
  .rangeColor_(rgb(25,133,33));

 a1.action = { b1.value = a1.value}; // numerical
 b1.action = { a1.value = b1.value; c1.value = b1.value  }; // slider
 c1.action = { b1.value = c1.value }; // range

 // make sound, scope and use control from GUI
 ({
    Pan2.ar( AudioIn.ar(1, ControlIn.kr(a)), ControlIn.kr(c1) )
    }).scope;
 
 w.close;
}