Browse Source

cmProc.h/c: cmAudioFileRd now recognizes 'endSmpIdx' == 0 as an indication to

read 'procSmpCnt' blocks until the end-of-file is reached.
master
Kevin Larke 10 years ago
parent
commit
b05255c443
2 changed files with 3 additions and 2 deletions
  1. 1
    1
      cmProc.c
  2. 2
    1
      cmProc.h

+ 1
- 1
cmProc.c View File

124
   p->lastReadFrmCnt = 0;
124
   p->lastReadFrmCnt = 0;
125
   p->eofFl          = false;
125
   p->eofFl          = false;
126
   p->begFrmIdx      = begFrmIdx;
126
   p->begFrmIdx      = begFrmIdx;
127
-  p->endFrmIdx      = endFrmIdx;
127
+  p->endFrmIdx      = endFrmIdx==0 ? p->info.frameCnt : endFrmIdx;
128
   p->curFrmIdx      = p->begFrmIdx;
128
   p->curFrmIdx      = p->begFrmIdx;
129
 
129
 
130
   if( p->begFrmIdx > 0 )
130
   if( p->begFrmIdx > 0 )

+ 2
- 1
cmProc.h View File

26
   /// set p to NULL to dynamically allocate the object
26
   /// set p to NULL to dynamically allocate the object
27
   /// fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file.
27
   /// fn and chIdx are optional - set fn to NULL to allocate the reader without opening a file.
28
   /// If fn is valid then chIdx must also be valid.
28
   /// If fn is valid then chIdx must also be valid.
29
-  /// Set 'endSmpIdx' to cmInvalidIdx to not limit the range of samples returned.
29
+  /// Set 'endSmpIdx' to cmInvalidIdx to return the entire signal in cmAudioFileRdRead().
30
+  /// Set 'endSmpIdx' to 0 to return all samples between 0 and the end of the file.
30
   cmAudioFileRd*     cmAudioFileRdAlloc( cmCtx* c, cmAudioFileRd* p, unsigned procSmpCnt, const char* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx );
31
   cmAudioFileRd*     cmAudioFileRdAlloc( cmCtx* c, cmAudioFileRd* p, unsigned procSmpCnt, const char* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx );
31
   cmRC_t             cmAudioFileRdFree(  cmAudioFileRd** p );
32
   cmRC_t             cmAudioFileRdFree(  cmAudioFileRd** p );
32
   cmRC_t             cmAudioFileRdOpen(  cmAudioFileRd* p, unsigned procSmpCnt,  const cmChar_t* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx ); 
33
   cmRC_t             cmAudioFileRdOpen(  cmAudioFileRd* p, unsigned procSmpCnt,  const cmChar_t* fn, unsigned chIdx, unsigned begSmpIdx, unsigned endSmpIdx ); 

Loading…
Cancel
Save