예제 #1
0
        private void resetMapChart()
        {
            this.chartMap.Series.Clear();

            NamedImage backImage = new NamedImage("World_Standard_HiRes_grey", Properties.Resources.World_Standard_HiRes_grey);
            this.chartMap.Images.Add(backImage);

            this.chartMap.ChartAreas[0].BackImage = "World_Standard_HiRes_grey";
            this.chartMap.ChartAreas[0].BackImageWrapMode = ChartImageWrapMode.Scaled;

            this.chartMap.Titles.Add(this.recursos.GetString("map", this.cultura));
            this.chartMap.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;
            this.chartMap.Titles[0].Font = new Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        }
예제 #2
0
        public FilterForm(MainForm_Template _parentForm, int chan_number = 1, bool is_six = false)
        {
            CH_NUMBER = chan_number;
            PARENT_FORM = _parentForm;

            InitializeComponent();

            _threadlock = new Object();

            MasterResponseLine = filterChart.Series[6];
            MasterMarkerLine = filterChart.Series[7];

            if (is_six)
            {
                total_filters = 6;
                starting_filter = 3;
                active_global_filter_index = 3;
                pnlSecondRowFilters.Visible = true;
                pnlButtons.Location = new Point(18, 511);
                IS_SIX_CHANNEL = true;

            }
            else
            {
                total_filters = 3;
                starting_filter = 0;
                active_global_filter_index = 0;
                pnlSecondRowFilters.Visible = false;

                lblFilterSelector3.Visible = false;
                lblFilterSelector4.Visible = false;
                lblFilterSelector5.Visible = false;

                pnlButtons.Location = new Point(18, 407);
            }

            try
            {
                filterColors[0] = Color.Chocolate;
                filterColors[1] = Color.Chartreuse;
                filterColors[2] = Color.DarkMagenta;
                filterColors[3] = Color.SandyBrown;
                filterColors[4] = Color.PaleGreen;
                filterColors[5] = Color.Plum;
                filterColors[6] = Color.SandyBrown;
                filterColors[7] = Color.PaleGreen;
                filterColors[8] = Color.Plum;

                this.Text = "Filter Designer - CH " + chan_number.ToString();
                this.DoubleBuffered = true;

                bool first_active_selected = false;

                for (int i = starting_filter; i < starting_filter + total_filters; i++)
                {
                    int localized_starting_filter = i - starting_filter;
                    if (PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i] == null || PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Type == FilterType.None)
                    {
                        // We don't care. Let's reinstantiate even the FilterType.None's
                        PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i] = new FilterConfig(FilterType.None, false);

                        ((ComboBox)Controls.Find("dropFilter" + (localized_starting_filter).ToString(), true)[0]).SelectedIndex = 0;

                        filterChart.Series[localized_starting_filter].Enabled = false;
                    }
                    else
                    {
                        if (!first_active_selected)
                        {
                            active_global_filter_index = i;

                            first_active_selected = true;
                        }

                        ((PictureCheckbox)Controls.Find("chkBypass" + localized_starting_filter.ToString(), true)[0]).Checked = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Bypassed;
                        ((PictureCheckbox)Controls.Find("chkBypass" + localized_starting_filter.ToString(), true)[0]).Invalidate();

                        ((TextBox)Controls.Find("txtGain" + localized_starting_filter.ToString(), true)[0]).Text = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.Gain.ToString("F1");
                        ((TextBox)Controls.Find("txtFreq" + localized_starting_filter.ToString(), true)[0]).Text = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.CenterFrequency.ToString("#.");
                        ((TextBox)Controls.Find("txtQval" + localized_starting_filter.ToString(), true)[0]).Text = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.QValue.ToString("F3");

                        if (((int)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.FilterType == 6) || ((int)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.FilterType == 7))
                        {
                            if ((int)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.FilterType == 6)
                            {
                                //LP 2nd order
                                ((ComboBox)Controls.Find("dropSlope" + localized_starting_filter.ToString(), true)[0]).SelectedIndex = 1;
                                ((ComboBox)Controls.Find("dropSlope" + localized_starting_filter.ToString(), true)[0]).Invalidate();

                                ((ComboBox)Controls.Find("dropFilter" + localized_starting_filter.ToString(), true)[0]).SelectedIndex = LOW_PASS;

                            }
                            else
                            {
                                //HP 2nd order
                                ((ComboBox)Controls.Find("dropSlope" + localized_starting_filter.ToString(), true)[0]).SelectedIndex = 1;
                                ((ComboBox)Controls.Find("dropSlope" + localized_starting_filter.ToString(), true)[0]).Invalidate();

                                ((ComboBox)Controls.Find("dropFilter" + localized_starting_filter.ToString(), true)[0]).SelectedIndex = HIGH_PASS;

                            }
                        }
                        else
                        {
                            ((ComboBox)Controls.Find("dropSlope" + localized_starting_filter.ToString(), true)[0]).SelectedIndex = 0;
                            ((ComboBox)Controls.Find("dropSlope" + localized_starting_filter.ToString(), true)[0]).Invalidate();

                            ((ComboBox)Controls.Find("dropFilter" + localized_starting_filter.ToString(), true)[0]).SelectedIndex = (int)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].filters[CH_NUMBER - 1][i].Filter.FilterType + 1;
                        }

                        filterColors[localized_starting_filter] = filterColors[localized_starting_filter];

                        filterChart.Series[localized_starting_filter].Enabled = true;

                    }

                }

                RefreshAllFilters();

                filterChart.ChartAreas[0].RecalculateAxesScale();

                var backImage = new NamedImage("FilterGraph_BG_Blue_Modified", GlobalResources.FilterGraph_BG_Blue_Modified);
                filterChart.Images.Add(backImage);
                filterChart.ChartAreas[0].BackImage = "FilterGraph_BG_Blue_Modified";

                dropFilter0.BackColor = Helpers.Lighten(filterColors[0], 0.20);
                dropFilter1.BackColor = Helpers.Lighten(filterColors[1], 0.30);
                dropFilter2.BackColor = Helpers.Lighten(filterColors[2], 0.40);
                dropFilter3.BackColor = Helpers.Lighten(filterColors[3], 0.10);
                dropFilter4.BackColor = Helpers.Lighten(filterColors[4], 0.10);
                dropFilter5.BackColor = Helpers.Lighten(filterColors[5], 0.10);

                pnlSecondRowFilters.Invalidate();

                lblFilterSelector1.BackColor = Helpers.Darken(filterColors[1], filterSelectorFade);
                lblFilterSelector2.BackColor = Helpers.Darken(filterColors[2], filterSelectorFade);
                lblFilterSelector3.BackColor = Helpers.Darken(filterColors[2], filterSelectorFade);
                lblFilterSelector4.BackColor = Helpers.Darken(filterColors[3], filterSelectorFade);
                lblFilterSelector5.BackColor = Helpers.Darken(filterColors[4], filterSelectorFade);

                dropAction.SelectedIndex = 0;
                dropAction.Invalidate();

                UpdateActiveFilter();

                graph_loaded = true;

            } catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
        public CompressorForm(MainForm_Template _parentForm, int channel, int _settings_offset, CompressorType compType = CompressorType.Compressor)
        {
            InitializeComponent();

            ADDR_THRESHOLD = _settings_offset;
            ADDR_KNEE = _settings_offset+1;
            ADDR_RATIO = _settings_offset+2;
            ADDR_ATTACK = _settings_offset+3;
            ADDR_RELEASE = _settings_offset+4;
            ADDR_BYPASS = _settings_offset+5;

            dropAction.SelectedIndex = 0;
            dropAction.Invalidate();

            PARENT_FORM = _parentForm;
            CH_NUMBER = channel;

            if (compType == CompressorType.Compressor)
            {
                is_limiter = false;
                COMP_INDEX = 0;
            }
            else
            {
                is_limiter = true;
                COMP_INDEX = 1;
            }

            try
            {

                FixedLine = dynChart.Series[0];
                MarkerLine = dynChart.Series[1];
                StraightResponseLine = dynChart.Series[2];
                KneedResponseLine = dynChart.Series[3];

                nudCompThreshold.Value = (decimal)PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].compressors[CH_NUMBER - 1][COMP_INDEX].Threshold;
                nudCompRatio.Value = (decimal)(Math.Min(100.0, PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].compressors[CH_NUMBER - 1][COMP_INDEX].Ratio));

                if (compType == CompressorType.Limiter)
                {
                    lblRatio.Visible = false;
                    lblRatioSuffix.Visible = false;
                    nudCompRatio.Visible = false;

                    MarkerLine.Points[2].MarkerSize = 0;

                    dynChart.Invalidate();

                    this.Text = "Limiter - CH" + channel.ToString();
                }
                else
                {
                    MarkerLine.Points[2].MarkerSize = 12;
                    this.Text = "Compressor - CH" + channel.ToString();
                }

                AttackDial = new Dial(TextCompAttack, DialCompAttack, 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].compressors[CH_NUMBER - 1][COMP_INDEX].Attack;
                AttackDial.OnChange += new DialEventHandler(this.AttackDial_OnChange);

                ReleaseDial = new Dial(TextCompRelease, DialCompRelease, 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].compressors[CH_NUMBER - 1][COMP_INDEX].Release;
                ReleaseDial.OnChange += new DialEventHandler(this.ReleaseDial_OnChange);

                var backImage = new NamedImage("DynamicsBackground", GlobalResources.DynamicsGraph_BG_Blue);
                dynChart.Images.Add(backImage);
                dynChart.ChartAreas[0].BackImage = "DynamicsBackground";

                /* Load Image Resources */

                update_soft_knee();

                chkSoftKnee.Checked = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].compressors[CH_NUMBER - 1][COMP_INDEX].SoftKnee;

                if (chkSoftKnee.Checked)
                {
                    KneedResponseLine.Enabled = true;
                    StraightResponseLine.Enabled = false;
                }
                else
                {
                    KneedResponseLine.Enabled = false;
                    StraightResponseLine.Enabled = true;
                }

                chkBypass.Checked = PARENT_FORM.PROGRAMS[PARENT_FORM.CURRENT_PROGRAM].compressors[CH_NUMBER - 1][COMP_INDEX].Bypassed;

                if (_parentForm.LIVE_MODE && _parentForm._PIC_Conn.isOpen)
                {
                    signalTimer.Enabled = true;
                    gainMeterIn.Visible = true;
                    gainMeterOut.Visible = true;
                    lblIn.Visible = true;
                    lblOut.Visible = true;
                    panel1.Location = new Point(35, 366);
                } else
                {
                    signalTimer.Enabled = false;
                    gainMeterIn.Visible = false;
                    gainMeterOut.Visible = false;
                    lblIn.Visible = false;
                    lblOut.Visible = false;
                    panel1.Location = new Point(78, 366);
                }

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