// // Programmer: Craig Stuart Sapp // Creation Date: Thu May 15 13:28:50 GMT-0800 1997 // Last Modified: Thu May 15 13:28:53 GMT-0800 1997 // Filename: ...sig/maint/code/Generator/Impulse/Impulse.cpp // Web Address: http://sig.sapp.org/src/sigSignal/Impulse.cpp // Documentation: http://sig.sapp.org/doc/classes/Impulse // Syntax: C++ // #include "Impulse.h" #ifndef OLDCPP #include using namespace std; #else #include #endif ////////////////////////////// // // Impulse::Impulse -- // default value: aPeriod = 0x7fffffff, anAmplitude = 1.0 // Impulse::Impulse(long aPeriod, sampleType anAmplitude) { setName("Impulse"); setAmplitude(anAmplitude); setPeriod(aPeriod); brandname = GENERATOR; outputValue = 0; trigger(); } ////////////////////////////// // // Impulse::~Impulse -- // Impulse::~Impulse() { } ////////////////////////////// // // Impulse::action -- // void Impulse::action(void) { if (counter % period) { outputValue = 0; } else { outputValue = amplitude; } counter++; } ////////////////////////////// // // Impulse::getAmplitude -- // sampleType Impulse::getAmplitude(void) { return amplitude; } ////////////////////////////// // // Impulse::getPeriod -- // long Impulse::getPeriod(void) { return period; } ////////////////////////////// // // Impulse::output -- // sampleType Impulse::output(int channel) { return outputValue; } ////////////////////////////// // // Impulse::printState -- // void Impulse::printState(void) { cerr << " Period: " << getPeriod() << endl; cerr << " Amplitude: " << getAmplitude() << endl; } ////////////////////////////// // // Impulse::setAmplitude -- // void Impulse::setAmplitude(sampleType anAmplitude) { amplitude = anAmplitude; } ////////////////////////////// // // Impulse::setPeriod -- // void Impulse::setPeriod(long aPeriod) { period = aPeriod; } ////////////////////////////// // // Impulse::setValue -- // default value: counterValue = 0 // void Impulse::trigger(long counterValue) { counter = counterValue; } // md5sum: b5824a778d5a9de0286435a7ce497f86 Impulse.cpp [20010708]