Beispiel #1
0
        int AFCFilterLength = 100;   //afl, length (samples) of adaptive filter for modeling feedback path.  Max allowed is probably 256 samples.
        public Form1()
        {
            InitializeComponent();

            dsl = new chapro.CHA_DSL();
            LoadDefaultSettings();
            UpdateUI(false);

            plotGain = zedGC.GraphPane;
            plotGain.XAxis.Title.Text = "frequency (kHz)";
            plotGain.YAxis.Title.Text = "output level (dB SPL)";
        }
Beispiel #2
0
        /// <summary>
        /// Loads parameters from xml file
        /// </summary>
        /// <returns></returns>
        private bool Load_Settings(string FileName)
        {
            XmlSerializer mySerializer = null;
            FileStream    myFileStream = null;
            bool          fileExists   = false;

            try
            {
                // Create an XmlSerializer for the dsl type.
                mySerializer = new XmlSerializer(typeof(chapro.CHA_DSL));
                FileInfo fi = new FileInfo(FileName);
                // If the config file exists, open it.
                if (fi.Exists)
                {
                    myFileStream = fi.OpenRead();
                    // Create a new instance of the dsl by
                    // deserializing the config file.
                    dsl = (chapro.CHA_DSL)mySerializer.Deserialize(myFileStream);
                    if (dsl.cross_freq == null)
                    {
                        LoadDefaultSettings();
                        return(false);
                    }
                    fileExists = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                LoadDefaultSettings();
                return(false);
            }
            finally
            {
                // If the FileStream is open, close it.
                if (myFileStream != null)
                {
                    myFileStream.Close();
                }
            }
            return(fileExists);
        }