diff options
author | John Glover <glover.john@gmail.com> | 2010-11-04 14:50:08 +0000 |
---|---|---|
committer | John Glover <glover.john@gmail.com> | 2010-11-04 14:50:08 +0000 |
commit | c741f6ce7bb43b115d08e190b93e0ce090ae3475 (patch) | |
tree | 9ad817d457a0b5595a4de802b069f149745295ac /sms/soundIO.c | |
parent | 82ae0ec4aa684dbe6285b265bc6a07c6f555d90d (diff) | |
download | simpl-c741f6ce7bb43b115d08e190b93e0ce090ae3475.tar.gz simpl-c741f6ce7bb43b115d08e190b93e0ce090ae3475.tar.bz2 simpl-c741f6ce7bb43b115d08e190b93e0ce090ae3475.zip |
Fixed a couple of SMSPeakDetection bugs and updated the unit tests
Diffstat (limited to 'sms/soundIO.c')
-rw-r--r-- | sms/soundIO.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/sms/soundIO.c b/sms/soundIO.c index 32f5c1d..1de75d6 100644 --- a/sms/soundIO.c +++ b/sms/soundIO.c @@ -28,31 +28,30 @@ const char *pChResidualFile = "residual.aiff"; /*! \brief fill the sound buffer * - * \param sizeWaveform size of input data - * \param pWaveform input data - * \param pAnalParams pointer to structure of analysis parameters + * \param sizeWaveform size of input data + * \param pWaveform input data + * \param pAnalParams pointer to structure of analysis parameters */ -void sms_fillSoundBuffer (int sizeWaveform, sfloat *pWaveform, SMS_AnalParams *pAnalParams) +void sms_fillSoundBuffer(int sizeWaveform, sfloat *pWaveform, SMS_AnalParams *pAnalParams) { - int i; - long sizeNewData = (long) sizeWaveform; + int i; + long sizeNewData = (long)sizeWaveform; - /* leave space for new data */ - memcpy(pAnalParams->soundBuffer.pFBuffer, pAnalParams->soundBuffer.pFBuffer+sizeNewData, + /* leave space for new data */ + memcpy(pAnalParams->soundBuffer.pFBuffer, pAnalParams->soundBuffer.pFBuffer+sizeNewData, sizeof(sfloat) * (pAnalParams->soundBuffer.sizeBuffer - sizeNewData)); - pAnalParams->soundBuffer.iFirstGood = - MAX(0, pAnalParams->soundBuffer.iFirstGood - sizeNewData); - pAnalParams->soundBuffer.iMarker += sizeNewData; + pAnalParams->soundBuffer.iFirstGood = MAX(0, pAnalParams->soundBuffer.iFirstGood - sizeNewData); + pAnalParams->soundBuffer.iMarker += sizeNewData; - /* put the new data in, and do some pre-emphasis */ - if (pAnalParams->iAnalysisDirection == SMS_DIR_REV) - for (i=0; i<sizeNewData; i++) - pAnalParams->soundBuffer.pFBuffer[pAnalParams->soundBuffer.sizeBuffer - sizeNewData + i] = - sms_preEmphasis(pWaveform[sizeNewData - (1+ i)], pAnalParams); - else - for (i=0; i<sizeNewData; i++) - pAnalParams->soundBuffer.pFBuffer[pAnalParams->soundBuffer.sizeBuffer - sizeNewData + i] = - sms_preEmphasis(pWaveform[i], pAnalParams); + /* put the new data in, and do some pre-emphasis */ + if (pAnalParams->iAnalysisDirection == SMS_DIR_REV) + for (i=0; i<sizeNewData; i++) + pAnalParams->soundBuffer.pFBuffer[pAnalParams->soundBuffer.sizeBuffer - sizeNewData + i] = + sms_preEmphasis(pWaveform[sizeNewData - (1+ i)], pAnalParams); + else + for (i=0; i<sizeNewData; i++) + pAnalParams->soundBuffer.pFBuffer[pAnalParams->soundBuffer.sizeBuffer - sizeNewData + i] = + sms_preEmphasis(pWaveform[i], pAnalParams); } |