public IIRFilterDesinger(IIRConfig confi) { InitializeComponent(); cmbBandType.DataSource = Enum.GetValues(typeof(OpenSignalLib.Filters.IIR_BandType)); cmbFilterType.DataSource = Enum.GetValues(typeof(OpenSignalLib.Filters.IIR_FilterType)); cmbBandType.SelectedIndex = cmbFilterType.SelectedIndex = 0; if (confi != null) { cmbBandType.SelectedIndex = (int)confi.BandType; cmbFilterType.SelectedIndex = (int)confi.FilterType; txtF0.Text = (confi.f0 * confi.fs).ToString(); txtFc.Text = (confi.fc * confi.fs).ToString(); txtAp.Text = confi.Ap.ToString(); txtAs.Text = confi.As.ToString(); txtFs.Text = confi.fs.ToString(); } }
public override void OpenAdditionalSettingsWindow() { IIRFilterDesinger fdesigner = new IIRFilterDesinger(confi); if (fdesigner.ShowDialog() == DialogResult.OK) { confi = new IIRConfig(); confi.fs = float.Parse(fdesigner.txtFs.Text); confi.f0 = float.Parse(fdesigner.txtF0.Text); confi.fc = float.Parse(fdesigner.txtFc.Text); confi.f0 = confi.f0 / confi.fs; confi.fc = confi.fc / confi.fs; confi.Ap = float.Parse(fdesigner.txtAp.Text); confi.As = float.Parse(fdesigner.txtAs.Text); confi.n = int.Parse(fdesigner.txtOrder.Text); confi.BandType = (OpenSignalLib.Filters.IIR_BandType)fdesigner.cmbBandType.SelectedValue; confi.FilterType = (OpenSignalLib.Filters.IIR_FilterType)fdesigner.cmbFilterType.SelectedValue; } }