1declare id "12AU7"; // in amp tube ba.selector
2declare name "12AU7";
3declare samplerate "96000";
4
5import("stdfaust.lib");
6import("guitarix.lib");
7
8/****************************************************************
9 ** Tube Preamp Emulation stage 1 - 2
10 */
11
12tubeax(preamp,gain1) =  hgroup("stage1", stage1) :
13          hgroup("stage2", stage2)
14          with {
15
16    stage1 = tubestage(TB_12AU7_68k,86.0,2700.0,3.718962) : *(preamp):*(2.0):
17    fi.lowpass(1,6531.0) : tubestage(TB_12AU7_250k,132.0,1500.0,2.314844) : *(preamp) :*(2.0);
18    stage2 = fi.lowpass(1,6531.0) : tubestage(TB_12AU7_250k,194.0,820.0,1.356567) : *(gain1):*(2.0);
19
20} ;
21
22process = component("gxdistortion.dsp").dist(drive,wet_dry): tubeax(preamp,gain1) with {
23    drive = ampctrl.drive;
24    wet_dry = ampctrl.wet_dry;
25    preamp = ampctrl.preamp;
26    gain1 = ampctrl.gain1;
27/*
28    drive = vslider(".gxdistortion.drive[alias]",0.35, 0, 1, 0.01);
29    wet_dry = vslider(".gxdistortion.wet_dry[alias]",  100, 0, 100, 1) : /(100) : smoothi(0.999);
30    preamp =  vslider(".amp2.stage1.Pregain[alias]",0,-20,20,0.1) : ba.db2linear : smoothi(0.999);
31    gain1 = vslider(".amp2.stage2.gain1[alias]", 6, -20.0, 20.0, 0.1) : ba.db2linear : smoothi(0.999);
32*/
33};
34