complex interpolatePoint(const signalVector &inSig, float ix) { float fracOffset = ix - floor(ix); signalVector *sincVector = fetchSincVector(fracOffset); signalVector::iterator sincPtr = sincVector->begin(); int start = (int) (floor(ix) - SINCWAVEFORMSIZE/2); if (start < 0) { sincPtr += (-start); start = 0; } int end = (int) (floor(ix) + (SINCWAVEFORMSIZE/2)+1); if ((unsigned) end > inSig.size()-1) end = inSig.size()-1; complex pVal = 0.0; if (!inSig.isRealOnly()) { for (int i = start; i <= end; i++) { pVal += inSig[i] * sincPtr->real(); sincPtr++; } } else { for (int i = start; i <= end; i++) { pVal += inSig[i].real() * sincPtr->real(); sincPtr++; } } return pVal; }
/** in-place conjugation */ void conjugateVector(signalVector &x) { if (x.isRealOnly()) return; signalVector::iterator xP = x.begin(); signalVector::iterator xPEnd = x.end(); while (xP < xPEnd) { *xP = xP->conj(); xP++; } }
void GMSKReverseRotate(signalVector &x) { signalVector::iterator xPtr= x.begin(); signalVector::iterator rotPtr = GMSKReverseRotation->begin(); if (x.isRealOnly()) { while (xPtr < x.end()) { *xPtr = *rotPtr++ * (xPtr->real()); xPtr++; } } else { while (xPtr < x.end()) { *xPtr = *rotPtr++ * (*xPtr); xPtr++; } } }
void offsetVector(signalVector &x, complex offset) { signalVector::iterator xP = x.begin(); signalVector::iterator xPEnd = x.end(); if (!x.isRealOnly()) { while (xP < xPEnd) { *xP += offset; xP++; } } else { while (xP < xPEnd) { *xP = xP->real() + offset; xP++; } } }
void scaleVector(signalVector &x, complex scale) { signalVector::iterator xP = x.begin(); signalVector::iterator xPEnd = x.end(); if (!x.isRealOnly()) { while (xP < xPEnd) { *xP = *xP * scale; xP++; } } else { while (xP < xPEnd) { *xP = xP->real() * scale; xP++; } } }
complex interpolatePoint(const signalVector &inSig, float ix) { int start = (int) (floor(ix) - 10); if (start < 0) start = 0; int end = (int) (floor(ix) + 11); if ((unsigned) end > inSig.size()-1) end = inSig.size()-1; complex pVal = 0.0; if (!inSig.isRealOnly()) { for (int i = start; i < end; i++) pVal += inSig[i] * sinc(M_PI_F*(i-ix)); } else { for (int i = start; i < end; i++) pVal += inSig[i].real() * sinc(M_PI_F*(i-ix)); } return pVal; }