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.

cmMsgProtocol.h 5.4KB

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