/*----------------------------------------------------------------------------- File: AFdnReverb.hpp Description: Header of the time-variant FDN reverberation plug-in Author: Jasmin Frenette Date: 11/27/2000 -----------------------------------------------------------------------------*/ #ifndef _AFDNREVERB_HPP #define _AFDNREVERB_HPP #include #include #include #include "audioeffectx.h" #include #include "modules.hpp" // FILE_OUTPUT generates a raw file (with stereo 16-bit PCM signed integers // stored in "little endian" format) containing the output of the // algorithm (turn this option OFF while measuring the performance // of the algorithm) //#define FILE_OUTPUT // QUERY_PERFORMANCE generates a text file containing the algorithm processing // times for every audio buffer //#define QUERY_PERFORMANCE // NB_DELAYS is the number of delay lines (has to be 1, 8, 12, or 16) #define NB_DELAYS 8 // NB_MOD_DELAYS is the number of modulated delay lines (from 1 to NB_DELAYS) #define NB_MOD_DELAYS 4 // USE_VARIABLE_RATE uses variable interpolation coefficient update rates #define USE_VARIABLE_RATES // USE_XXX_MODULATION choses the kind of modulation source #define USE_OSC_MODULATION //#define USE_RNG_MODULATION #define EARLY_REF_FIR_SIZE 0.080 // FIR max delay (in seconds) #define NB_TAPS 4 // Number of early reflection taps #define NB_FIXED_DELAYS (NB_MOD_DELAYS - NB_DELAYS) enum { kOut, kNumParams }; class AFdnReverb; class AFdnReverbProgram { friend class AFdnReverb; public: AFdnReverbProgram(); ~AFdnReverbProgram() {} private: float fOut; char name[24]; }; class AFdnReverb : public AudioEffectX { public: AFdnReverb(audioMasterCallback audioMaster); ~AFdnReverb(); virtual void process(float **inputs, float **outputs, long sampleframes); virtual void setProgram(long program); virtual void setProgramName(char *name); virtual void getProgramName(char *name); virtual void setParameter(long index, float value); virtual float getParameter(long index); virtual void getParameterLabel(long index, char *label); virtual void getParameterDisplay(long index, char *text); virtual void getParameterName(long index, char *text); virtual float getVu(); virtual void suspend(); private: float fOut; float vu; AFdnReverbProgram *programs; //============================= // Parameters //============================= float fDCRevTime; // Reverb time at 0 Hz (in seconds) float fPIRevTime; // Reverb time at Fs/2 Hz (in seconds) long lPreDelay; // Pre delay (in samples) long lTau[NB_DELAYS]; // Delay lines time constants (in samples) #if (NB_MOD_DELAYS>0) long lModDepth[NB_MOD_DELAYS]; // Delay lines mod depths (in samples) long lModRate[NB_MOD_DELAYS]; // Delay lines mod rates (in samples) #ifdef USE_OSC_MODULATION float fModFreq[NB_MOD_DELAYS]; // Delay lines mod frequency (in Hertz) float fModPhase[NB_MOD_DELAYS]; // Delay lines mod phase (in Degrees) #elif defined USE_RNG_MODULATION unsigned long ulRngA[NB_MOD_DELAYS]; // Delay lines rngs' a params unsigned long ulRngC[NB_MOD_DELAYS]; // Delay lines rngs' c params unsigned long ulRngSeed[NB_MOD_DELAYS]; // Delay lines rngs' seeds long lRngRate[NB_MOD_DELAYS]; // Delay lines rngs' rates #endif #endif float fA[NB_DELAYS][NB_DELAYS]; // Feedback matrix float fFeedConstant; // Feedback constant: -2/NB_DELAYS float fcL[NB_DELAYS]; // Left delay lines' output gains float fcR[NB_DELAYS]; // Right delay lines' output gains float fkp[NB_DELAYS]; // IIR LPFs gain float fbp[NB_DELAYS]; // IIR LPFs feedback gain long lTapTimeL[NB_TAPS]; // Left Early ref tap times (in samples) long lTapTimeR[NB_TAPS]; // Right Early ref tap times (in samples) float fTapGainL[NB_TAPS]; // Left Early ref tap gains float fTapGainR[NB_TAPS]; // Right Early ref tap gains // Modules #if (NB_MOD_DELAYS>0) // Choose the appropriate interpolation type here: MSVRAP1ModDelayLine modDelayLine[NB_MOD_DELAYS]; #ifdef USE_OSC_MODULATION MSinOsc mod[NB_MOD_DELAYS]; #elif defined USE_RNG_MODULATION MRNG rng[NB_MOD_DELAYS]; MLPF2b rngLpf1[NB_MOD_DELAYS]; MLPF2b rngLpf2[NB_MOD_DELAYS]; MLPFMod mod[NB_MOD_DELAYS]; #endif #endif // We only use the last (NB_DELAYS - NB_MOD_DELAYS) of the following array: MDelayLine delayLine[NB_DELAYS]; MLPF1a dampingLPF[NB_DELAYS]; MDelayLine earlyRefFIR; #ifdef FILE_OUTPUT int fh; #endif #ifdef QUERY_PERFORMANCE LARGE_INTEGER timeFreq; LARGE_INTEGER timeBegin; LARGE_INTEGER timeEnd; double timeDelta, timeSum; long counter; FILE* pf; #endif }; #endif // _AFDNREVERB_HPP