libcm is a C development framework with an emphasis on audio signal processing applications.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

cmAudioSysMsg.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef cmAudioSysMsg_h
  2. #define cmAudioSysMsg_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //( { file_desc:"Constrants and data structures used to communicate messages to and from cmAudioSys" kw:[audio real_time]}
  7. /// Reserved DSP message selector id's (second field of all host<->audio system messages)
  8. enum
  9. {
  10. kMidiMsgArraySelAsId = 1000,
  11. kMidiSysExSelAsId,
  12. kUiSelAsId, // indicates a cmDspUiHdr_t msg
  13. kUiMstrSelAsId, // indicates a cmDspUiHdr_t msg containing master control information for the audio system
  14. kSsInitSelAsId, // indicates the msg is of type cmAudioSysSsInitMsg_t
  15. kStatusSelAsId, // indicates the msg is of type cmAudioSysStatus_t
  16. kNetSyncSelAsId, // sent with a cmDspNetMsg_t object
  17. };
  18. typedef struct
  19. {
  20. unsigned asSubIdx;
  21. unsigned selAsId; // Message selector id See kXXXSelAsId above
  22. unsigned selId; // Message specific selector
  23. } cmAudioSysMsg_t;
  24. // All of the UI messages that create a UI control contain an array of integers
  25. // as in the 'value' field. The array contains the id's associated with
  26. // the different programmable paramters which are part of the control.
  27. // For example a slider control has minimum,maximum, step size, and value
  28. // parameters. The location in the array is hard coded according to the
  29. // parameters meaning but the actual value of the id is left up to the
  30. // engine. This allows the engine to use whatever values work best for
  31. // it on a per instance basis.
  32. // Header record for all messages between the host and the DSP controllers.
  33. typedef struct
  34. {
  35. unsigned asSubIdx; // the audio sub-system this UI belongs to
  36. unsigned uiId; // msg type kXXXAsId
  37. unsigned selId; // action to perform see above
  38. unsigned flags; //
  39. unsigned instId; // DSP instance id
  40. unsigned instVarId; // DSP instance var id
  41. unsigned rsrvd;
  42. double value;
  43. } cmAudioSysMstr_t;
  44. /// The cmDspUiHdr_t.instId of UI control messages associated with master
  45. /// control encode the device,channel,in/out, and control type. These macros
  46. /// should be used for encoding and decoding.
  47. #define cmAudioSysFormUiInstId(dev,ch,ifl,ctl) (((dev)<<16) + ((ch)<<4) + ((ifl)<<3) + (ctl))
  48. #define cmAudioSysUiInstIdToDevIndex(instId) ( (instId) >> 16)
  49. #define cmAudioSysUiInstIdToChIndex(instId) (((instId) & 0x0000ffff) >> 4)
  50. #define cmAudioSysUiInstIdToInFlag(instId) ( (instId) & 0x08)
  51. #define cmAudioSysUiInstIdToCtlId(instId) ( (instId) & 0x07)
  52. /// Control id's used to identify the control type of master contols.
  53. enum
  54. {
  55. kSliderUiAsId = 0,
  56. kMeterUiAsId = 1,
  57. kMuteUiAsId = 2,
  58. kToneUiAsId = 3,
  59. kPassUiAsId = 4
  60. };
  61. /// This message is transmitted to the host application just prior to returning
  62. /// from cmAudioSysInitialize().
  63. /// When transmitted to the host this record acts as a message header.
  64. /// This header is followed by two zero terminated char arrays containing the device
  65. /// labels associated with the input and output devices.
  66. /// Message Layout: [ cmAudioSysInitMsg_t "In Device Label" "Out Device Label"]
  67. typedef struct
  68. {
  69. unsigned asSubIdx; ///< asSubIdx of this sub-system
  70. unsigned selId; ///< always kSsInitAsId
  71. unsigned asSubCnt; ///< count of sub-systems
  72. unsigned inDevIdx; ///< input device index
  73. unsigned outDevIdx; ///< output device index
  74. unsigned dspFramesPerCycle;
  75. double srate;
  76. unsigned inChCnt; ///< input device channel count
  77. unsigned outChCnt; ///< outut device channel count
  78. } cmAudioSysSsInitMsg_t;
  79. /// Audio sub-system status record - this message can be transmitted to the host at
  80. /// periodic intervals. See cmAudioSysStatusNotifyEnable().
  81. /// When transmitted to the host this record acts as the message header.
  82. /// This header is followed by two arrays of doubles containing the input and output meter values
  83. /// associated with the input and output audio devices.
  84. /// Message Layout: [ asSubIdx kStatusSelId cmAudioSysStatus_t iMeterArray[iMeterCnt] oMeterArray[oMeterCnt] ]
  85. typedef struct
  86. {
  87. unsigned asSubIdx; ///< originating audio sub-system
  88. unsigned updateCnt; ///< count of callbacks from the audio devices.
  89. unsigned wakeupCnt; ///< count of times the audio system thread has woken up after the cond. var has been signaled by the audio update thread.
  90. unsigned msgCbCnt; ///< count of msgs delivered via cmAsCallback() .
  91. unsigned audioCbCnt; ///< count of times the DSP execution was requested via cmAsCallback().
  92. unsigned iDevIdx; ///< Input device index
  93. unsigned oDevIdx; ///< Output device index
  94. unsigned overflowCnt; ///< count of times the audio input buffers overflowed
  95. unsigned underflowCnt; ///< count of times the audio output buffers underflowed
  96. unsigned iMeterCnt; ///< count of input meter channels
  97. unsigned oMeterCnt; ///< count of output meter channels
  98. } cmAudioSysStatus_t;
  99. //)
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif