GlobalVariable.h 4.3 KB

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