diff options
author | John Glover <glover.john@gmail.com> | 2010-10-21 13:39:28 +0100 |
---|---|---|
committer | John Glover <glover.john@gmail.com> | 2010-10-21 13:39:28 +0100 |
commit | ce65c30264be9683dd3a59b35730d2f31e02d37f (patch) | |
tree | 90aaf2e77526af9ba099e76175956d0dd6a37633 /sms/analysis.c | |
parent | b46b988f164f983fc889c7bc0c96953e4609d27a (diff) | |
download | simpl-ce65c30264be9683dd3a59b35730d2f31e02d37f.tar.gz simpl-ce65c30264be9683dd3a59b35730d2f31e02d37f.tar.bz2 simpl-ce65c30264be9683dd3a59b35730d2f31e02d37f.zip |
Changed from floats to doubles in the C/C++ code, makes Python integration a bit easier. Fixed a bug that would cause SndObjSynthesis to crash if peak values were floats.
Diffstat (limited to 'sms/analysis.c')
-rw-r--r-- | sms/analysis.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sms/analysis.c b/sms/analysis.c index 3f46e5f..678eb13 100644 --- a/sms/analysis.c +++ b/sms/analysis.c @@ -222,7 +222,7 @@ int sms_findPeaks(int sizeWaveform, sfloat *pWaveform, SMS_AnalParams *pAnalPara pSpectralPeaks->nPeaksFound = pAnalParams->ppFrames[iCurrentFrame]->nPeaks; pSpectralPeaks->nPeaks = pAnalParams->peakParams.iMaxPeaks; pSpectralPeaks->pSpectralPeaks = pAnalParams->ppFrames[iCurrentFrame]->pSpectralPeaks; - /* convert peak amps to mag */ + /* convert peak amps to linear */ for(i = 0; i < pSpectralPeaks->nPeaksFound; i++) { pSpectralPeaks->pSpectralPeaks[i].fMag = sms_dBToMag(pSpectralPeaks->pSpectralPeaks[i].fMag); @@ -235,8 +235,8 @@ int sms_findPeaks(int sizeWaveform, sfloat *pWaveform, SMS_AnalParams *pAnalPara } } -void sms_setPeaks(SMS_AnalParams *pAnalParams, int numamps, float* amps, - int numfreqs, float* freqs, int numphases, float* phases) +void sms_setPeaks(SMS_AnalParams *pAnalParams, int numamps, sfloat* amps, + int numfreqs, sfloat* freqs, int numphases, sfloat* phases) { int i; SMS_AnalFrame *tempFrame; @@ -379,7 +379,7 @@ void sms_approxResidual(int sizeResidual, sfloat* pResidual, // // (iSoundLoc - pAnalParams->soundBuffer.iMarker), // // sizeResidual); // int sizeData = sizeResidual; -// if ((pFResidual = (sfloat *) calloc (sizeResidual, sizeof(float))) == NULL) +// if ((pFResidual = (sfloat *) calloc (sizeResidual, sizeof(sfloat))) == NULL) // { // sms_error("sms_analyze: error allocating memory for pFResidual"); // return -1; @@ -387,7 +387,7 @@ void sms_approxResidual(int sizeResidual, sfloat* pResidual, // if (sizeWindowArray != sizeData) // { // if(sizeWindowArray != 0) free(pWindow); -// if((pWindow = (sfloat *) calloc(sizeData, sizeof(float))) == NULL) +// if((pWindow = (sfloat *) calloc(sizeData, sizeof(sfloat))) == NULL) // { // sms_error("sms_analyze: error allocating memory for pWindow"); // return -1; @@ -550,7 +550,7 @@ int sms_analyze (int sizeWaveform, sfloat *pWaveform, SMS_Data *pSmsData, SMS_An int sizeData = MIN(pAnalParams->soundBuffer.sizeBuffer - (iSoundLoc - pAnalParams->soundBuffer.iMarker), sizeResidual); - if ((pFResidual = (sfloat *) calloc (sizeResidual, sizeof(float))) == NULL) + if ((pFResidual = (sfloat *) calloc (sizeResidual, sizeof(sfloat))) == NULL) { sms_error("sms_analyze: error allocating memory for pFResidual"); return -1; @@ -558,7 +558,7 @@ int sms_analyze (int sizeWaveform, sfloat *pWaveform, SMS_Data *pSmsData, SMS_An if (sizeWindowArray != sizeData) { if(sizeWindowArray != 0) free(pWindow); - if((pWindow = (sfloat *) calloc(sizeData, sizeof(float))) == NULL) + if((pWindow = (sfloat *) calloc(sizeData, sizeof(sfloat))) == NULL) { sms_error("sms_analyze: error allocating memory for pWindow"); return -1; |