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