Example #1
0
        public EffectControl(AudioEffect ae)
        {
            InitializeComponent();
            lblEffectName.Text = ae.Name;
            Effect = ae;

            int i=0;
            foreach (AudioEffectFactor Factor in Effect.Factors)
            {
                /*TrackBar tb = new TrackBar();
                tb.Tag = Factor;
                tb.Location = new System.Drawing.Point(55+i*45, 3);
                tb.Orientation = System.Windows.Forms.Orientation.Vertical;
                tb.Size = new System.Drawing.Size(45, 65);
                tb.TickStyle = System.Windows.Forms.TickStyle.Both;
                tb.Minimum = 0;
                tb.Maximum = 1000;
                tb.SmallChange = 50;
                tb.LargeChange = 100;
                tb.TickFrequency = 50;
                tb.Value = FactorToTrackBar(tb);
                tb.ValueChanged += new EventHandler(tb_ValueChanged);*/
                //panelEffect.Controls.Add(tb);

                Knob bn = new Knob();
                bn.Tag = Factor;
                bn.Location = new System.Drawing.Point(75 + (i/2) * 45, 3+(i%2)*50);
                bn.Size = new System.Drawing.Size(32, 32);
                bn.Value = FactorToKnob(bn);
                bn.ValueChanged += new EventHandler(bn_ValueChanged);
                bn.ToolTipText = Factor.Description;
                panelEffect.Controls.Add(bn);

                Panel pan = new Panel();
                pan.BackColor = System.Drawing.Color.SteelBlue;
                pan.Location = new System.Drawing.Point(110+(i/2)*45, 5);
                pan.Size = new System.Drawing.Size(1, 90);
                panelEffect.Controls.Add(pan);

                Label lblV = new Label();
                lblV.Location = new System.Drawing.Point(65 + (i/2) * 45, 35 + (i % 2) * 50);
                lblV.Size = new System.Drawing.Size(45, 15);
                lblV.Font = new Font(lblV.Font.FontFamily, 7.0f);
                lblV.Text = Factor.Value.ToString("0.00");
                lblV.Tag = bn;
                panelEffect.Controls.Add(lblV);

                /*Label lbl = new Label();
                lbl.Location = new System.Drawing.Point(65 + i * 45, 55);
                lbl.Size = new System.Drawing.Size(45, 50);
                lbl.Font = new Font(lbl.Font.FontFamily, 7.0f);
                lbl.Text = Factor.Description;
                panelEffect.Controls.Add(lbl);*/

                i++;
            }
        }
        public void AddEffect(AudioEffect ae)
        {
            EffectControl ec = new EffectControl(ae);
            ec.AutoSize = true;

            ec.Size = new System.Drawing.Size(442, 106);
            ec.TabIndex = 0;
            ec.IsEmpty = false;
            ec.AddRemoveButton += new EventHandler(ec_AddRemoveButton);
            ec.MoveUpButton += new EventHandler(ec_MoveUpButton);
            ec.MoveDownButton += new EventHandler(ec_MoveDownButton);

            EffectChain.AddEffect(ae);
            this.Controls.Add(ec);
            EffectControls.Add(ec);

            for (int i = 0; i < EffectControls.Count;i++)
              EffectControls[i].Location = new System.Drawing.Point(3, 3 + 110 * (EffectControls.Count-i-1));
        }