libcm is a C development framework with an emphasis on audio signal processing applications.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

cmAudioFileMgr.h 2.5KB

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