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.6KB

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