libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmMsgProtocol.h 5.5KB

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