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.

cmRtSysMsg.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 cmRtSysMsg_h
  4. #define cmRtSysMsg_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc:"rtSys message contants and data structures." kw:[rtsys] }
  9. // Reserved DSP message selector id's (second field of all
  10. // host<->audio system messages)
  11. enum
  12. {
  13. kMidiMsgArraySelRtId = 1000,
  14. kMidiSysExSelRtId,
  15. kUiDrvrSelRtId, // cmUiDriverArg_t message to/from the UI driver
  16. kUiSelRtId, // cmUiDriverArg_t message from the UI mgr to a client
  17. kUiMstrSelRtId, // indicates a cmDspUiHdr_t msg containing master control information for the audio system
  18. kStatusSelRtId, // indicates the msg is of type cmRtSysStatus_t
  19. kNetSyncSelRtId, // sent with a cmDspNetMsg_t object
  20. kMsgSelRtId, // client defined msg transmitted between threads or network nodes
  21. };
  22. typedef struct
  23. {
  24. unsigned rtSubIdx;
  25. unsigned selId; // Message selector id See kXXXSelRtId above
  26. } cmRtSysMsgHdr_t;
  27. // All of the UI messages that create a UI control contain an array of integers
  28. // as in the 'value' field. The array contains the id's associated with
  29. // the different programmable paramters which are part of the control.
  30. // For example a slider control has minimum,maximum, step size, and value
  31. // parameters. The location in the array is hard coded according to the
  32. // parameters meaning but the actual value of the id is left up to the
  33. // engine. This allows the engine to use whatever values work best for
  34. // it on a per instance basis.
  35. // Header record for all messages between the host and the DSP controllers.
  36. typedef struct
  37. {
  38. cmRtSysMsgHdr_t hdr;
  39. unsigned devIdx;
  40. unsigned chIdx;
  41. bool inFl;
  42. unsigned ctlId;
  43. double value;
  44. } cmRtSysMstr_t;
  45. // Control id's used to identify the control type of master contols.
  46. enum
  47. {
  48. kSliderUiRtId = 0,
  49. kMeterUiRtId = 1,
  50. kMuteUiRtId = 2,
  51. kToneUiRtId = 3,
  52. kPassUiRtId = 4
  53. };
  54. // Audio sub-system status record - this message can be transmitted to the host at
  55. // periodic intervals. See cmRtSysStatusNotifyEnable().
  56. // When transmitted to the host this record acts as the message header.
  57. // This header is followed by two arrays of doubles containing the input
  58. // and output meter values associated with the input and output audio devices.
  59. // Message Layout:
  60. // [ rtSubIdx kStatusSelId cmRtSysStatus_t iMeterArray[iMeterCnt] oMeterArray[oMeterCnt] ]
  61. typedef struct
  62. {
  63. cmRtSysMsgHdr_t hdr;
  64. unsigned updateCnt; // count of callbacks from the audio devices.
  65. unsigned wakeupCnt; // count of times the audio system thread has woken up after the cond. var has been signaled by the audio update thread.
  66. unsigned msgCbCnt; // count of msgs delivered via cmRtCallback() .
  67. unsigned audioCbCnt; // count of times the DSP execution was requested via cmRtCallback().
  68. unsigned iDevIdx; // Input device index
  69. unsigned oDevIdx; // Output device index
  70. unsigned overflowCnt; // count of times the audio input buffers overflowed
  71. unsigned underflowCnt; // count of times the audio output buffers underflowed
  72. unsigned iMeterCnt; // count of input meter channels
  73. unsigned oMeterCnt; // count of output meter channels
  74. } cmRtSysStatus_t;
  75. typedef struct
  76. {
  77. cmRtSysMsgHdr_t hdr;
  78. unsigned devIdx;
  79. unsigned portIdx;
  80. unsigned msgCnt;
  81. // cmMidiMsg msgArray[msgCnt]
  82. } cmRtSysMidi_t;
  83. typedef struct
  84. {
  85. cmRtSysMsgHdr_t hdr; // hdr.rtSubIdx = dest rtSubIdx
  86. // hdr.selId = msg contents
  87. unsigned dstEndPtId; // = dest endpoint
  88. unsigned srcEndPtId; // = src endpoint id
  89. unsigned srcNodeIdx; // = src node index (filled in by receiving cmRtNet mgr)
  90. // char msg[ msgByteCnt ]
  91. } cmRtNetMsg_t;
  92. //)
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif