// // Programmer: Craig Stuart Sapp // Creation Date: Tue May 13 22:51:42 GMT-0800 1997 // Last Modified: Tue May 13 22:51:45 GMT-0800 1997 // Filename: ...sig/maint/code/Filter/OnePole/OnePole.cpp // Web Address: http://sig.sapp.org/src/sigSignal/OnePole.cpp // Documentation: http://sig.sapp.org/doc/classes/OnePole // Syntax: C++ // #include "OnePole.h" #include ////////////////////////////// // // OnePole::OnePole -- // default values: aFeedback = 0, aGain = 1 // OnePole::OnePole(sampleType aFeedback, sampleType aGain) { setFeedback(aFeedback); setGain(aGain); setName("OnePole"); outputValue = 0; previousOutput = 0; brandname = FILTER; } ////////////////////////////// // // OnePole::~OnePole -- // OnePole::~OnePole() { } ////////////////////////////// // // OnePole::action -- // void OnePole::action(void) { previousOutput = outputValue; if (inputs.connectionQ(1)) { // feedback connected to input 1 if (inputs.connectionQ(2)) { // gain connected to input 2 outputValue = inputs[2] * inputs[0] - inputs[1] * previousOutput; } else { // gain not connected to input 2 outputValue = gain * inputs[0] - inputs[1] * previousOutput; } } else { // feedback not connected to input 1 if (inputs.connectionQ(2)) { // gain connected to input 2 outputValue = inputs[2] * inputs[0] - feedback * previousOutput; } else { // gain not connected to input 2 outputValue = gain * inputs[0] - feedback * previousOutput; } } } ////////////////////////////// // // OnePole::getFeedback -- // sampleType OnePole::getFeedback(void) { return feedback; } ////////////////////////////// // // OnePole::getGain -- // sampleType OnePole::getGain(void) { return gain; } ////////////////////////////// // // OnePole::output -- // sampleType OnePole::output(int channel) { return outputValue; } ////////////////////////////// // // OnePole::setFeedback -- // void OnePole::setFeedback(sampleType aFeedback) { feedback = aFeedback; } ////////////////////////////// // // OnePole::setGain -- // void OnePole::setGain(sampleType aGain) { gain = aGain; } // md5sum: b178c7b58646388162349d2a62a6d1cf OnePole.cpp [20010708]