#ifndef _CHANNEL_PARAM_H_ #define _CHANNEL_PARAM_H_ /* ========================================================================================= * 宏定义 * =========================================================================================*/ // 1秒钟30个音量值,相位值同样是30个 #define VOLUME_INFO_NUM 30 // 音量有效范围 #define VOLUME_MAX_BD 0 #define VOLUME_MIN_BD -90 // 反相值范围 #define REVERSED_MAX_VALUE 100 #define REVERSED_MIN_VALUE -100 // 数据库字符串长度 #define DB_VARCHAR_LEN 32 // 一次比较最多可得到多少个值(相似度) #define RESULT_NUM_OF_ONETIME_COMPARE 1 /************************** 缩放比较相关宏 **************************/ // 静音默认值 #define SILENCE_DEF_VALUE true // 最大缓存180秒,3分钟 #define CACHE_DATA_SECOND_MAX 180 /** * @brief 音量设置参数 * */ struct StVolumeParam { StVolumeParam(); StVolumeParam(const StVolumeParam& obj); StVolumeParam& operator=(const StVolumeParam& obj); void Init(); /* -------------------- 静音 -------------------- */ void SetSilentSwitch(bool b) { m_bSilentSwitch = b; } // 静音持续时间为0不进行静音判定 bool GetSilentSwitch() const { return m_bSilentSwitch && m_iSilentDuration > 0; } int GetSilentThreshold() const { return m_iSilentThreshold; } void SetSilentThreshold(int ival) { m_iSilentThreshold = ival; } int GetSilentDuration() const { return m_iSilentDuration; } void SetSilentDuration(int ival) { m_iSilentDuration = ival; } int GetSilentNum() const; int GetSilentSensitivity() const { return m_nSilentSensitivity; } void SetSilentSensitivity(int ival) { m_nSilentSensitivity = ival; } /* -------------------- 过载 -------------------- */ void SetOverloadSwitch(bool b) { m_bOverloadSwitch = b; } bool GetOverloadSwitch() const { return m_bOverloadSwitch && m_iOverloadDuration > 0; } int GetOverloadThreshold() const { return m_iOverloadThreshold; } void SetOverloadThreshold(int ival) { m_iOverloadThreshold = ival; } int GetOverloadDuration() const { return m_iOverloadDuration; } void SetOverloadDuration(int ival) { m_iOverloadDuration = ival; } int GetOverloadSensitivity() const { return m_nOverloadSensitivity; } void SetOverloadSensitivity(int ival) { m_nOverloadSensitivity = ival; } int GetOverloadNum() const; /* -------------------- 反相 -------------------- */ void SetPhaseSwitch(bool b) { m_bPhaseSwitch = b; } bool GetPhaseSwitch() const { return m_bPhaseSwitch && m_iPhaseSensitivity > 0; } float GetPhaseThreshold() const { return m_iPhaseThreshold; } void SetPhaseThreshold(float ival) { m_iPhaseThreshold = ival; } int GetPhaseDuration() const { return m_iPhaseDuration; } void SetPhaseDuration(int ival) { m_iPhaseDuration = ival; } int GetPhaseSensitivity() const { return m_iPhaseSensitivity; } void SetPhaseSensitivity(int ival) { m_iPhaseSensitivity = ival; } int GetPhaseNum() const; int GetNoiseDuration() const { return 3; } private: /* -------------------- 静音 -------------------- */ // 静音监测开关 bool m_bSilentSwitch; int m_iSilentThreshold; // 持续时间(秒) int m_iSilentDuration; // 过载灵敏度(百分比) int m_nSilentSensitivity; /* -------------------- 过载 -------------------- */ // 过载监测开关 bool m_bOverloadSwitch; int m_iOverloadThreshold; // 持续时间(秒) int m_iOverloadDuration; // 过载灵敏度(百分比) int m_nOverloadSensitivity; /* -------------------- 反相 -------------------- */ // 反相监测开关 bool m_bPhaseSwitch; // 反相阀值(-1.0 – 1.0) float m_iPhaseThreshold; // 持续时间(秒) int m_iPhaseDuration; // 反相灵敏度(0 - 100%) int m_iPhaseSensitivity; }; #endif /* _CHANNEL_PARAM_H_ */