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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef cmAudioBuf_h
  2. #define cmAudioBuf_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkBaRC = cmOkRC
  9. kBufOverunBaRC,
  10. kBufUnderunBaRC
  11. };
  12. enum
  13. {
  14. kInBaFl = 0x01,
  15. kOutBaFl = 0x02
  16. };
  17. typedef cmRC_t cmBaRC_t;
  18. cmBaRC_t cmAudioBufInit( cmCtx_t* ctx, unsigned devCnt );
  19. cmBaRC_t cmAudioBufFinal();
  20. cmBaRC_t cmAudioBufSetup(
  21. unsigned devIdx,
  22. unsigned cycleCnt,
  23. unsigned inSubDevCnt,
  24. unsigned inChCnt,
  25. unsigned inFrameCnt,
  26. unsigned outChCnt,
  27. unsigned outFrameCnt,
  28. unsigned outSubDevCnt );
  29. // Called from the audio driver within incoming samples to store (inPktArray)
  30. // and empty buffers (outPktArray) to fill with outgoin samples.
  31. cmBaRC_t cmAudioBufUpdate(
  32. cmApAudioPacket_t* inPktArray, ///< full audio packets from incoming audio (from ADC)
  33. unsigned inPktCnt, ///< count of incoming audio packets
  34. cmApAudioPacket_t* outPktArray, ///< empty audio packet for outgoing audio (to DAC)
  35. unsigned outPktCnt ///< count of outgoing audio packets
  36. );
  37. bool cmAudioBufIsDeviceReady( unsigned devIdx, unsigned flags );
  38. cmBaRC_t cmAudioBufGet(
  39. unsigned devIdx,
  40. unsigned flags,
  41. cmApAudioPacket_t* pktArray[],
  42. unsigned pktCnt );
  43. cmBaRC_t cmAudioBufAdvance( unsigned devIdx, unsigned flags );
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif