libcm is a C development framework with an emphasis on audio signal processing applications.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

cmAudioSysMsg.h 4.8KB

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