示例#1
0
        public void CreateMICConf(MICSetting settings, string configOutputPath, string fileName)
        {
            //配置模板路径
            string templateFilePath = AppDomain.CurrentDomain.BaseDirectory + "Config/DoubleMICConf.txt";

            //获取配置模板字符串
            string content =
                this.ReadFile(templateFilePath);

            //获取配置字符串
            content = string.Format(
                content
                , settings.AEC_Length
                , settings.MIC_Type == "2" ? string.Empty : "//"
                , settings.BF_Select_Angle
                , settings.DRC_Status == true ? string.Empty : "//"
                , settings.DRC_Gain
                , settings.AES_Status == true ? "//" : "//"
                , settings.AES_Level
                , settings.NR_Level
                , settings.MIC_Type == "2" ? string.Empty : "//"
                , settings.DOA_MIC_Interval
                , settings.MIC_Type == "2" ? string.Empty : "//"
                , settings.MIC_Type);

            if (!Directory.Exists(configOutputPath))
            {
                Directory.CreateDirectory(configOutputPath);
            }
            //生成本地配置文件
            this.WriteFile(content, System.IO.Path.Combine(configOutputPath, fileName));
        }
示例#2
0
        public void CreateMICConf(MICSetting settings, string configOutputPath)
        {
            string templateFilePath = AppDomain.CurrentDomain.BaseDirectory + "config/DoubleMICConf.txt";

            string content =
                this.ReadFile(templateFilePath);

            content = string.Format(
                content
                , settings.AEC_Length
                , settings.MIC_Type == "2" ? string.Empty : "//"
                , settings.BF_Select_Angle
                , settings.DRC_Status == true ? string.Empty : "//"
                , settings.DRC_Gain
                , settings.AES_Status == true ? string.Empty : "//"
                , settings.AES_Level
                , settings.NR_Level
                , settings.MIC_Type == "2" ? string.Empty : "//"
                , settings.DOA_MIC_Interval
                , settings.AGC_Status == true ? string.Empty : "//"
                , settings.MIC_Type);
            this.WriteFile(content, configOutputPath);
        }
示例#3
0
        public MICSetting readMicConfFile(string filePath, string fileName)
        {
            MICSetting micSetting = null;

            if (File.Exists(System.IO.Path.Combine(filePath, fileName)))
            {
                micSetting = new MICSetting();
                FileStream   fs           = new FileStream(System.IO.Path.Combine(filePath, fileName), FileMode.Open);
                StreamReader streamReader = new StreamReader(fs);
                string       line         = "";
                while ((line = streamReader.ReadLine()) != null)
                {
                    if (line.Contains("AECParam"))
                    {
                        micSetting.AEC_Length = this.getConfValue(line, 0);
                    }
                    else if (line.Contains("BFParam"))
                    {
                        micSetting.BF_Select_Angle = this.getConfValue(line, 4);
                    }
                    else if (line.Contains("DRCParam"))
                    {
                        if (line.StartsWith("//"))
                        {
                            micSetting.DRC_Status = false;
                        }
                        else
                        {
                            micSetting.DRC_Status = true;
                        }
                        micSetting.DRC_Gain = this.getConfValue(line, 0);
                    }
                    else if (line.Contains("ESParam"))
                    {
                        if (line.StartsWith("//"))
                        {
                            micSetting.AES_Status = false;
                        }
                        else
                        {
                            micSetting.AES_Status = true;
                        }
                        micSetting.AES_Level = this.getConfValue(line, 0);
                    }
                    else if (line.Contains("NRParam"))
                    {
                        micSetting.NR_Level = this.getConfValue(line, 0);
                    }
                    else if (line.Contains("DOAParam"))
                    {
                        micSetting.DOA_MIC_Interval = this.getConfValue(line, 2);
                    }
                    //else if (line.Contains("AGCParam"))
                    //{
                    //    if (line.StartsWith("//"))
                    //    {
                    //        micSetting.AGC_Status = false;
                    //    }
                    //    else
                    //    {
                    //        micSetting.AGC_Status = true;
                    //    }
                    //}
                    else if (line.Contains("MICParam"))
                    {
                        micSetting.MIC_Type = this.getConfValue(line, 0);
                    }
                }
                streamReader.Close();
                fs.Close();
            }
            return(micSetting);
        }