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); } }
void ReCreateScreen(int[] noteNumbers) { XGControls.Clear(); Drums.Clear(); Array.Reverse(noteNumbers); { int x = 0; int y = 0; AddLabelCell("N#", x, y, 1, Color.Black); x++; AddLabelCell("ON", x, y, 1, Color.Gray); x++; AddLabelCell("NoteName", x, y, 4, Color.Gray);x += 4; AddLabelCell("PCs", x, y, 1, Color.Olive); x++; AddLabelCell("PTn", x, y, 1, Color.Purple); x++; AddLabelCell("VOL", x, y, 1, Color.Green); x++; AddLabelCell("PAN", x, y, 1, Color.Olive); x++; AddLabelCell("REV", x, y, 1, Color.Maroon); x++; AddLabelCell("CHO", x, y, 1, Color.Teal); x++; AddLabelCell("VAR", x, y, 1, Color.Navy); x++; AddLabelCell("LPF", x, y, 1, Color.Green); x++; AddLabelCell("Rsn", x, y, 1, Color.Green); x++; AddLabelCell("HPF", x, y, 1, Color.Green); x++; AddLabelCell("Atk", x, y, 1, Color.Teal); x++; AddLabelCell("Dc1", x, y, 1, Color.Teal); x++; AddLabelCell("Dc2", x, y, 1, Color.Teal); x++; AddLabelCell("Bf", x, y, 1, Color.Olive); x++; AddLabelCell("Bg", x, y, 1, Color.Olive); x++; AddLabelCell("Tf", x, y, 1, Color.Olive); x++; AddLabelCell("Tg", x, y, 1, Color.Olive); x++; } for (int i = 0; i < noteNumbers.Length; i++) { int x = 0; int y = i + 1; int n = noteNumbers[i]; if (n < 13 || n > 91) { AddTriggerCell(n.ToString(), x, y, 1, Color.Black, () => { }); x++; continue; } XGDrumParams param = new XGDrumParams(Device, TargetMap - 1, n); Drums.Add(param); XGPControlCell noteOnCell = AddTriggerCell(n.ToString(), x, y, 1, Color.Black, () => param.ReSendAll()); x++; bool noteOn = false; noteOnCell.Decrement = () => { if (!noteOn) { noteOn = true; int noteNum = n; int channel = TargetChannel - 1; Device.Write(0x640090 | noteNum << 8 | channel); while ((System.Windows.Forms.Control.MouseButtons & System.Windows.Forms.MouseButtons.Right) != 0) { System.Threading.Thread.Sleep(0); System.Windows.Forms.Application.DoEvents(); } Device.Write(0x000080 | noteNum << 8 | channel); noteOn = false; } }; noteOnCell.GetDescriptionFunc = () => "DblClick: ReSend / RightClick: AUDITION"; AddControlCell(param.RcvNoteOn, x, y, 1, Color.LightGray); x++; XGPControlCell toneNameCell = AddLabelCell("", x, y, 4, Color.LightGray); x += 4; toneNameCell.GetTextFunc = () => { var part = new XGPartParams(Device, TargetChannel - 1); int bankMSB = part.ProgramMSB.Value; int progNum = part.ProgramNumber.Value; return MidiProgramNumber.GetDrumToneName(bankMSB, progNum, n); }; AddControlCell(param.PitchCoarse, x, y, 1, Color.Yellow); x++; AddControlCell(param.PitchFine, x, y, 1, Color.Magenta); x++; AddControlCell(param.Volume, x, y, 1, Color.Lime); x++; AddControlCell(param.Pan, x, y, 1, Color.Yellow); x++; AddControlCell(param.Reverb, x, y, 1, Color.Red); x++; AddControlCell(param.Chorus, x, y, 1, Color.Cyan); x++; AddControlCell(param.Variation, x, y, 1, Color.Blue); x++; AddControlCell(param.LPFCutoffFreq, x, y, 1, Color.Lime); x++; AddControlCell(param.LPFResonance, x, y, 1, Color.Lime); x++; AddControlCell(param.HPFCutoffFreq, x, y, 1, Color.Lime); x++; AddControlCell(param.EGAttackRate, x, y, 1, Color.Cyan); x++; AddControlCell(param.EGDecay1Rate, x, y, 1, Color.Cyan); x++; AddControlCell(param.EGDecay2Rate, x, y, 1, Color.Cyan); x++; AddControlCell(param.EQBassFreq, x, y, 1, Color.Yellow); x++; AddControlCell(param.EQBassGain, x, y, 1, Color.Yellow); x++; AddControlCell(param.EQTrebleFreq, x, y, 1, Color.Yellow); x++; AddControlCell(param.EQTrebleGain, x, y, 1, Color.Yellow); x++; } AdjustWindowSize(); textBox1.Width = (this.ClientSize.Width - textBox1.Left - 12); }
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); } }