Пример #1
0
void
fluid_set_revmodel_buffers(fluid_revmodel_t* rev, fluid_real_t sample_rate) {

  float srfactor = sample_rate/44100.0f;

  fluid_comb_setbuffer(&rev->combL[0], combtuningL1*srfactor);
  fluid_comb_setbuffer(&rev->combR[0], combtuningR1*srfactor);
  fluid_comb_setbuffer(&rev->combL[1], combtuningL2*srfactor);
  fluid_comb_setbuffer(&rev->combR[1], combtuningR2*srfactor);
  fluid_comb_setbuffer(&rev->combL[2], combtuningL3*srfactor);
  fluid_comb_setbuffer(&rev->combR[2], combtuningR3*srfactor);
  fluid_comb_setbuffer(&rev->combL[3], combtuningL4*srfactor);
  fluid_comb_setbuffer(&rev->combR[3], combtuningR4*srfactor);
  fluid_comb_setbuffer(&rev->combL[4], combtuningL5*srfactor);
  fluid_comb_setbuffer(&rev->combR[4], combtuningR5*srfactor);
  fluid_comb_setbuffer(&rev->combL[5], combtuningL6*srfactor);
  fluid_comb_setbuffer(&rev->combR[5], combtuningR6*srfactor);
  fluid_comb_setbuffer(&rev->combL[6], combtuningL7*srfactor);
  fluid_comb_setbuffer(&rev->combR[6], combtuningR7*srfactor);
  fluid_comb_setbuffer(&rev->combL[7], combtuningL8*srfactor);
  fluid_comb_setbuffer(&rev->combR[7], combtuningR8*srfactor);
  fluid_allpass_setbuffer(&rev->allpassL[0], allpasstuningL1*srfactor);
  fluid_allpass_setbuffer(&rev->allpassR[0], allpasstuningR1*srfactor);
  fluid_allpass_setbuffer(&rev->allpassL[1], allpasstuningL2*srfactor);
  fluid_allpass_setbuffer(&rev->allpassR[1], allpasstuningR2*srfactor);
  fluid_allpass_setbuffer(&rev->allpassL[2], allpasstuningL3*srfactor);
  fluid_allpass_setbuffer(&rev->allpassR[2], allpasstuningR3*srfactor);
  fluid_allpass_setbuffer(&rev->allpassL[3], allpasstuningL4*srfactor);
  fluid_allpass_setbuffer(&rev->allpassR[3], allpasstuningR4*srfactor);

  /* Clear all buffers */
  fluid_revmodel_init(rev);
}
Пример #2
0
fluid_revmodel_t*
new_fluid_revmodel()
{
  fluid_revmodel_t* rev;
  rev = FLUID_NEW(fluid_revmodel_t);
  if (rev == NULL) {
    return NULL;
  }

  /* Tie the components to their buffers */
  fluid_comb_setbuffer(&rev->combL[0], rev->bufcombL1, combtuningL1);
  fluid_comb_setbuffer(&rev->combR[0], rev->bufcombR1, combtuningR1);
  fluid_comb_setbuffer(&rev->combL[1], rev->bufcombL2, combtuningL2);
  fluid_comb_setbuffer(&rev->combR[1], rev->bufcombR2, combtuningR2);
  fluid_comb_setbuffer(&rev->combL[2], rev->bufcombL3, combtuningL3);
  fluid_comb_setbuffer(&rev->combR[2], rev->bufcombR3, combtuningR3);
  fluid_comb_setbuffer(&rev->combL[3], rev->bufcombL4, combtuningL4);
  fluid_comb_setbuffer(&rev->combR[3], rev->bufcombR4, combtuningR4);
  fluid_comb_setbuffer(&rev->combL[4], rev->bufcombL5, combtuningL5);
  fluid_comb_setbuffer(&rev->combR[4], rev->bufcombR5, combtuningR5);
  fluid_comb_setbuffer(&rev->combL[5], rev->bufcombL6, combtuningL6);
  fluid_comb_setbuffer(&rev->combR[5], rev->bufcombR6, combtuningR6);
  fluid_comb_setbuffer(&rev->combL[6], rev->bufcombL7, combtuningL7);
  fluid_comb_setbuffer(&rev->combR[6], rev->bufcombR7, combtuningR7);
  fluid_comb_setbuffer(&rev->combL[7], rev->bufcombL8, combtuningL8);
  fluid_comb_setbuffer(&rev->combR[7], rev->bufcombR8, combtuningR8);
  fluid_allpass_setbuffer(&rev->allpassL[0], rev->bufallpassL1, allpasstuningL1);
  fluid_allpass_setbuffer(&rev->allpassR[0], rev->bufallpassR1, allpasstuningR1);
  fluid_allpass_setbuffer(&rev->allpassL[1], rev->bufallpassL2, allpasstuningL2);
  fluid_allpass_setbuffer(&rev->allpassR[1], rev->bufallpassR2, allpasstuningR2);
  fluid_allpass_setbuffer(&rev->allpassL[2], rev->bufallpassL3, allpasstuningL3);
  fluid_allpass_setbuffer(&rev->allpassR[2], rev->bufallpassR3, allpasstuningR3);
  fluid_allpass_setbuffer(&rev->allpassL[3], rev->bufallpassL4, allpasstuningL4);
  fluid_allpass_setbuffer(&rev->allpassR[3], rev->bufallpassR4, allpasstuningR4);
  /* Set default values */
  fluid_allpass_setfeedback(&rev->allpassL[0], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassR[0], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassL[1], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassR[1], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassL[2], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassR[2], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassL[3], 0.5f);
  fluid_allpass_setfeedback(&rev->allpassR[3], 0.5f);

  /* set values manually, since calling set functions causes update
     and all values should be initialized for an update */
  rev->roomsize = initialroom * scaleroom + offsetroom;
  rev->damp = initialdamp * scaledamp;
  rev->wet = initialwet * scalewet;
  rev->width = initialwidth;
  rev->gain = fixedgain;

  /* now its okay to update reverb */
  fluid_revmodel_update(rev);

  /* Clear all buffers */
  fluid_revmodel_init(rev);
  return rev;
}