libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cmMsgProtocol.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef cmMsgProtocol_h
  2. #define cmMsgProtocol_h
  3. #include "cmAudioSysMsg.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #define cmAudDspSys_FILENAME "aud_dsp.js"
  8. // UI seletor id's used in the cmDspUiHdr_t selId field
  9. enum
  10. {
  11. kPrintDuiId, // ui<--eng print the value to the console
  12. kSliderDuiId, // ui<--eng create a slider control
  13. kButtonDuiId, // ui<--eng create button control
  14. kCheckDuiId, // ui<--eng create a check box control
  15. kLabelDuiId, // ui<--end create a label control
  16. kTimeLineDuiId,// ui<--end create a time-line control
  17. kScoreDuiId, // ui<--end create a score control
  18. kNumberDuiId, // ui<--eng create a number box
  19. kTextDuiId, // ui<--eng create a text entry control
  20. kFnameDuiId, // ui<--eng create a file/directory picker control
  21. kMsgListDuiId, // ui<--eng create a msg list control
  22. kMeterDuiId, // ui<--eng create a meter display
  23. kValueDuiId, // ui<->eng a control changed values
  24. kColumnDuiId, // ui<--eng start a new column
  25. kHBorderDuiId, // ui<--eng insert a vertical border
  26. kPageDuiId, // ui<--eng insert a new control page
  27. kAudioSysCfgDuiId, // ui<--audio system cfg label
  28. kSubSysCntDuiId, // ui<--eng audio sub-system count
  29. kDeviceDuiId, // ui<--eng device label
  30. kProgramDuiId, // ui<--eng program label
  31. // The following selId's are used by cmAudDsp to indicate various commands.
  32. kSetAudioCfgDuiId, // 1) select an audio system setup
  33. kSetAudioDevDuiId, // 2) (optional) set an audio device on an audio sub-system
  34. kSetSampleRateDuiId, // 3) (optional) set the sample rate of an audio sub-system
  35. kSetPgmDuiId, // 4) select a program
  36. kEnableDuiId, // 5) enable/disable the audio system (also resets the DSP system)
  37. kSyncDuiId, // 6) sent by cmAudDsp to client to indicate sync success or failure.
  38. kSetNotifyEnableDuiId, // enable/disable periodic status notification from the audio system.
  39. kClientMsgPollDuiId, // Periodic check for and deliver messages waiting in the audio system for delivery to the client.
  40. kSendMsgDuiId, // forward msg to the audio system
  41. kDevReportDuiId, // print a device report
  42. kRightAlignDuiId = 0, // label alignment id used by kLabelDuiId
  43. kLeftAlignDuiId,
  44. kCenterAlignDuiId
  45. };
  46. enum
  47. {
  48. kDuplexDuiFl = 0x01
  49. };
  50. // Header record for all messages between the host and the DSP controllers.
  51. typedef struct
  52. {
  53. unsigned asSubIdx; // the audio sub-system this UI belongs to
  54. unsigned uiId; // msg type kXXXAsId
  55. unsigned selId; // action to perform see above
  56. unsigned flags; //
  57. unsigned instId; // DSP instance id
  58. unsigned instVarId; // DSP instance var id
  59. // The cmDspValue_t field must come last in the structure in
  60. // order for the cmDsvSerialize() to work in cmDspUI.c:_cmDspUiMsg().
  61. cmDspValue_t value; // Data value associated with this msg.
  62. } cmDspUiHdr_t;
  63. // cmDspNetMsg_t sub-selector id's
  64. enum {
  65. kNetHelloSelAsId, // node->node awake msg
  66. kNetDstIdReqSelAsId, // src->dst request a dst id
  67. kNetDstIdReqDoneAsId, // src->dst all requests have been sent
  68. kNetDstIdSelAsId, // dst->src provide dst id
  69. kNetDoneSelAsId, // node->node sync done
  70. kNetErrSelAsId, // node->node sync error
  71. kNetEvtSelAsId // src->dst send cmDspEvnt_t
  72. };
  73. // Message Layout [ cmDspNetMsg_t dstInstLabel[] dstVarLabel[] ]
  74. typedef struct
  75. {
  76. unsigned asSubIdx;
  77. unsigned selId; // kNetSyncSelAsId
  78. unsigned subSelId; // see above kNetXXXSelAsId
  79. unsigned srcId;
  80. unsigned dstId;
  81. cmDspValue_t value;
  82. // char dstInstLabel[] - with kNetSyncSelAsId only
  83. // char dstVarLabel[] - with kNetSyncSelAsId only
  84. } cmDspNetMsg_t;
  85. enum
  86. {
  87. kOkMsgRC = cmOkRC,
  88. kSerializeFailMsgRC,
  89. kSendFailMsgRC,
  90. kDecodeFailMsgRC
  91. };
  92. typedef cmRC_t cmMsgRC_t;
  93. typedef cmMsgRC_t (*cmMsgSendFuncPtr_t)(void* cbDataPtr, unsigned msgByteCnt, const void* msg );
  94. cmMsgRC_t cmMsgSend(
  95. cmErr_t* err,
  96. unsigned asSubIdx,
  97. unsigned msgTypeId,
  98. unsigned selId,
  99. unsigned flags,
  100. unsigned instId,
  101. unsigned instVarId,
  102. const cmDspValue_t* valPtr,
  103. cmMsgSendFuncPtr_t sendFunc,
  104. void* cbDataPtr );
  105. cmMsgRC_t cmMsgPeekAsSubIndex( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
  106. cmMsgRC_t cmMsgPeekMsgTypeId( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
  107. cmMsgRC_t cmMsgPeekSelId( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
  108. cmMsgRC_t cmMsgPeekFlags( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
  109. cmMsgRC_t cmMsgPeekInstId( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
  110. cmMsgRC_t cmMsgPeekInstVarId( const void* msgArray[], unsigned msgByteCntArray[], unsigned segCnt, unsigned* retValPtr );
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif