// // Programmer: Craig Stuart Sapp // Creation Date: Sat Nov 8 17:33:48 GMT-0800 1997 // Last Modified: Sat Nov 8 19:33:17 GMT-0800 1997 // Filename: ...sig/maint/code/LookupTable/PeriodTable/PeriodTable.cpp // Web Address: http://sig.sapp.org/src/sig/PeriodTable.cpp // Documentation: http://sig.sapp.org/doc/classes/PeriodTable // Syntax: C++ // #include "PeriodTable.h" #include #include #ifndef OLDCPP #include #include using namespace std; #else #include #include #endif ////////////////////////////// // // PeriodTable::PeriodTable -- // default value: size = 0 // PeriodTable::PeriodTable(int size) : LookupTable(size) { zero(); } PeriodTable::PeriodTable(sampleType* borrowedTable, int size) : LookupTable(borrowedTable, size) { zero(); } PeriodTable::PeriodTable(PeriodTable& aTable) : LookupTable(aTable) { zero(); } // default value: size = 1024 PeriodTable::PeriodTable(char* oscTable, int size) : LookupTable(size) { zero(); add(oscTable); } ////////////////////////////// // // PeriodTable::~PeriodTable -- // PeriodTable::~PeriodTable() { // nothing to do } ////////////////////////////// // // PeriodTable::add -- // default value: phase = 0 // void PeriodTable::add(int periods, double amp, double phase) { for (int i=0; i= getSize()) { cerr << "Error: cannot shift by more than size of table" << endl; exit(1); } int i, j; sampleType *temp; temp = new sampleType[amount]; for (i=0; i -0.00001) { cout << "0.00000, "; } else { cout << tableData[i] << ", "; } if ((i+1)%10 == 0) cout << "\n" ; } if (tableData[getSize()-1] < 0.00001 && tableData[getSize()-1] > -0.00001) { cout << "0.00000"; } else { cout << tableData[getSize()-1]; } cout << "}, Frame->True, PlotJoined->True, PlotRange->All];" << endl; } ////////////////////////////// // // PeriodTable::ramp -- // default value: amplitude = 1 // void PeriodTable::ramp(double amplitude) { double increment = 2.0 * amplitude / (getSize()-1); double value = -amplitude; for (int i=0; i= getSize()) { cerr << "Error: cannot shift by more than size of table" << endl; exit(1); } int i; sampleType *temp; temp = new sampleType[amount]; for (i=0; i