public static void Write(string outputFile, MainForm_Template FORM_INSTANCE)
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(outputFile))
            {
                file.WriteLine("DEVICE-ID:" + FORM_INSTANCE.GetDeviceID().ToString("X8") + ";");
                file.WriteLine("SERIAL:" + FORM_INSTANCE.SERIALNUM + ";");
                file.WriteLine("TIMESTAMP:" + DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss") + ";");
                for (int k = 0; k < 3; k++)
                {
                    file.WriteLine("PRESET" + (k + 1) + ";");

                    for (int i = 0; i < FORM_INSTANCE.GetNumInputChannels(); i++)
                    {
                        file.WriteLine("INPUT_" + (i + 1) + ":" + FORM_INSTANCE.PROGRAMS[k].inputs[i].Name + ";");
                    }

                    for (int j = 0; j < FORM_INSTANCE.GetNumOutputChannels(); j++)
                    {
                        file.WriteLine("OUTPUT_" + (j + 1) + ":" + FORM_INSTANCE.PROGRAMS[k].outputs[j].Name + ";");
                    }

                    for (int j = 0; j < FORM_INSTANCE.GetNumPhantomPowerChannels(); j++)
                    {
                        file.WriteLine("PHANTOM_" + (j + 1) + ":" + (FORM_INSTANCE.PROGRAMS[k].inputs[j].PhantomPower ? "00000001" : "00000000") + ";");
                    }

                    foreach (DSP_Setting single_setting in FORM_INSTANCE._settings[k])
                    {
                        file.WriteLine(single_setting.Index.ToString("D3") + "=" + single_setting.Value.ToString("X8") + ";");
                    }
                }
            }
        }
        public DuckerForm(MainForm_Template _parentForm, int _settings_offset)
        {
            InitializeComponent();

            ADDR_THRESHOLD = _settings_offset;
            ADDR_HOLD = _settings_offset+1;
            ADDR_DEPTH = _settings_offset+2;
            ADDR_ATTACK = _settings_offset+3;
            ADDR_RELEASE = _settings_offset+4;
            ADDR_BYPASS = _settings_offset+5;

            PARENT_FORM = _parentForm;

            try
            {
                dropPriorityChannel.Items.Clear();
                dropPriorityChannel.Text = "";

                for(int i = 0; i < PARENT_FORM.GetNumInputChannels(); i++)
                {
                    dropPriorityChannel.Items.Add(PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].inputs[i].Name);
                }

                nudDuckThreshold.Value = (decimal)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.Threshold;
                nudDuckDepth.Value = (decimal)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.Depth;

                dropPriorityChannel.SelectedIndex = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.PriorityChannel;
                dropPriorityChannel.Invalidate();

                HoldDial = new Dial(TextDuckHold, DialDuckHold, new double[] { 0.001, 0.003, 0.01, 0.03, 0.08, 0.3, 1.0 },
                         DialHelpers.Format_String_Duck_Hold, Images.knob_green_bg, Images.knob_green_line);

                HoldDial.Value = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.Holdtime;
                HoldDial.OnChange += new DialEventHandler(this.HoldDial_OnChange);

                AttackDial = new Dial(TextDuckAttack, DialDuckAttack, new double[] { 0.001, 0.003, 0.01, 0.03, 0.08, 0.3, 1.0 },
                         DialHelpers.Format_String_Comp_Attack, Images.knob_blue_bg, Images.knob_blue_line);

                AttackDial.Value = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.Attack;
                AttackDial.OnChange += new DialEventHandler(this.AttackDial_OnChange);

                ReleaseDial = new Dial(TextDuckRelease, DialDuckRelease, new double[] {0.010, 0.038, 0.150, 0.530, 1.250, 7.0, 30.0},
                         DialHelpers.Format_String_Comp_Release, Images.knob_orange_bg, Images.knob_orange_line);
                ReleaseDial.Value = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.Release;
                ReleaseDial.OnChange += new DialEventHandler(this.ReleaseDial_OnChange);

                chkBypass.Checked = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].ducker.Bypassed;

                if (_parentForm.LIVE_MODE && _parentForm._PIC_Conn.isOpen)
                {
                    signalTimer.Enabled = true;
                    //gainMeterIn.Visible = true;
                    //gainMeterOut.Visible = true;
                } else
                {
                    signalTimer.Enabled = false;
                    //gainMeterIn.Visible = false;
                    //gainMeterOut.Visible = false;
                }

            } catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            form_loaded = true;
        }