GlobalVariable.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #ifndef __GLOBAL_VARIABLE_H__
  2. #define __GLOBAL_VARIABLE_H__
  3. #include <QString>
  4. #include <QList>
  5. #include <QChar>
  6. #include <QMap>
  7. #include <QDateTime>
  8. /**
  9. * @brief 星期枚举定义,星期八是带有日期的特殊日
  10. *
  11. */
  12. enum class eWeekType
  13. {
  14. Week_Monday = 1, /* 星期一 */
  15. Week_Tuesday, /* 星期二 */
  16. Week_Wednesday, /* 星期三 */
  17. Week_Thursday, /* 星期四 */
  18. Week_Friday, /* 星期五 */
  19. Week_Saturday, /* 星期六 */
  20. Week_Sunday, /* 星期日 */
  21. Week_Special, /* 特殊日期 */
  22. };
  23. /**
  24. * @brief 一条计划
  25. *
  26. */
  27. struct OnePlan_t
  28. {
  29. eWeekType weekType; /* 星期类型 */
  30. QDate date; /* 日期,格式为YYYY-MM-DD */
  31. QTime timeStart; /* 时间,格式为HH:mm:ss */
  32. QTime timeEnd; /* 时间,格式为HH:mm:ss */
  33. };
  34. /* ====================================================================
  35. * 声卡相关信息结构体
  36. * ==================================================================== */
  37. /* 单个录音通道信息,带有频道信息 */
  38. struct OneRoadInfo_t
  39. {
  40. int nRoadNum = -1; /* 录音通道编号 */
  41. int nChannelID = -1; /* 频道ID */
  42. QString strChannelName; /* 频道名称 */
  43. };
  44. /**
  45. * @brief 声卡信息,这里的信息都是设备上和物理声卡相关的
  46. *
  47. */
  48. struct SoundCardInfo_t
  49. {
  50. int nSoundCardNum = -1; /* 声卡编号 */
  51. QString strSoundCardID; /* 声卡ID,这个是声卡名称,可以用来打开 */
  52. QString strSoundCardName; /* 声卡名称 */
  53. QString strSoundCardDriver; /* 声卡驱动名称 */
  54. QList<OneRoadInfo_t> listRoad; /* 录音通道列表,存储通道编号 */
  55. };
  56. /**
  57. * @brief 单个声卡通道信息,带有声卡自身的信息
  58. *
  59. */
  60. struct SoundCardRoadInfo_t
  61. {
  62. int nSoundCardNum = -1; /* 声卡编号 */
  63. QString strSoundCardID; /* 声卡ID,这个是声卡名称,可以用来打开 */
  64. QString strSoundCardName; /* 声卡名称 */
  65. OneRoadInfo_t roadInfo; /* 单个通道信息 */
  66. };
  67. /* 注册数据类型到系统 */
  68. Q_DECLARE_METATYPE(SoundCardRoadInfo_t)
  69. /* ====================================================================
  70. * CompareItemInfo_t对比项结构体
  71. * ==================================================================== */
  72. /**
  73. * @brief 对比项信息在表格中的显示结构体
  74. *
  75. */
  76. struct CompareItemTableItem_t
  77. {
  78. int nSerialNum; /* 序号,在表格中的序号 */
  79. int nID; /* 对比项ID */
  80. QString strName; /* 对比项名称 */
  81. bool isEnable; /* 对比项状态,是否启用 */
  82. int nChannelCount; /* 通道数 */
  83. };
  84. /* 对比项的通道信息 */
  85. struct CompareItemRoadInfo_t
  86. {
  87. bool isEnableRecord; /* 是否开启录音 */
  88. int nCompareRoadNum; /* 对比通道编号,1是主通道,其余往后排 */
  89. QString strCompareRoadName; /* 通道名称 */
  90. SoundCardRoadInfo_t scRoadInfo; /* 声卡通道信息,包含声卡编号和通道编号 */
  91. bool operator==(const CompareItemRoadInfo_t &other) const;
  92. };
  93. /* 检测阈值,静音和过载是整数,反相是小数 */
  94. union Threshold_t
  95. {
  96. uint64_t nThreshold; /* 静音和过载的阈值 */
  97. double dThreshold; /* 反相的阈值 */
  98. };
  99. /**
  100. * @brief 静音、过载、反相检测参数
  101. *
  102. */
  103. struct CompareItemDetectParam_t
  104. {
  105. bool isEnable = false; /* 是否启用检测 */
  106. Threshold_t threshold; /* 检测阈值 */
  107. int nLen = 0; /* 检测长度,单位秒 */
  108. int nSensitivity = 0; /* 敏感度,0-100,0最不敏感,100最敏感 */
  109. CompareItemDetectParam_t() = default;
  110. CompareItemDetectParam_t(const CompareItemDetectParam_t &other);
  111. CompareItemDetectParam_t& operator=(const CompareItemDetectParam_t &other);
  112. };
  113. /**
  114. * @brief 对比项信息
  115. *
  116. */
  117. struct CompareItemInfo_t
  118. {
  119. int nID = -1; /* 对比项ID,对比项唯一识别号,不可更改 */
  120. QString strName; /* 对比项名称 */
  121. bool isEnable = false; /* 对比项状态,是否启用 */
  122. QMap<int, CompareItemRoadInfo_t> mapRoad; /* 通道信息列表,int是通道编号 */
  123. CompareItemDetectParam_t paramMute; /* 静音检测参数 */
  124. CompareItemDetectParam_t paramOverload; /* 过载检测参数 */
  125. CompareItemDetectParam_t paramPhase; /* 反相检测参数 */
  126. CompareItemInfo_t() = default;
  127. CompareItemInfo_t(const CompareItemInfo_t &other);
  128. CompareItemInfo_t& operator=(const CompareItemInfo_t &other);
  129. /* 判断对比想基础部分是否相等,不包含通道信息 */
  130. bool isEqualBase(const CompareItemInfo_t &other) const;
  131. /* 判断对比项的通道是否相同 */
  132. bool isEqualRoads(const CompareItemInfo_t &other) const;
  133. };
  134. #endif // __GLOBAL_VARIABLE_H__