Example #1
0
Revmodel::Revmodel()
      {
	// Tie the components to their buffers
	combL[0].setbuffer(bufcombL1,combtuningL1);
	combR[0].setbuffer(bufcombR1,combtuningR1);
	combL[1].setbuffer(bufcombL2,combtuningL2);
	combR[1].setbuffer(bufcombR2,combtuningR2);
	combL[2].setbuffer(bufcombL3,combtuningL3);
	combR[2].setbuffer(bufcombR3,combtuningR3);
	combL[3].setbuffer(bufcombL4,combtuningL4);
	combR[3].setbuffer(bufcombR4,combtuningR4);
	combL[4].setbuffer(bufcombL5,combtuningL5);
	combR[4].setbuffer(bufcombR5,combtuningR5);
	combL[5].setbuffer(bufcombL6,combtuningL6);
	combR[5].setbuffer(bufcombR6,combtuningR6);
	combL[6].setbuffer(bufcombL7,combtuningL7);
	combR[6].setbuffer(bufcombR7,combtuningR7);
	combL[7].setbuffer(bufcombL8,combtuningL8);
	combR[7].setbuffer(bufcombR8,combtuningR8);
	allpassL[0].setbuffer(bufallpassL1,allpasstuningL1);
	allpassR[0].setbuffer(bufallpassR1,allpasstuningR1);
	allpassL[1].setbuffer(bufallpassL2,allpasstuningL2);
	allpassR[1].setbuffer(bufallpassR2,allpasstuningR2);
	allpassL[2].setbuffer(bufallpassL3,allpasstuningL3);
	allpassR[2].setbuffer(bufallpassR3,allpasstuningR3);
	allpassL[3].setbuffer(bufallpassL4,allpasstuningL4);
	allpassR[3].setbuffer(bufallpassR4,allpasstuningR4);

	// Set default values
	allpassL[0].setfeedback(0.5f);
	allpassR[0].setfeedback(0.5f);
	allpassL[1].setfeedback(0.5f);
	allpassR[1].setfeedback(0.5f);
	allpassL[2].setfeedback(0.5f);
	allpassR[2].setfeedback(0.5f);
	allpassL[3].setfeedback(0.5f);
	allpassR[3].setfeedback(0.5f);

      param[0] = initialroom;
      param[1] = initialdamp;
      param[2] = initialwet;

	setroomsize(initialroom);
	setdamp(initialdamp);
	setwidth(initialwidth);
	setmode(initialmode);

	// Buffer will be full of rubbish - so we MUST mute them

	for (int i = 0; i < numcombs; i++) {
		combL[i].mute();
		combR[i].mute();
            }
	for (int i=0;i<numallpasses;i++) {
		allpassL[i].mute();
		allpassR[i].mute();
            }
      }
Example #2
0
Freeverb::Freeverb(char aSide)
{
	m_side = aSide;
	if(m_side == 0)
	{
		m_comb_filter[0].setBuffer(m_comb_buffer1,combtuningL1);
		m_comb_filter[1].setBuffer(m_comb_buffer2,combtuningL2);
		m_comb_filter[2].setBuffer(m_comb_buffer3,combtuningL3);
		m_comb_filter[3].setBuffer(m_comb_buffer4,combtuningL4);
		m_comb_filter[4].setBuffer(m_comb_buffer5,combtuningL5);
		m_comb_filter[5].setBuffer(m_comb_buffer6,combtuningL6);
		m_comb_filter[6].setBuffer(m_comb_buffer7,combtuningL7);
		m_comb_filter[7].setBuffer(m_comb_buffer8,combtuningL8);
		m_allpass_filter[0].setBuffer(m_allpass_buffer1,allpasstuningL1);
		m_allpass_filter[1].setBuffer(m_allpass_buffer2,allpasstuningL2);
		m_allpass_filter[2].setBuffer(m_allpass_buffer3,allpasstuningL3);
		m_allpass_filter[3].setBuffer(m_allpass_buffer4,allpasstuningL4);
	}
	else
	{
		m_comb_filter[0].setBuffer(m_comb_buffer1r,combtuningR1);
		m_comb_filter[1].setBuffer(m_comb_buffer2r,combtuningR2);
		m_comb_filter[2].setBuffer(m_comb_buffer3r,combtuningR3);
		m_comb_filter[3].setBuffer(m_comb_buffer4r,combtuningR4);
		m_comb_filter[4].setBuffer(m_comb_buffer5r,combtuningR5);
		m_comb_filter[5].setBuffer(m_comb_buffer6r,combtuningR6);
		m_comb_filter[6].setBuffer(m_comb_buffer7r,combtuningR7);
		m_comb_filter[7].setBuffer(m_comb_buffer8r,combtuningR8);
		m_allpass_filter[0].setBuffer(m_allpass_buffer1r,allpasstuningR1);
		m_allpass_filter[1].setBuffer(m_allpass_buffer2r,allpasstuningR2);
		m_allpass_filter[2].setBuffer(m_allpass_buffer3r,allpasstuningR3);
		m_allpass_filter[3].setBuffer(m_allpass_buffer4r,allpasstuningR4);
	}
    
	m_allpass_filter[0].setFeedback(0.5f);
	m_allpass_filter[1].setFeedback(0.5f);
	m_allpass_filter[2].setFeedback(0.5f);
	m_allpass_filter[3].setFeedback(0.5f);
    
    setmode(initialmode);
	setroomsize(initialroom);
	setdamp(initialdamp);
}
Example #3
0
void Reverb::changepar(int npar, unsigned char value)
{
    switch(npar) {
    case 0:
        setvolume(value);
        break;
    case 1:
        setpan(value);
        break;
    case 2:
        settime(value);
        break;
    case 3:
        setidelay(value);
        break;
    case 4:
        setidelayfb(value);
        break;
//  case 5: setrdelay(value);
//      break;
//  case 6: seterbalance(value);
//      break;
    case 7:
        setlpf(value);
        break;
    case 8:
        sethpf(value);
        break;
    case 9:
        setlohidamp(value);
        break;
    case 10:
        settype(value);
        break;
    case 11:
        setroomsize(value);
        break;
    case 12:
        setbandwidth(value);
        break;
    }
}
Example #4
0
void Revmodel::processreplace(long n)
      {
      if (param[0] != *port[4]) {
            param[0] = *port[4];
            setroomsize(param[0]);
            }
      if (param[1] != *port[5]) {
            param[1] = *port[5];
            setdamp(param[1]);
            }

      float wet  = (1.0f - *port[6]) * scalewet;
      float dry  = *port[6] * scaledry;
	float wet1 = wet * (width/2 + 0.5f);
	float wet2 = wet * ((1-width)/2);

	for (int i = 0; i < n; ++i) {
		float outL  = 0;
		float outR  = 0;
		float input = (port[0][i] + port[1][i]) * gain;

		// Accumulate comb filters in parallel
		for (int k = 0; k < numcombs; k++) {
			outL += combL[k].process(input);
			outR += combR[k].process(input);
		      }

		// Feed through allpasses in series
		for (int k=0; k < numallpasses; k++) {
			outL = allpassL[k].process(outL);
			outR = allpassR[k].process(outR);
		      }

		// Calculate output REPLACING anything already there
		port[2][i] = outL*wet1 + outR*wet2 + port[0][i]*dry;
		port[3][i] = outR*wet1 + outL*wet2 + port[1][i]*dry;
	      }
      }
Example #5
0
Jcverb::Jcverb(long anOrder, double aFactor)
{
	m_factor = aFactor;
    m_order = anOrder;
    
    for(int i = m_order; i < numcombs; i++)
    {
        m_comb_filter.push_back(new FeedbackCombFilter((long)(DelayCombTuning[i] + m_factor * spread)));
        m_comb_filter[i - m_order]->setFeedback(FeedbackCombTuning[i]);
    }
    
    for(int i = 0; i < numallpasses; i++)
    {
        m_allpass_filter.push_back(new AllpassFilter((long)(allpasstuning[i] + m_factor * spread)));
        m_allpass_filter[i]->setFeedback(0.7f);
    }
    m_sampling_rate = 44100;
	setroomsize(initialroom);
	setdamp(initialdamp);
	setmode(initialmode);
    setDryValue(0.);
    setWetValue(1.);
}