protected override void OnSetDevice()
        {
            base.OnSetDevice();
            EQParams = new XGMultiEQParams(Device);

            AddLabelCell("EQType", 0, 0, 3, Color.Olive);
            var typeCtrl = AddControlCell(EQParams.Type, 3, 0, 3, Color.Yellow);
            typeCtrl.Offset += v => { EQParams.RequestDump(); RedrawOnRequestComplete(); };

            int baseY = 8, y, x = 0;

            y = baseY;
            AddLabelCell("", x, y++, 3, Color.DarkGray);
            AddLabelCell("Shape", x, y++, 3, Color.DarkGray);
            AddLabelCell("Frequency", x, y++, 3, Color.DarkGray);
            AddLabelCell("Q", x, y++, 3, Color.DarkGray);
            AddLabelCell("Gain", x, y++, 3, Color.DarkGray);
            x += 3;

            for (int i = 0; i < 5; i++)
            {
                y = baseY;

                var band = EQParams.Bands[i];
                var brightColor = bandColors[i];
                var darkColor = Color.FromArgb(brightColor.A, brightColor.R / 2, brightColor.G / 2, brightColor.B / 2);

                AddLabelCell("Band " + (i + 1), x, y++, 3, darkColor);
                if (EQParams.Bands[i].Shape != null) { AddControlCell(band.Shape, x, y++, 3, brightColor).Offset += v => Invalidate(); }
                else { AddLabelCell("-", x, y++, 3, darkColor); }
                AddControlCell(band.Frequency, x, y++, 3, brightColor).Offset += v => Invalidate();
                AddControlCell(band.Q, x, y++, 3, brightColor).Offset += v => Invalidate();
                AddControlCell(band.Gain, x, y++, 3, brightColor).Offset += v => Invalidate();
                x += 3;
            }

            AdjustWindowSize();
        }
        public void ResetXG()
        {
            WriteXGParam(0x000000, 4, 0x10000);// MASTER TUNE = 0
            WriteXGParam(0x000004, 1, 0x7F);// MASTER VOLUME
            WriteXGParam(0x000005, 1, 0x00);// MASTER ATTR
            WriteXGParam(0x000006, 1, 0x40);// TRANSPOSE

            ResetEffect(XGEffectBlockType.Reverb, "HALL 1");
            ResetEffect(XGEffectBlockType.Chorus, "CHORUS 1");
            ResetEffect(XGEffectBlockType.Variation, "DELAY LCR");
            ResetEffect(XGEffectBlockType.Insertion1, "DISTORTION");
            ResetEffect(XGEffectBlockType.Insertion2, "DISTORTION");
            ResetEffect(XGEffectBlockType.Insertion3, "DISTORTION");
            ResetEffect(XGEffectBlockType.Insertion4, "DISTORTION");

            for (int i = 0; i < 64; i++)
            {
                var part = new XGPartParams(this, i);
                part.ProgramMSB.WriteValue(i % 16 == 9 ? 127 : 0);
                part.ProgramLSB.WriteValue(0);
                part.ProgramNumber.WriteValue(0);
                part.RcvNoteMessage.WriteValue(1);
                part.Pan.WriteValue(64);
                part.Volume.WriteValue(100);
                part.Reverb.WriteValue(40);
                part.Chorus.WriteValue(0);
                part.Variation.WriteValue(0);
                part.DryLevel.WriteValue(127);
                part.LPFCutoffFreq.WriteValue(64);
                part.LPFResonance.WriteValue(64);
                part.HPFCutoffFreq.WriteValue(64);
                part.EGAttack.WriteValue(64);
                part.EGDecay.WriteValue(64);
                part.EGRelease.WriteValue(64);
                part.VibRate.WriteValue(64);
                part.VibDepth.WriteValue(64);
                part.VibDelay.WriteValue(64);
                part.EQBassFreq.WriteValue(12);
                part.EQBassGain.WriteValue(64);
                part.EQTrebleFreq.WriteValue(54);
                part.EQTrebleGain.WriteValue(64);
                part.MWPitchControl.WriteValue(64);
                part.MWLPFControl.WriteValue(64);
                part.MWAmpControl.WriteValue(64);
                part.MWLFOPModDepth.WriteValue(10);
                part.MWLFOFModDepth.WriteValue(0);
                part.MWLFOAModDepth.WriteValue(0);
            }

            ulong[] data = { // StandKit#
                0x6603335F5F004040, 0x7903335F5F004040, 0x3F00337F7F004040, 0x7F00337F7F004040, 0x5D04343F3F004040, 0x7404343F3F004040, 0x7F00404B00004040, 0x7F00407F7F004040,
                0x5E00403F3F004040, 0x6200403F3F004040, 0x5C00407F7F004040, 0x7700407F7F004040, 0x3100407F7F004040, 0x2F00407F7F014040, 0x3400407F7F004040, 0x2D00407F7F014040,
                0x4F00407F7F014040, 0x7F00403F3F004040, 0x4B00407F7F004040, 0x7F00407F7F004040, 0x7400402020004040, 0x7700407F7F004042, 0x6600402020004040, 0x7F00402020004040,
                0x5D00407F7F004040, 0x7F00407F7F004040, 0x6E00407F7F004040, 0x7B00407F7F004040, 0x6F00187F7F004040, 0x5B014D2020004040, 0x7100277F7F004040, 0x5C014D2020004040,
                0x6300347F7F004040, 0x60014D2020004040, 0x5700407F7F004040, 0x6300537F7F004040, 0x7F00457F7F004040, 0x7400687F7F004040, 0x6900227F7F004041, 0x7800227F7F004040,
                0x6B002E7F7F004040, 0x7400403F3F004040, 0x7F00407F7F004040, 0x76004D3F3F004040, 0x7F00337F7F004040, 0x6A00197F7F004040, 0x6E002E7F7F004040, 0x6E006E5F5F004040,
                0x57006E5F5F004040, 0x6900277F7F004040, 0x6B00197F7F004040, 0x7300405F5F004040, 0x5B00407F7F004040, 0x5F00407F7F004040, 0x6C00226464004040, 0x6C00226464004040,
                0x5A001C3F3F004040, 0x6300153F3F004040, 0x6700657F7F014040, 0x6E00657F7F014040, 0x7C005F3F3F004040, 0x6A006E3F3F014040, 0x5800405F5F004040, 0x6B00685F5F004040,
                0x6000685F5F004040, 0x6100157F7F004040, 0x6B00227F7F004040, 0x7F02195F5F004040, 0x7F02197F7F004040, 0x6A00533F3F004040, 0x7B00697F7F004040, 0x4400407F7F004040,
                0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040,
            };

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0x0d; j <= 0x5b; j++)
                {
                    var drum = new XGDrumParams(this, i, j);
                    drum.PitchCoarse.WriteValue(64);
                    drum.PitchFine.WriteValue(64);
                    drum.Volume.WriteValue((int)(data[j - 0x0d] >> 56 & 0x7F));
                    drum.Pan.WriteValue((int)(data[j - 0x0d] >> 40 & 0x7F));
                    drum.Reverb.WriteValue((int)(data[j - 0x0d] >> 32 & 0x7F));
                    drum.Chorus.WriteValue((int)(data[j - 0x0d] >> 24 & 0x7F));
                    drum.Variation.WriteValue(0x7F);
                    drum.LPFCutoffFreq.WriteValue(0x40);
                    drum.LPFResonance.WriteValue(0x40);
                    drum.HPFCutoffFreq.WriteValue(0x40);
                    drum.EGAttackRate.WriteValue(0x40);
                    drum.EGDecay1Rate.WriteValue(0x40);
                    drum.EGDecay2Rate.WriteValue(0x40);
                    drum.EQBassGain.WriteValue(0x40);
                    drum.EQTrebleGain.WriteValue(0x40);
                    drum.EQBassFreq.WriteValue(0x0C);
                    drum.EQTrebleFreq.WriteValue(0x36);
                    drum.AltGroup.WriteValue((int)(data[j - 0x0d] >> 48 & 0x7F));
                    drum.KeyAssign.WriteValue(0x00);
                    drum.RcvNoteOff.WriteValue((int)(data[j - 0x0d] >> 16 & 0x7F));
                    drum.RcvNoteOn.WriteValue(0x01);
                    drum.VelocitySensePitch.WriteValue((int)(data[j - 0x0d] >> 8 & 0x7F));
                    drum.VelocitySenseLPFCutoff.WriteValue((int)(data[j - 0x0d] >> 0 & 0x7F));
                }
            }

            {
                var eq = new XGMultiEQParams(this);

                eq.Type.WriteValue(0);
                eq.Gain1.WriteValue(0x40);
                eq.Freq1.WriteValue(0x0c);
                eq.Q1.WriteValue(0x07);
                eq.Shape1.WriteValue(0x00);
                eq.Gain2.WriteValue(0x40);
                eq.Freq2.WriteValue(0x1C);
                eq.Q2.WriteValue(0x07);
                eq.Gain3.WriteValue(0x40);
                eq.Freq3.WriteValue(0x22);
                eq.Q3.WriteValue(0x07);
                eq.Gain4.WriteValue(0x40);
                eq.Freq4.WriteValue(0x2E);
                eq.Q4.WriteValue(0x07);
                eq.Gain5.WriteValue(0x40);
                eq.Freq5.WriteValue(0x34);
                eq.Q5.WriteValue(0x07);
                eq.Shape5.WriteValue(0x00);
            }
        }
Пример #3
0
        public void ResetXG()
        {
            WriteXGParam(0x000000, 4, 0x10000); // MASTER TUNE = 0
            WriteXGParam(0x000004, 1, 0x7F);    // MASTER VOLUME
            WriteXGParam(0x000005, 1, 0x00);    // MASTER ATTR
            WriteXGParam(0x000006, 1, 0x40);    // TRANSPOSE

            ResetEffect(XGEffectBlockType.Reverb, "HALL 1");
            ResetEffect(XGEffectBlockType.Chorus, "CHORUS 1");
            ResetEffect(XGEffectBlockType.Variation, "DELAY LCR");
            ResetEffect(XGEffectBlockType.Insertion1, "DISTORTION");
            ResetEffect(XGEffectBlockType.Insertion2, "DISTORTION");
            ResetEffect(XGEffectBlockType.Insertion3, "DISTORTION");
            ResetEffect(XGEffectBlockType.Insertion4, "DISTORTION");

            for (int i = 0; i < 64; i++)
            {
                var part = new XGPartParams(this, i);
                part.ProgramMSB.WriteValue(i % 16 == 9 ? 127 : 0);
                part.ProgramLSB.WriteValue(0);
                part.ProgramNumber.WriteValue(0);
                part.RcvNoteMessage.WriteValue(1);
                part.Pan.WriteValue(64);
                part.Volume.WriteValue(100);
                part.Reverb.WriteValue(40);
                part.Chorus.WriteValue(0);
                part.Variation.WriteValue(0);
                part.DryLevel.WriteValue(127);
                part.LPFCutoffFreq.WriteValue(64);
                part.LPFResonance.WriteValue(64);
                part.HPFCutoffFreq.WriteValue(64);
                part.EGAttack.WriteValue(64);
                part.EGDecay.WriteValue(64);
                part.EGRelease.WriteValue(64);
                part.VibRate.WriteValue(64);
                part.VibDepth.WriteValue(64);
                part.VibDelay.WriteValue(64);
                part.EQBassFreq.WriteValue(12);
                part.EQBassGain.WriteValue(64);
                part.EQTrebleFreq.WriteValue(54);
                part.EQTrebleGain.WriteValue(64);
                part.MWPitchControl.WriteValue(64);
                part.MWLPFControl.WriteValue(64);
                part.MWAmpControl.WriteValue(64);
                part.MWLFOPModDepth.WriteValue(10);
                part.MWLFOFModDepth.WriteValue(0);
                part.MWLFOAModDepth.WriteValue(0);
            }

            ulong[] data =   // StandKit#
            {
                0x6603335F5F004040, 0x7903335F5F004040, 0x3F00337F7F004040, 0x7F00337F7F004040, 0x5D04343F3F004040, 0x7404343F3F004040, 0x7F00404B00004040, 0x7F00407F7F004040,
                0x5E00403F3F004040, 0x6200403F3F004040, 0x5C00407F7F004040, 0x7700407F7F004040, 0x3100407F7F004040, 0x2F00407F7F014040, 0x3400407F7F004040, 0x2D00407F7F014040,
                0x4F00407F7F014040, 0x7F00403F3F004040, 0x4B00407F7F004040, 0x7F00407F7F004040, 0x7400402020004040, 0x7700407F7F004042, 0x6600402020004040, 0x7F00402020004040,
                0x5D00407F7F004040, 0x7F00407F7F004040, 0x6E00407F7F004040, 0x7B00407F7F004040, 0x6F00187F7F004040, 0x5B014D2020004040, 0x7100277F7F004040, 0x5C014D2020004040,
                0x6300347F7F004040, 0x60014D2020004040, 0x5700407F7F004040, 0x6300537F7F004040, 0x7F00457F7F004040, 0x7400687F7F004040, 0x6900227F7F004041, 0x7800227F7F004040,
                0x6B002E7F7F004040, 0x7400403F3F004040, 0x7F00407F7F004040, 0x76004D3F3F004040, 0x7F00337F7F004040, 0x6A00197F7F004040, 0x6E002E7F7F004040, 0x6E006E5F5F004040,
                0x57006E5F5F004040, 0x6900277F7F004040, 0x6B00197F7F004040, 0x7300405F5F004040, 0x5B00407F7F004040, 0x5F00407F7F004040, 0x6C00226464004040, 0x6C00226464004040,
                0x5A001C3F3F004040, 0x6300153F3F004040, 0x6700657F7F014040, 0x6E00657F7F014040, 0x7C005F3F3F004040, 0x6A006E3F3F014040, 0x5800405F5F004040, 0x6B00685F5F004040,
                0x6000685F5F004040, 0x6100157F7F004040, 0x6B00227F7F004040, 0x7F02195F5F004040, 0x7F02197F7F004040, 0x6A00533F3F004040, 0x7B00697F7F004040, 0x4400407F7F004040,
                0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040, 0x7F00407F7F004040,
            };

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0x0d; j <= 0x5b; j++)
                {
                    var drum = new XGDrumParams(this, i, j);
                    drum.PitchCoarse.WriteValue(64);
                    drum.PitchFine.WriteValue(64);
                    drum.Volume.WriteValue((int)(data[j - 0x0d] >> 56 & 0x7F));
                    drum.Pan.WriteValue((int)(data[j - 0x0d] >> 40 & 0x7F));
                    drum.Reverb.WriteValue((int)(data[j - 0x0d] >> 32 & 0x7F));
                    drum.Chorus.WriteValue((int)(data[j - 0x0d] >> 24 & 0x7F));
                    drum.Variation.WriteValue(0x7F);
                    drum.LPFCutoffFreq.WriteValue(0x40);
                    drum.LPFResonance.WriteValue(0x40);
                    drum.HPFCutoffFreq.WriteValue(0x40);
                    drum.EGAttackRate.WriteValue(0x40);
                    drum.EGDecay1Rate.WriteValue(0x40);
                    drum.EGDecay2Rate.WriteValue(0x40);
                    drum.EQBassGain.WriteValue(0x40);
                    drum.EQTrebleGain.WriteValue(0x40);
                    drum.EQBassFreq.WriteValue(0x0C);
                    drum.EQTrebleFreq.WriteValue(0x36);
                    drum.AltGroup.WriteValue((int)(data[j - 0x0d] >> 48 & 0x7F));
                    drum.KeyAssign.WriteValue(0x00);
                    drum.RcvNoteOff.WriteValue((int)(data[j - 0x0d] >> 16 & 0x7F));
                    drum.RcvNoteOn.WriteValue(0x01);
                    drum.VelocitySensePitch.WriteValue((int)(data[j - 0x0d] >> 8 & 0x7F));
                    drum.VelocitySenseLPFCutoff.WriteValue((int)(data[j - 0x0d] >> 0 & 0x7F));
                }
            }

            {
                var eq = new XGMultiEQParams(this);

                eq.Type.WriteValue(0);
                eq.Gain1.WriteValue(0x40);
                eq.Freq1.WriteValue(0x0c);
                eq.Q1.WriteValue(0x07);
                eq.Shape1.WriteValue(0x00);
                eq.Gain2.WriteValue(0x40);
                eq.Freq2.WriteValue(0x1C);
                eq.Q2.WriteValue(0x07);
                eq.Gain3.WriteValue(0x40);
                eq.Freq3.WriteValue(0x22);
                eq.Q3.WriteValue(0x07);
                eq.Gain4.WriteValue(0x40);
                eq.Freq4.WriteValue(0x2E);
                eq.Q4.WriteValue(0x07);
                eq.Gain5.WriteValue(0x40);
                eq.Freq5.WriteValue(0x34);
                eq.Q5.WriteValue(0x07);
                eq.Shape5.WriteValue(0x00);
            }
        }