// // Programmer: Craig Stuart Sapp // Creation Date: Sun Apr 20 19:03:37 GMT-0800 1997 // Last Modified: Fri Mar 27 23:35:58 GMT-0800 1998 // Last Modified: Sun Jul 8 17:05:56 PDT 2001 (bug fixes by MD and CSS) // Filename: ...sig/maint/code/Filter/Comb/Comb.cpp // Web Address: http://sig.sapp.org/src/sigSignal/Comb.cpp // Documentation: http://sig.sapp.org/doc/classes/Comb // Syntax: C++ // #include "Comb.h" #include #include ////////////////////////////// // // Comb::Comb -- sets the minimum resonating frequency to 12 Hz. // Comb::Comb(void) { setName("Comb"); brandname = FILTER; buffsize = 0; maxbuffsize = 0; setMinFund(12); // default minimum fundamental of comb is 12 Hz. setGain(0.5); // related to reverb time of sound setFund(440); // fundamental frequency of comb filter clear(); } ////////////////////////////// // // Comb::~Comb -- // Comb::~Comb() { // do nothing } ////////////////////////////// // // Comb::action -- // void Comb::action(void) { outputValue = circularQueue.extract(); circularQueue.insert(getSignal() + getGain() * outputValue); } ////////////////////////////// // // Comb::clear -- initialize internal signal variables to zeros. // void Comb::clear(void) { outputValue = 0.0; circularQueue.reset(); for (int i=0; i maxbuffsize) { buffsize = maxbuffsize; } clear(); } ////////////////////////////// // // Comb::setReverbTime -- calculates the gain necessary for the // given T60 reverberation time. // void Comb::setReverbTime(sampleType aReverbTime) { connect(pow(0.001, 1.0/(getSrate()*getFund()*aReverbTime)), 1); } ////////////////////////////// // // Comb::setGain -- sets the feedback gain of the comb filter. // stable values are in the range from [-1.0 .. 1.0] // void Comb::setGain(sampleType aGain) { connect(aGain, 1); } // md5sum: 90b1d66539d81553c14d47551be741bf Comb.cpp [20050403]