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.

cmAudioBuf.h 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //| Copyright: (C) 2009-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. #ifndef cmAudioBuf_h
  4. #define cmAudioBuf_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( {file_desc: "Obsolete audio buffer class. This class is superceded by cmApBuf."}
  9. enum
  10. {
  11. kOkBaRC = cmOkRC
  12. kBufOverunBaRC,
  13. kBufUnderunBaRC
  14. };
  15. enum
  16. {
  17. kInBaFl = 0x01,
  18. kOutBaFl = 0x02
  19. };
  20. typedef cmRC_t cmBaRC_t;
  21. cmBaRC_t cmAudioBufInit( cmCtx_t* ctx, unsigned devCnt );
  22. cmBaRC_t cmAudioBufFinal();
  23. cmBaRC_t cmAudioBufSetup(
  24. unsigned devIdx,
  25. unsigned cycleCnt,
  26. unsigned inSubDevCnt,
  27. unsigned inChCnt,
  28. unsigned inFrameCnt,
  29. unsigned outChCnt,
  30. unsigned outFrameCnt,
  31. unsigned outSubDevCnt );
  32. // Called from the audio driver within incoming samples to store (inPktArray)
  33. // and empty buffers (outPktArray) to fill with outgoin samples.
  34. cmBaRC_t cmAudioBufUpdate(
  35. cmApAudioPacket_t* inPktArray, ///< full audio packets from incoming audio (from ADC)
  36. unsigned inPktCnt, ///< count of incoming audio packets
  37. cmApAudioPacket_t* outPktArray, ///< empty audio packet for outgoing audio (to DAC)
  38. unsigned outPktCnt ///< count of outgoing audio packets
  39. );
  40. bool cmAudioBufIsDeviceReady( unsigned devIdx, unsigned flags );
  41. cmBaRC_t cmAudioBufGet(
  42. unsigned devIdx,
  43. unsigned flags,
  44. cmApAudioPacket_t* pktArray[],
  45. unsigned pktCnt );
  46. cmBaRC_t cmAudioBufAdvance( unsigned devIdx, unsigned flags );
  47. //)
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif