libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmAudioFileMgr.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef cmAudioFileMgr_h
  2. #define cmAudioFileMgr_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkAfmRC = cmOkRC,
  9. kAudioFileFailAfmRC
  10. };
  11. typedef cmHandle_t cmAfmH_t;
  12. typedef cmHandle_t cmAfmFileH_t;
  13. typedef cmRC_t cmAfmRC_t;
  14. extern cmAfmH_t cmAfmNullHandle;
  15. extern cmAfmFileH_t cmAfmFileNullHandle;
  16. //----------------------------------------------------------------------------
  17. // Audio Files
  18. //----------------------------------------------------------------------------
  19. cmAfmRC_t cmAfmFileOpen( cmAfmH_t h, cmAfmFileH_t* fhp, const cmChar_t* audioFn, unsigned fileId, cmAudioFileInfo_t* afInfo );
  20. cmAfmRC_t cmAfmFileClose( cmAfmFileH_t* fhp );
  21. bool cmAfmFileIsValid( cmAfmFileH_t fh );
  22. // Return the application supplied file id associated with this file.
  23. // This value was set by the 'fileId' argument to cmAfmFileOpen().
  24. unsigned cmAfmFileId( cmAfmFileH_t fh );
  25. // Return the file handle associated with this file.
  26. cmAudioFileH_t cmAfmFileHandle( cmAfmFileH_t fh );
  27. // Return a pointer to the information record associated with this file.
  28. const cmAudioFileInfo_t* cmAfmFileInfo( cmAfmFileH_t fh );
  29. // Summarize min and max values of the downSampled audio file.
  30. // The summary is kept in an internal cache which is used to
  31. // optimize the time required to complete later calls to cmAfmFileGetSummary().
  32. // 'downSampleFactor' is the count of samples per summary point.
  33. cmAfmRC_t cmAfmFileSummarize( cmAfmFileH_t fh, unsigned downSampleFactor );
  34. // Return a summary of the samples in the range audio file range
  35. // begSmpIdx:begSmpIdx+smpCnt-1 reduced or expanded to 'outCnt' values
  36. // in minV[outCnt] and maxV[outCnt].
  37. // If 'outCnt' is equal to 'smpCnt' then the actual sample values are returned.
  38. cmAfmRC_t cmAfmFileGetSummary( cmAfmFileH_t fh, unsigned chIdx, unsigned begSmpIdx, unsigned smpCnt, cmSample_t* minV, cmSample_t* maxV, unsigned outCnt );
  39. //----------------------------------------------------------------------------
  40. // Audio File Manager
  41. //----------------------------------------------------------------------------
  42. cmAfmRC_t cmAfmCreate( cmCtx_t* ctx, cmAfmH_t* hp );
  43. cmAfmRC_t cmAfmDestroy( cmAfmH_t* hp );
  44. bool cmAfmIsValid( cmAfmH_t h );
  45. cmAfmFileH_t cmAfmIdToHandle( cmAfmH_t h, unsigned fileId );
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif