Пример #1
0
/*
 * Effect output
 */
void Distorsion::out(const Stereo<float *> &smp)
{
    int      i;
    REALTYPE l, r, lout, rout;

    REALTYPE inputvol = pow(5.0, (Pdrive - 32.0) / 127.0);
    if(Pnegate != 0)
        inputvol *= -1.0;

    if(Pstereo != 0) { //Stereo
        for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
            efxoutl[i] = smp.l[i] * inputvol * panning;
            efxoutr[i] = smp.r[i] * inputvol * (1.0 - panning);
        }
    }
    else {
        for(i = 0; i < SOUND_BUFFER_SIZE; i++)
            efxoutl[i] =
                (smp.l[i] * panning + smp.r[i] * (1.0 - panning)) * inputvol;
        ;
    }

    if(Pprefiltering != 0)
        applyfilters(efxoutl, efxoutr);

    //no optimised, yet (no look table)
    waveshapesmps(SOUND_BUFFER_SIZE, efxoutl, Ptype + 1, Pdrive);
    if(Pstereo != 0)
        waveshapesmps(SOUND_BUFFER_SIZE, efxoutr, Ptype + 1, Pdrive);

    if(Pprefiltering == 0)
        applyfilters(efxoutl, efxoutr);

    if(Pstereo == 0)
        for(i = 0; i < SOUND_BUFFER_SIZE; i++)
            efxoutr[i] = efxoutl[i];

    REALTYPE level = dB2rap(60.0 * Plevel / 127.0 - 40.0);
    for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
        lout = efxoutl[i];
        rout = efxoutr[i];
        l    = lout * (1.0 - lrcross) + rout * lrcross;
        r    = rout * (1.0 - lrcross) + lout * lrcross;
        lout = l;
        rout = r;

        efxoutl[i] = lout * 2.0 * level;
        efxoutr[i] = rout * 2.0 * level;
    }
}
Пример #2
0
// Effect output
void Distorsion::out(float *smpsl, float *smpsr)
{
    float inputdrive = powf(5.0f, (Pdrive - 32.0f) / 127.0f);
    if (Pnegate)
        inputdrive *= -1.0f;

    if (Pstereo) // Stereo
    {
        for (int i = 0; i < synth->p_buffersize; ++i)
        {
            efxoutl[i] = smpsl[i] * inputdrive * pangainL;
            efxoutr[i] = smpsr[i] * inputdrive* pangainR;
        }
    }
    else // Mono
        for (int i = 0; i < synth->p_buffersize; ++i)
            efxoutl[i] = inputdrive * (smpsl[i]* pangainL + smpsr[i]* pangainR) * 0.7f;

    if (Pprefiltering)
        applyfilters(efxoutl, efxoutr);

    waveShapeSmps(synth->p_buffersize, efxoutl, Ptype + 1, Pdrive);
    if (Pstereo)
        waveShapeSmps(synth->p_buffersize, efxoutr, Ptype + 1, Pdrive);

    if (!Pprefiltering)
        applyfilters(efxoutl, efxoutr);
    if (!Pstereo)
        memcpy(efxoutr, efxoutl, synth->p_bufferbytes);

    float level = dB2rap(60.0f * Plevel / 127.0f - 40.0f);
    for (int i = 0; i < synth->p_buffersize; ++i)
    {
        float lout = efxoutl[i];
        float rout = efxoutr[i];
        float l = lout * (1.0f - lrcross) + rout * lrcross;
        float r = rout * (1.0f - lrcross) + lout * lrcross;
        lout = l;
        rout = r;
        efxoutl[i] = lout * 2.0f * level;
        efxoutr[i] = rout * 2.0f * level;
    }
}
Пример #3
0
//Effect output
void Distorsion::out(const Stereo<float *> &smp)
{
    float inputvol = powf(5.0f, (Pdrive - 32.0f) / 127.0f);
    if(Pnegate)
        inputvol *= -1.0f;

    if(Pstereo) //Stereo
        for(int i = 0; i < buffersize; ++i) {
            efxoutl[i] = smp.l[i] * inputvol * pangainL;
            efxoutr[i] = smp.r[i] * inputvol * pangainR;
        }
    else //Mono
        for(int i = 0; i < buffersize; ++i)
            efxoutl[i] = (smp.l[i] * pangainL + smp.r[i] * pangainR) * inputvol;

    if(Pprefiltering)
        applyfilters(efxoutl, efxoutr);

    waveShapeSmps(buffersize, efxoutl, Ptype + 1, Pdrive);
    if(Pstereo)
        waveShapeSmps(buffersize, efxoutr, Ptype + 1, Pdrive);

    if(!Pprefiltering)
        applyfilters(efxoutl, efxoutr);

    if(!Pstereo)
        memcpy(efxoutr, efxoutl, bufferbytes);

    float level = dB2rap(60.0f * Plevel / 127.0f - 40.0f);
    for(int i = 0; i < buffersize; ++i) {
        float lout = efxoutl[i];
        float rout = efxoutr[i];
        float l    = lout * (1.0f - lrcross) + rout * lrcross;
        float r    = rout * (1.0f - lrcross) + lout * lrcross;
        lout = l;
        rout = r;

        efxoutl[i] = lout * 2.0f * level;
        efxoutr[i] = rout * 2.0f * level;
    }
}
Пример #4
0
/*
 * Effect output
 */
void
Distorsion::out (float * smpsl, float * smpsr)
{
  int i;
  float l, r, lout, rout;

  float inputvol = powf (5.0f, ((float)Pdrive - 32.0f) / 127.0f);
  if (Pnegate != 0)
    inputvol *= -1.0f;

  if (Pstereo != 0)
    {				//Stereo
      for (i = 0; i < PERIOD; i++)
	{
	  efxoutl[i] = smpsl[i] * inputvol * 2.0f;
	  efxoutr[i] = smpsr[i] * inputvol * 2.0f;
	};
    }
  else
    {
      for (i = 0; i < PERIOD; i++)
	{
	  efxoutl[i] =
	    (smpsl[i]  +  smpsr[i] ) * inputvol;
	};
    };

  if (Pprefiltering != 0)
    applyfilters (efxoutl, efxoutr);

  //no optimised, yet (no look table)


  dwshapel->waveshapesmps (PERIOD, efxoutl, Ptype, Pdrive, 1);
  if (Pstereo != 0)
  dwshaper->waveshapesmps (PERIOD, efxoutr, Ptype, Pdrive, 1);

  if (Pprefiltering == 0)
    applyfilters (efxoutl, efxoutr);

  if (Pstereo == 0) memcpy (efxoutr , efxoutl, PERIOD * sizeof(float));

  if (octmix > 0.01f)
  {
   for (i = 0; i < PERIOD; i++)
    {
      lout = efxoutl[i];
      rout = efxoutr[i];
      
	
	if ( (octave_memoryl < 0.0f) && (lout > 0.0f) ) togglel *= -1.0f;
	
	octave_memoryl = lout;    

	if ( (octave_memoryr < 0.0f) && (rout > 0.0f) ) toggler *= -1.0f;
	
	octave_memoryr = rout;    

        octoutl[i] = lout *  togglel;
        octoutr[i] = rout *  toggler;
      }
      
       blockDCr->filterout (octoutr);
       blockDCl->filterout (octoutl);
   }



  float level = dB2rap (60.0f * (float)Plevel / 127.0f - 40.0f);

  for (i = 0; i < PERIOD; i++)
    {
      lout = efxoutl[i];
      rout = efxoutr[i];
        
      
      l = lout * (1.0f - lrcross) + rout * lrcross;
      r = rout * (1.0f - lrcross) + lout * lrcross;

        if (octmix > 0.01f)
       {
        lout = l * (1.0f - octmix) + octoutl[i] * octmix;
        rout = r * (1.0f - octmix) + octoutr[i] * octmix;
       }
        else
       {
        lout = l;
        rout = r;  
       }
       
      efxoutl[i] = lout * 2.0f * level * panning;
      efxoutr[i] = rout * 2.0f * level * (1.0f -panning);  

    };
    
    DCr->filterout (efxoutr);
    DCl->filterout (efxoutl);
};
Пример #5
0
/*
 * Effect output
 */
void
Valve::out (float * smpsl, float * smpsr, uint32_t period)
{
    unsigned int i;

    float l, r, lout, rout, fx;


    if (Pstereo != 0) {
        //Stereo
        for (i = 0; i < period; i++) {
            efxoutl[i] = smpsl[i] * inputvol;
            efxoutr[i] = smpsr[i] * inputvol;
        };
    } else {
        for (i = 0; i < period; i++) {
            efxoutl[i] =
                (smpsl[i]  +  smpsr[i] ) * inputvol;
        };
    };

    harm->harm_out(efxoutl,efxoutr, period);


    if (Pprefiltering != 0)
        applyfilters (efxoutl, efxoutr, period);

    if(Ped) {
        for (i =0; i<period; i++) {
            efxoutl[i]=Wshape(efxoutl[i]);
            if (Pstereo != 0) efxoutr[i]=Wshape(efxoutr[i]);
        }
    }

    for (i =0; i<period; i++) { //soft limiting to 3.0 (max)
        fx = efxoutl[i];
        if (fx>1.0f) fx = 3.0f - 2.0f/sqrtf(fx);
        efxoutl[i] = fx;
        fx = efxoutr[i];
        if (fx>1.0f) fx = 3.0f - 2.0f/sqrtf(fx);
        efxoutr[i] = fx;
    }

    if (q == 0.0f) {
        for (i =0; i<period; i++) {
            if (efxoutl[i] == q) fx = fdist;
            else fx =efxoutl[i] / (1.0f - powf(2.0f,-dist * efxoutl[i] ));
            otml = atk * otml + fx - itml;
            itml = fx;
            efxoutl[i]= otml;
        }
    } else {
        for (i = 0; i < period; i++) {
            if (efxoutl[i] == q) fx = fdist + qcoef;
            else fx =(efxoutl[i] - q) / (1.0f - powf(2.0f,-dist * (efxoutl[i] - q))) + qcoef;
            otml = atk * otml + fx - itml;
            itml = fx;
            efxoutl[i]= otml;

        }
    }


    if (Pstereo != 0) {

        if (q == 0.0f) {
            for (i =0; i<period; i++) {
                if (efxoutr[i] == q) fx = fdist;
                else fx = efxoutr[i] / (1.0f - powf(2.0f,-dist * efxoutr[i] ));
                otmr = atk * otmr + fx - itmr;
                itmr = fx;
                efxoutr[i]= otmr;

            }
        } else {
            for (i = 0; i < period; i++) {
                if (efxoutr[i] == q) fx = fdist + qcoef;
                else fx = (efxoutr[i] - q) / (1.0f - powf(2.0f,-dist * (efxoutr[i] - q))) + qcoef;
                otmr = atk * otmr + fx - itmr;
                itmr = fx;
                efxoutr[i]= otmr;

            }
        }

    }



    if (Pprefiltering == 0)
        applyfilters (efxoutl, efxoutr, period);

    if (Pstereo == 0) memcpy (efxoutr , efxoutl, period * sizeof(float));


    float level = dB2rap (60.0f * (float)Plevel / 127.0f - 40.0f);

    for (i = 0; i < period; i++) {
        lout = efxoutl[i];
        rout = efxoutr[i];


        l = lout * (1.0f - lrcross) + rout * lrcross;
        r = rout * (1.0f - lrcross) + lout * lrcross;

        lout = l;
        rout = r;

        //efxoutl[i] = lout * 2.0f * level * panning;
        //efxoutr[i] = rout * 2.0f * level * (1.0f -panning);
        efxoutl[i] = lout * 2.0f * level * (1.0f -panning);
        efxoutr[i] = rout * 2.0f * level * panning;

    };



};
Пример #6
0
/*
 * Effect output
 */
void
NewDist::out (float * smpsl, float * smpsr, uint32_t period)
{
    unsigned int i;
    float l, r, lout, rout;

    float inputvol = .5f;

    if (Pnegate != 0)
        inputvol *= -1.0f;


    if (Pprefiltering != 0)
        applyfilters (smpsl, smpsr, period);

    //no optimised, yet (no look table)


    wshapel->waveshapesmps (period, smpsl, Ptype, Pdrive, 2);
    wshaper->waveshapesmps (period, smpsr, Ptype, Pdrive, 2);




    memcpy(efxoutl,smpsl,period * sizeof(float));
    memcpy(efxoutr,smpsl,period * sizeof(float));





    if (octmix > 0.01f) {
        for (i = 0; i < period; i++) {
            lout = efxoutl[i];
            rout = efxoutr[i];

            if ( (octave_memoryl < 0.0f) && (lout > 0.0f) ) togglel *= -1.0f;
            octave_memoryl = lout;

            if ( (octave_memoryr < 0.0f) && (rout > 0.0f) ) toggler *= -1.0f;
            octave_memoryr = rout;

            octoutl[i] = lout *  togglel;
            octoutr[i] = rout *  toggler;

        }


        blockDCr->filterout (octoutr, period);
        blockDCl->filterout (octoutl, period);
    }



    filterl->filterout(smpsl, period);
    filterr->filterout(smpsr, period);



    if (Pprefiltering == 0)
        applyfilters (efxoutl, efxoutr, period);



    float level = dB2rap (60.0f * (float)Plevel / 127.0f - 40.0f);

    for (i = 0; i < period; i++) {
        lout = efxoutl[i];
        rout = efxoutr[i];

        l = lout * (1.0f - lrcross) + rout * lrcross;
        r = rout * (1.0f - lrcross) + lout * lrcross;

        if (octmix > 0.01f) {
            lout = l * (1.0f - octmix) + octoutl[i] * octmix;
            rout = r * (1.0f - octmix) + octoutr[i] * octmix;
        } else {
            lout = l;
            rout = r;
        }

        //efxoutl[i] = lout * level * panning;
        //efxoutr[i] = rout * level * ( 1.0f - panning);
        efxoutl[i] = lout * level * ( 1.0f - panning);
        efxoutr[i] = rout * level * panning;

    };

    DCr->filterout (efxoutr, period);
    DCl->filterout (efxoutl, period);


};
Пример #7
0
void
Valve::processReplacing (float **inputs,
								float **outputs,
								int sampleFrames)
{
    int i;

    float l, r, lout, rout, fx;
	param->PERIOD = sampleFrames;
	param->fPERIOD = param->PERIOD;

    if (Pstereo != 0) {
        //Stereo
        for (i = 0; i < param->PERIOD; i++) {
            outputs[0][i] = inputs[0][i] * inputvol;
            outputs[1][i] = inputs[1][i] * inputvol;
        };
    } else {
        for (i = 0; i < param->PERIOD; i++) {
            outputs[0][i] =
                (inputs[0][i]  +  inputs[1][i] ) * inputvol;
        };
    };

    harm->harm_out(outputs[0],outputs[1]);


    if (Pprefiltering != 0)
        applyfilters (outputs[0], outputs[1]);

    if(Ped) {
        for (i =0; i<param->PERIOD; i++) {
            outputs[0][i]=Wshape(outputs[0][i]);
            if (Pstereo != 0) outputs[1][i]=Wshape(outputs[1][i]);
        }
    }

    for (i =0; i<param->PERIOD; i++) { //soft limiting to 3.0 (max)
        fx = outputs[0][i];
        if (fx>1.0f) fx = 3.0f - 2.0f/sqrtf(fx);
        outputs[0][i] = fx;
        fx = outputs[1][i];
        if (fx>1.0f) fx = 3.0f - 2.0f/sqrtf(fx);
        outputs[1][i] = fx;
    }

    if (q == 0.0f) {
        for (i =0; i<param->PERIOD; i++) {
            if (outputs[0][i] == q) fx = fdist;
            else fx =outputs[0][i] / (1.0f - powf(2.0f,-dist * outputs[0][i] ));
            otml = atk * otml + fx - itml;
            itml = fx;
            outputs[0][i]= otml;
        }
    } else {
        for (i = 0; i < param->PERIOD; i++) {
            if (outputs[0][i] == q) fx = fdist + qcoef;
            else fx =(outputs[0][i] - q) / (1.0f - powf(2.0f,-dist * (outputs[0][i] - q))) + qcoef;
            otml = atk * otml + fx - itml;
            itml = fx;
            outputs[0][i]= otml;

        }
    }


    if (Pstereo != 0) {

        if (q == 0.0f) {
            for (i =0; i<param->PERIOD; i++) {
                if (outputs[1][i] == q) fx = fdist;
                else fx = outputs[1][i] / (1.0f - powf(2.0f,-dist * outputs[1][i] ));
                otmr = atk * otmr + fx - itmr;
                itmr = fx;
                outputs[1][i]= otmr;

            }
        } else {
            for (i = 0; i < param->PERIOD; i++) {
                if (outputs[1][i] == q) fx = fdist + qcoef;
                else fx = (outputs[1][i] - q) / (1.0f - powf(2.0f,-dist * (outputs[1][i] - q))) + qcoef;
                otmr = atk * otmr + fx - itmr;
                itmr = fx;
                outputs[1][i]= otmr;

            }
        }

    }



    if (Pprefiltering == 0)
        applyfilters (outputs[0], outputs[1]);

    if (Pstereo == 0) memcpy (outputs[1] , outputs[0], param->PERIOD * sizeof(float));


    float level = dB2rap (60.0f * (float)Plevel / 127.0f - 40.0f);

    for (i = 0; i < param->PERIOD; i++) {
        lout = outputs[0][i];
        rout = outputs[1][i];


        l = lout * (1.0f - lrcross) + rout * lrcross;
        r = rout * (1.0f - lrcross) + lout * lrcross;

        lout = l;
        rout = r;

        outputs[0][i] = lout * 2.0f * level * panning;
        outputs[1][i] = rout * 2.0f * level * (1.0f -panning);

    };



};