20 :
Effect(in), mFFTSize(size),
21 mWrapper(size, type,
CSL_FFT_FORWARD), mInBuf(1, size), mWindowBuffer(0) {
37 unsigned numFrames = outputBuffer.mNumFrames;
41 memcpy(mInBuf.buffer(0), mInputPtr, numFrames *
sizeof(
sample));
45 for (
int i = 0; i < mFFTSize; i++)
46 *bufPtr++ *= *winPtr++;
48 mWrapper.nextBuffer(mInBuf, outputBuffer);
51 this->changed((
void *) & outputBuffer);
69 void IFFT::binValue(
int binNumber,
float * outRealPart,
float * outImagPart) {
75 float myReal, myComplex;
76 binValue(binNumber, &myReal, &myComplex);
77 *outMag = hypot(myReal, myComplex);
78 *outPhase = (0.0 == myReal) ? 0 : atan(myComplex/myReal);
83 logMsg(
"\t\tset [%d] = %5.3f @ %5.3f", binNumber, realPart, imagPart);
104 for (
int i = 0; i <
mFFTSize; i += 2) {
111 if (lower <0 || lower >=
mFFTSize ) {
return; }
112 if (upper <0 || upper >=
mFFTSize ) {
return; }
113 if (upper <lower ) {
return; }
115 for (
int i = lower; i < upper; i++) {
122 float myReal, myComplex;
123 myReal = mag*cos(phase);
124 myComplex = mag*sin(phase);
125 setBin(binNumber, myReal, myComplex);
129 for (
int i = 0; i <
mFFTSize; i++) {
138 if (outputBuffer.mNumFrames != mWrapper.mSize) {
140 "IFFT::nextBuffer # frames %d wrong for FFT size %d (use a block resizer).",
141 outputBuffer.mNumFrames, mWrapper.mSize);
144 mInBuf.setSize(1, outputBuffer.mNumFrames);
147 mWrapper.nextBuffer(mInBuf, outputBuffer);