/*----------------------------------------------------------------------------- File: AFdnReverb.cpp Description: Implementation of the time-varying FDN reverberation plug-in Author: Jasmin Frenette Date: 11/27/2000 -----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include "AFdnReverb.hpp" #include "AEffEditor.hpp" //----------------------------------------------------------------------------- AFdnReverbProgram::AFdnReverbProgram () { fOut = (float) 0.5; strcpy (name, "Init"); } //----------------------------------------------------------------------------- AFdnReverb::AFdnReverb (audioMasterCallback audioMaster) : AudioEffectX (audioMaster, 16, kNumParams) { long i, j; programs = new AFdnReverbProgram[numPrograms]; fOut = vu = 0; // // Parameters Initialization // fDCRevTime = 3.00f; // Reverberation time at 0 Hz (in seconds) fPIRevTime = 1.25f; // Reverberation time at Fs/2 Hz (in seconds) lPreDelay = 1102; // Pre delay (in samples) // delay lines time constants (in samples) #if (NB_DELAYS == 1) lTau[0] = 1000; #elif (NB_DELAYS == 4) lTau[0] = 601; lTau[1] = 691; lTau[2] = 773; lTau[3] = 839; #elif (NB_DELAYS == 8) lTau[0] = 601; lTau[1] = 691; lTau[2] = 773; lTau[3] = 839; lTau[4] = 919; lTau[5] = 997; lTau[6] = 1061; lTau[7] = 1129; #elif (NB_DELAYS == 12) lTau[0] = 601; lTau[1] = 691; lTau[2] = 773; lTau[3] = 839; lTau[4] = 919; lTau[5] = 997; lTau[6] = 1061; lTau[7] = 1093; lTau[8] = 1129; lTau[9] = 1151; lTau[10] = 1171; lTau[11] = 1187; #elif (NB_DELAYS == 16) lTau[0] = 919; lTau[1] = 997; lTau[2] = 1061; lTau[3] = 1093; lTau[4] = 1129; lTau[5] = 1151; lTau[6] = 1171; lTau[7] = 1187; lTau[8] = 1213; lTau[9] = 1237; lTau[10] = 1259; lTau[11] = 1283; lTau[12] = 1303; lTau[13] = 1319; lTau[14] = 1327; lTau[15] = 1361; #endif #if (NB_MOD_DELAYS>0) // delay lines modulation depth (in samples) for(i=0;i0) for(i=0;ifOut); } //----------------------------------------------------------------------------- void AFdnReverb::setProgramName (char *name) { strcpy (programs[curProgram].name, name); } //----------------------------------------------------------------------------- void AFdnReverb::getProgramName (char *name) { if (!strcmp (programs[curProgram].name, "Init")) sprintf (name, "%s %d", programs[curProgram].name, curProgram + 1); else strcpy (name, programs[curProgram].name); } //----------------------------------------------------------------------------- void AFdnReverb::suspend () { long i; earlyRefFIR.Suspend(); #if (NB_MOD_DELAYS>0) for(i=0;ifOut = value; break; } if (editor) editor->postUpdate (); } //----------------------------------------------------------------------------- float AFdnReverb::getParameter (long index) { float v = 0; switch (index) { case kOut : v = fOut; break; } return v; } //----------------------------------------------------------------------------- void AFdnReverb::getParameterName (long index, char *label) { switch (index) { case kOut : strcpy (label, " Volume "); break; } } //----------------------------------------------------------------------------- void AFdnReverb::getParameterDisplay (long index, char *text) { switch (index) { case kOut : dB2string (fOut, text); break; } } //----------------------------------------------------------------------------- void AFdnReverb::getParameterLabel (long index, char *label) { switch (index) { case kOut : strcpy (label, " dB "); break; } } //----------------------------------------------------------------------------- void AFdnReverb::process(float **inputs, float **outputs, long sampleframes) { float cvu = vu; long p, count; float xn, yn1, yn2; float factor; float fQ[NB_DELAYS], fS[NB_DELAYS]; float *in = *inputs; float *out1 = outputs[0]; float *out2 = outputs[1]; #ifdef FILE_OUTPUT short *piFileOut = (short*)GlobalAlloc(GPTR,2*sampleframes*sizeof(short)); #endif #ifdef QUERY_PERFORMANCE QueryPerformanceFrequency(&timeFreq); QueryPerformanceCounter(&timeBegin); #endif for(count=0;count0) for(p=0;p0) for(p=0;p