Exemple #1
0
/*
 * Effect output
 */
void Reverb::out(const Stereo<float *> &smp)
{
    int i;
    if((Pvolume == 0) && (insertion != 0))
        return;

    for(i = 0; i < SOUND_BUFFER_SIZE; i++)
        inputbuf[i] = (smp.l[i] + smp.r[i]) / 2.0;

    if(idelay != NULL) {
        for(i = 0; i < SOUND_BUFFER_SIZE; i++) {
            //Initial delay r
            REALTYPE tmp = inputbuf[i] + idelay[idelayk] * idelayfb;
            inputbuf[i]     = idelay[idelayk];
            idelay[idelayk] = tmp;
            idelayk++;
            if(idelayk >= idelaylen)
                idelayk = 0;
        }
    }

    if(bandwidth)
        bandwidth->process(SOUND_BUFFER_SIZE, inputbuf);

    if(lpf != NULL)
        lpf->filterout(inputbuf);
    if(hpf != NULL)
        hpf->filterout(inputbuf);

    processmono(0, efxoutl); //left
    processmono(1, efxoutr); //right

    REALTYPE lvol = rs / REV_COMBS * pan;
    REALTYPE rvol = rs / REV_COMBS * (1.0 - pan);
    if(insertion != 0) {
        lvol *= 2;
        rvol *= 2;
    }
    for(int i = 0; i < SOUND_BUFFER_SIZE; i++) {
        efxoutl[i] *= lvol;
        efxoutr[i] *= rvol;
    }
}
Exemple #2
0
/*
 * Effect output
 */
void
Reverb::out (float * smps_l, float * smps_r, uint32_t period)
{
    unsigned int i;

    for (i = 0; i < period; i++) {
        inputbuf[i] = (smps_l[i] + smps_r[i]) * .5f;
        //Initial delay r
        if (idelay != NULL) {
            float tmp = inputbuf[i] + idelay[idelayk] * idelayfb;
            inputbuf[i] = idelay[idelayk];
            idelay[idelayk] = tmp;
            idelayk++;
            if (idelayk >= idelaylen)
                idelayk = 0;
        };
    };


    lpf->filterout (inputbuf, period);
    hpf->filterout (inputbuf, period);

    processmono (0, efxoutl, period);	//left
    processmono (1, efxoutr, period);	//right



    float lvol = rs_coeff * pan * 2.0f;
    float rvol = rs_coeff * (1.0f - pan) * 2.0f;

    for (unsigned int i = 0; i < period; i++) {
        efxoutl[i] *= lvol;
        efxoutr[i] *= rvol;

    };
};