Exemplo n.º 1
0
        public Editor(Rodent instance)
        {
            this.Rodent     = instance;
            this.ClientSize = new Size(BaseBitmap.Width, BaseBitmap.Height + TopBarBitmap.Height);

            Gain      = new BitmapKnob(KnobsBitmap, Knob1Width, KnobHeight, Positions, 0, 0, 0, KnobHeight);
            Gain.Top  = TopH;
            Gain.Left = Knob1X;

            Filter      = new BitmapKnob(KnobsBitmap, Knob2Width, KnobHeight, Positions, Knob1Width, 0, 0, KnobHeight);
            Filter.Top  = TopH;
            Filter.Left = Knob2X;

            Vol      = new BitmapKnob(KnobsBitmap, Knob3Width, KnobHeight, Positions, Knob1Width + Knob2Width, 0, 0, KnobHeight);
            Vol.Top  = TopH;
            Vol.Left = Knob3X;


            Ruetz          = new BitmapSwitch(SwitchBitmap, Switch1Width, SwitchHeight, false, true, Switch1X, SwitchY);
            Ruetz.Brush    = Brushes.White;
            Ruetz.OffBrush = Brushes.White;
            Ruetz.Top      = TopH + SwitchY;
            Ruetz.Left     = Switch1X;

            Turbo          = new BitmapSwitch(SwitchBitmap, Switch2Width, SwitchHeight, false, true, Switch2X, SwitchY);
            Turbo.Brush    = Brushes.White;
            Turbo.OffBrush = Brushes.White;
            Turbo.Top      = TopH + SwitchY;
            Turbo.Left     = Switch2X;

            Tight          = new BitmapSwitch(SwitchBitmap, Switch3Width, SwitchHeight, false, true, Switch3X, SwitchY);
            Tight.Brush    = Brushes.White;
            Tight.OffBrush = Brushes.White;
            Tight.Top      = TopH + SwitchY;
            Tight.Left     = Switch3X;

            OD          = new BitmapSwitch(SwitchBitmap, Switch4Width, SwitchHeight, false, true, Switch4X, SwitchY);
            OD.Brush    = Brushes.White;
            OD.OffBrush = Brushes.White;
            OD.Top      = TopH + SwitchY;
            OD.Left     = Switch4X;

            Light      = new BitmapIndicator(SwitchBitmap, LightWidth, SwitchHeight, false, true, LightX, SwitchY);
            Light.Left = LightX;
            Light.Top  = TopH + SwitchY;

            Stomp      = new BitmapSwitch(SwitchBitmap, StompWidth, StompHeight, false, true, StompX, StompY);
            Stomp.Left = StompX;
            Stomp.Top  = TopH + StompY;
            Stomp.Mode = Switch.SwitchMode.Toggle;

            Controls.Add(Gain);
            Controls.Add(Filter);
            Controls.Add(Vol);
            Controls.Add(Ruetz);
            Controls.Add(Turbo);
            Controls.Add(Tight);
            Controls.Add(OD);
            Controls.Add(Light);
            Controls.Add(Stomp);

            Gain.ValueChanged   += ParameterChanged;
            Filter.ValueChanged += ParameterChanged;
            Vol.ValueChanged    += ParameterChanged;
            Ruetz.ValueChanged  += ParameterChanged;
            Turbo.ValueChanged  += ParameterChanged;
            Tight.ValueChanged  += ParameterChanged;
            OD.ValueChanged     += ParameterChanged;
            Stomp.ValueChanged  += ParameterChanged;

            var about = new AboutButton();

            about.Top    = 0;
            about.Left   = TopBarBitmap.Width - about.Width;
            about.Click += about_Click;
            Controls.Add(about);
        }
Exemplo n.º 2
0
        public Editor()
        {
            this.ClientSize = new Size(BackgroundBitmap.Width, BackgroundBitmap.Height + TopBarBitmap.Height);

            InputA      = new BitmapSliderSimple(TopSliderBitmap);
            InputA.Top  = SliderY;
            InputA.Left = Slider1X;

            InputB      = new BitmapSliderSimple(TopSliderBitmap);
            InputB.Top  = SliderY;
            InputB.Left = Slider2X;

            // -------- first 4 knobs

            GainA      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX1, KnobY1, 0, BackgroundBitmap.Height);
            GainA.Left = KnobX1;
            GainA.Top  = KnobY1 + TopH;

            VolA      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX1 + KnobW, KnobY1, 0, BackgroundBitmap.Height);
            VolA.Left = KnobX1 + KnobW;
            VolA.Top  = KnobY1 + TopH;


            GainB      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX1, KnobY2, 0, BackgroundBitmap.Height);
            GainB.Left = KnobX1;
            GainB.Top  = KnobY1 + KnobH + TopH;

            VolB      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX1 + KnobW, KnobY2, 0, BackgroundBitmap.Height);
            VolB.Left = KnobX1 + KnobW;
            VolB.Top  = KnobY1 + KnobH + TopH;

            // ------- Channel Switch

            Channel      = new BitmapSwitch(SwitchBitmap, SwitchBitmap.Width / 2, SwitchBitmap.Height, true, false);
            Channel.Left = SwitchX;
            Channel.Top  = SwitchY + TopH;

            // -------- Channel Indicators

            LightA      = new BitmapIndicator(Light1Bitmap, Light1Bitmap.Width / 2, Light1Bitmap.Height, false, false);
            LightA.Left = Light1X;
            LightA.Top  = Light1Y + TopH;

            LightB      = new BitmapIndicator(Light2Bitmap, Light2Bitmap.Width / 2, Light2Bitmap.Height, false, false);
            LightB.Left = Light2X;
            LightB.Top  = Light2Y + TopH;

            LightC      = new BitmapIndicator(Light3Bitmap, Light3Bitmap.Width / 2, Light3Bitmap.Height, false, false);
            LightC.Left = Light3X;
            LightC.Top  = Light3Y + TopH;

            // -------- Channel A Controls

            BassA      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2, KnobY1, 0, BackgroundBitmap.Height);
            BassA.Left = KnobX2;
            BassA.Top  = KnobY1 + TopH;

            MidA      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2 + KnobW, KnobY1, 0, BackgroundBitmap.Height);
            MidA.Left = KnobX2 + KnobW;
            MidA.Top  = KnobY1 + TopH;

            TrebleA      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2 + 2 * KnobW, KnobY1, 0, BackgroundBitmap.Height);
            TrebleA.Left = KnobX2 + 2 * KnobW;
            TrebleA.Top  = KnobY1 + TopH;

            PresA      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2 + 3 * KnobW, KnobY1, 0, BackgroundBitmap.Height);
            PresA.Left = KnobX2 + 3 * KnobW;
            PresA.Top  = KnobY1 + TopH;

            // -------- Channel B Controls

            BassB      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2, KnobY2, 0, BackgroundBitmap.Height);
            BassB.Left = KnobX2;
            BassB.Top  = KnobY2 + TopH;

            MidB      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2 + KnobW, KnobY2, 0, BackgroundBitmap.Height);
            MidB.Left = KnobX2 + KnobW;
            MidB.Top  = KnobY2 + TopH;

            TrebleB      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2 + 2 * KnobW, KnobY2, 0, BackgroundBitmap.Height);
            TrebleB.Left = KnobX2 + 2 * KnobW;
            TrebleB.Top  = KnobY2 + TopH;

            PresB      = new BitmapKnob(KnobsBitmap, KnobW, KnobH, Positions, KnobX2 + 3 * KnobW, KnobY2, 0, BackgroundBitmap.Height);
            PresB.Left = KnobX2 + 3 * KnobW;
            PresB.Top  = KnobY2 + TopH;

            // Switches

            Boost      = new BitmapSwitch(BoostBitmap, BoostBitmap.Width / 2, BoostBitmap.Height, false, false);
            Boost.Left = BoostX;
            Boost.Top  = BoostY + TopH;

            MapControls();

            foreach (var ctrl in ControlMap)
            {
                if (ctrl.Value == null)
                {
                    continue;
                }

                if (ctrl.Value as Knob != null)
                {
                    ((Knob)ctrl.Value).ValueChanged += ParameterChanged;
                }
                else if (ctrl.Value as Switch != null)
                {
                    ((Switch)ctrl.Value).Brush         = Brushes.White;
                    ((Switch)ctrl.Value).OffBrush      = Brushes.White;
                    ((Switch)ctrl.Value).ValueChanged += ParameterChanged;
                }
                else if (ctrl.Value as BitmapSliderSimple != null)
                {
                    ((BitmapSliderSimple)ctrl.Value).ValueChanged += ParameterChanged;
                }

                Controls.Add((Control)ctrl.Value);
            }

            Controls.Add(LightA);
            Controls.Add(LightB);
            Controls.Add(LightC);

            var about = new AboutButton();

            about.Top    = 0;
            about.Left   = TopBarBitmap.Width - about.Width;
            about.Click += about_Click;
            Controls.Add(about);
        }