GlobalVariable.h 5.4 KB

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