GlobalVariable.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef __GLOBAL_VARIABLE_H__
  2. #define __GLOBAL_VARIABLE_H__
  3. #include <QString>
  4. #include <QList>
  5. #include <QChar>
  6. /* ====================================================================
  7. * 声卡相关信息结构体
  8. * ==================================================================== */
  9. /* 单个录音通道信息,带有频道信息 */
  10. struct OneRoadInfo_t
  11. {
  12. int nRoadNum = -1; /* 录音通道编号 */
  13. int nChannelID = -1; /* 频道ID */
  14. QString strChannelName; /* 频道名称 */
  15. };
  16. /**
  17. * @brief 声卡信息,这里的信息都是设备上和物理声卡相关的
  18. *
  19. */
  20. struct SoundCardInfo_t
  21. {
  22. int nSoundCardNum = -1; /* 声卡编号 */
  23. QString strSoundCardID; /* 声卡ID,这个是声卡名称,可以用来打开 */
  24. QString strSoundCardName; /* 声卡名称 */
  25. QString strSoundCardDriver; /* 声卡驱动名称 */
  26. QList<OneRoadInfo_t> listRoad; /* 录音通道列表,存储通道编号 */
  27. };
  28. /**
  29. * @brief 单个声卡通道信息,带有声卡自身的信息
  30. *
  31. */
  32. struct SoundCardRoadInfo_t
  33. {
  34. int nSoundCardNum = -1; /* 声卡编号 */
  35. QString strSoundCardID; /* 声卡ID,这个是声卡名称,可以用来打开 */
  36. QString strSoundCardName; /* 声卡名称 */
  37. OneRoadInfo_t roadInfo; /* 单个通道信息 */
  38. };
  39. /* 注册数据类型到系统 */
  40. Q_DECLARE_METATYPE(SoundCardRoadInfo_t)
  41. /* ====================================================================
  42. * CompareItemInfo_t对比项结构体
  43. * ==================================================================== */
  44. /**
  45. * @brief 对比项信息在表格中的显示结构体
  46. *
  47. */
  48. struct CompareItemTableItem_t
  49. {
  50. int nSerialNum; /* 序号,在表格中的序号 */
  51. int nID; /* 对比项ID */
  52. QString strName; /* 对比项名称 */
  53. bool isEnable; /* 对比项状态,是否启用 */
  54. int nChannelCount; /* 通道数 */
  55. };
  56. /* 对比项的通道信息 */
  57. struct CompareItemRoadInfo_t
  58. {
  59. bool isEnableRecord; /* 是否开启录音 */
  60. int nCompareRoadNum; /* 对比通道编号,1是主通道,其余往后排 */
  61. QString strCompareRoadName; /* 通道名称 */
  62. SoundCardRoadInfo_t scRoadInfo; /* 声卡通道信息,包含声卡编号和通道编号 */
  63. };
  64. /* 检测阈值,静音和过载是整数,反相是小数 */
  65. union Threshold_t
  66. {
  67. uint64_t nThreshold; /* 静音和过载的阈值 */
  68. double dThreshold; /* 反相的阈值 */
  69. };
  70. /**
  71. * @brief 静音、过载、反相检测参数
  72. *
  73. */
  74. struct CompareItemDetectParam_t
  75. {
  76. bool isEnable = false; /* 是否启用检测 */
  77. Threshold_t threshold; /* 检测阈值 */
  78. int nLen = 0; /* 检测长度,单位秒 */
  79. int nSensibility = 0; /* 敏感度,0-100,0最不敏感,100最敏感 */
  80. CompareItemDetectParam_t() = default;
  81. CompareItemDetectParam_t(const CompareItemDetectParam_t &other);
  82. CompareItemDetectParam_t& operator=(const CompareItemDetectParam_t &other);
  83. };
  84. /**
  85. * @brief 对比项信息
  86. *
  87. */
  88. struct CompareItemInfo_t
  89. {
  90. int nID = -1; /* 对比项ID,对比项唯一识别号,不可更改 */
  91. QString strName; /* 对比项名称 */
  92. bool isEnable = false; /* 对比项状态,是否启用 */
  93. QList<CompareItemRoadInfo_t> listRoads; /* 通道信息列表 */
  94. CompareItemDetectParam_t paramMute; /* 静音检测参数 */
  95. CompareItemDetectParam_t paramOverload; /* 过载检测参数 */
  96. CompareItemDetectParam_t paramPhase; /* 反相检测参数 */
  97. CompareItemInfo_t() = default;
  98. CompareItemInfo_t(const CompareItemInfo_t &other);
  99. CompareItemInfo_t& operator=(const CompareItemInfo_t &other);
  100. };
  101. #endif // __GLOBAL_VARIABLE_H__