From b05255c4434b69c07579bba29b60e727b40e802b Mon Sep 17 00:00:00 2001 From: Kevin Larke Date: Sun, 10 Aug 2014 13:00:17 -0700 Subject: [PATCH] cmProc.h/c: cmAudioFileRd now recognizes 'endSmpIdx' == 0 as an indication to read 'procSmpCnt' blocks until the end-of-file is reached. --- cmProc.c | 2 +- cmProc.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmProc.c b/cmProc.c index da04f5d..1aee6fc 100644 --- a/cmProc.c +++ b/cmProc.c @@ -124,7 +124,7 @@ cmRC_t cmAudioFileRdOpen( cmAudioFileRd* p, unsigned procSmpCnt, p->lastReadFrmCnt = 0; p->eofFl = false; p->begFrmIdx = begFrmIdx; - p->endFrmIdx = endFrmIdx; + p->endFrmIdx = endFrmIdx==0 ? p->info.frameCnt : endFrmIdx; p->curFrmIdx = p->begFrmIdx; if( p->begFrmIdx > 0 ) diff --git a/cmProc.h b/cmProc.h index 6e39cba..5034fb6 100644 --- a/cmProc.h +++ b/cmProc.h @@ -26,7 +26,8 @@ extern "C" { /// set p to NULL to dynamically allocate the object /// fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file. /// If fn is valid then chIdx must also be valid. - /// Set 'endSmpIdx' to cmInvalidIdx to not limit the range of samples returned. + /// Set 'endSmpIdx' to cmInvalidIdx to return the entire signal in cmAudioFileRdRead(). + /// Set 'endSmpIdx' to 0 to return all samples between 0 and the end of the file. cmAudioFileRd* cmAudioFileRdAlloc( cmCtx* c, cmAudioFileRd* p, unsigned procSmpCnt, const char* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx ); cmRC_t cmAudioFileRdFree( cmAudioFileRd** p ); cmRC_t cmAudioFileRdOpen( cmAudioFileRd* p, unsigned procSmpCnt, const cmChar_t* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx );