void init(unsigned int s)
{
    size=s;
    in = new Sample(size);
    out = new Sample(size);

    f1=f2=f3=0;

    moog.SetCutoff(0.2);
    moog.SetResonance(0.4);
    WaveTable::WriteWaves();
    lfo.SetOctave(0);
    //lfo.Trigger(0,0.1,0.1,1);
    lfo.SetType(WaveTable::REVSAW);
    osc.SetOctave(0);
    osc2.SetOctave(0);
    osc3.SetOctave(0);
    osc2.SetType(WaveTable::NOISE);
    lfo.SetFineFreq(10);

    lfo_s.Allocate(size);
    lfo2_s.Allocate(size);
    lfo3_s.Allocate(size);
    osc_s.Allocate(size);
    osc2_s.Allocate(size);
    osc3_s.Allocate(size);
    ring_s.Allocate(size);

    osc.SetFineFreq(400);
}
void set_param(int which,int amount)
{
    /*    if (which==0) moog.SetCutoff(amount/100.0f);
        else if (which==1) moog.SetResonance(amount/100.0f*0.5);
        else
        {
            mix=(amount-10)/100.0f;
            if (mix<0) mix=0;
        }
    */

    float l=(100-amount)*2;

    if (which==3) {
        lfo.SetFineFreq(l*l*0.00005);
        moog.SetCutoff(l*0.05*0.4);
    }

    if (which==0) pitch1=(amount/100.0f)*200;
    if (which==1) pitch2=(amount/100.0f)*100;
    if (which==2) pitch3=(amount/100.0f)*150;

//    if (which==0) osc.SetFineFreq((amount/100.0f)*10);

//    if (which==1) osc2.SetFineFreq((amount/100.0f)*4);
//    if (which==2) osc3.SetFineFreq((amount/100.0f)*4);

    if (which==4) volume=amount/100.0f;

}