protected ParameterCollection(XGMidiIODevice host, string name, int baseAddress) { this.Host = host; this.Name = name; this.BaseAddress = baseAddress; this.Parameters = new List<XGMidiParameter>(); }
public XGDrumParams(XGMidiIODevice host, int setup, int note) : base(host, "DRUM SETUP S" + (setup + 1) + "N" + note, 0x300000 | setup << 16 | note << 8) { this.SetupNumber = setup; this.NoteNumber = note; PitchCoarse = AddParameter("PitchCoarse", 0x00, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); PitchFine = AddParameter("PitchFine", 0x01, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); Volume = AddParameter("Volume", 0x02, 0x00, 0x7f, 0x00); AltGroup = AddParameter("AltGroup", 0x03, 0x00, 0x7f, 0x00); Pan = AddParameter("Pan", 0x04, 0x00, 0x7f, 0x40, XGMidiParameter.PanpotPM); Reverb = AddParameter("Reverb", 0x05, 0x00, 0x7f, 0x00); Chorus = AddParameter("Chorus", 0x06, 0x00, 0x7f, 0x00); Variation = AddParameter("Variation", 0x07, 0x00, 0x7f, 0x00); KeyAssign = AddParameter("KeyAssign", 0x08, 0x00, 0x7f, 0x00); RcvNoteOff = AddParameter("RcvNoteOff", 0x09, 0x00, 0x01, 0x00, XGMidiParameter.OnOff); RcvNoteOn = AddParameter("RcvNoteOn", 0x0A, 0x00, 0x01, 0x00, XGMidiParameter.OnOff); LPFCutoffFreq = AddParameter("LPFCutoffFreq", 0x0B, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); LPFResonance = AddParameter("LPFResonance", 0x0C, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGAttackRate = AddParameter("EGAttackRate", 0x0D, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGDecay1Rate = AddParameter("EGDecay1Rate", 0x0E, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGDecay2Rate = AddParameter("EGDecay2Rate", 0x0F, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQBassGain = AddParameter("EQBassGain", 0x20, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQTrebleGain = AddParameter("EQTrebleGain", 0x21, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQBassFreq = AddParameter("EQBassFreq", 0x24, 0x04, 0x28, 0x04, XGMidiParameter.FreqToString); EQTrebleFreq = AddParameter("EQTrebleFreq", 0x25, 0x1C, 0x3A, 0x1C, XGMidiParameter.FreqToString); HPFCutoffFreq = AddParameter("HPFCutoffFreq", 0x50, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VelocitySensePitch = AddParameter("VelocitySensePitch", 0x60, 0x30, 0x50, 0x40, XGMidiParameter.CenterPM); VelocitySenseLPFCutoff = AddParameter("VelocitySenseLPFCutoff", 0x61, 0x30, 0x50, 0x40, XGMidiParameter.CenterPM); }
protected ParameterCollection(XGMidiIODevice host, string name, int baseAddress) { this.Host = host; this.Name = name; this.BaseAddress = baseAddress; this.Parameters = new List <XGMidiParameter>(); }
public XGMidiParameter(XGMidiIODevice host, string name, int address, int count, int min, int max, int center) { this.Host = host; this.Name = name; this.Address = address; this.Count = count; this.MinValue = min; this.MaxValue = max; this.CenterValue = center; this.ToStringConverter = DefaultToString; this.WriteValueEncoding = v => v; this.ReadValueEncoding = v => v; }
public XGPartParams(XGMidiIODevice host, int channel) : base(host, "Part[" + (channel + 1) + "]", 0x080000 | channel << 8) { Channel = channel; PartMode = AddParameter("PartMode", 0x07, 0x00, 0x05, 0x00, XGMidiParameter.MakeTableToStringFunc("N", "D", "D1", "D2", "D3", "D4")); ProgramMSB = AddParameter("ProgramMSB", 0x01, 0x00, 0x7f, 0x00); ProgramLSB = AddParameter("ProgramLSB", 0x02, 0x00, 0x7f, 0x00); ProgramNumber = AddParameter("ProgramNumber", 0x03, 0x00, 0x7f, 0x00, XGMidiParameter.ProgramNumber); Pan = AddParameter("Pan", 0x0E, 0x00, 0x7f, 0x40, XGMidiParameter.PanpotPM); Volume = AddParameter("Volume", 0x0B, 0x00, 0x7f, 0x00); Reverb = AddParameter("Reverb", 0x13, 0x00, 0x7f, 0x00); Chorus = AddParameter("Chorus", 0x12, 0x00, 0x7f, 0x00); Variation = AddParameter("Variation", 0x14, 0x00, 0x7f, 0x00); DryLevel = AddParameter("DryLevel", 0x11, 0x00, 0x7f, 0x00); LPFCutoffFreq = AddParameter("LPFCutoffFreq", 0x18, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); LPFResonance = AddParameter("LPFResonance", 0x19, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); HPFCutoffFreq = AddParameter("HPFCutoffFreq", 0x020020, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); RcvNoteMessage = AddParameter("RcvNoteMessage", 0x35, 0x00, 0x01, 0x00, XGMidiParameter.OnOff); EGAttack = AddParameter("EGAttack", 0x1A, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGDecay = AddParameter("EGDecay", 0x1B, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGRelease = AddParameter("EGRelease", 0x1C, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VibRate = AddParameter("VibRate", 0x15, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VibDepth = AddParameter("VibDepth", 0x16, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VibDelay = AddParameter("VibDelay", 0x17, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQBassFreq = AddParameter("EQBassFreq", 0x76, 0x04, 0x28, 0x0C, XGMidiParameter.FreqToString); EQBassGain = AddParameter("EQBassGain", 0x72, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQTrebleFreq = AddParameter("EQTrebleFreq", 0x77, 0x1C, 0x3A, 0x36, XGMidiParameter.FreqToString); EQTrebleGain = AddParameter("EQTrebleGain", 0x73, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); MWPitchControl = AddParameter("MWPitchControl", 0x1D, 0x28, 0x58, 0x40, XGMidiParameter.CenterPM); MWLPFControl = AddParameter("MWLPFControl", 0x1E, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); MWAmpControl = AddParameter("MWAmpControl", 0x1F, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); MWLFOPModDepth = AddParameter("MWLFOPModDepth", 0x20, 0x00, 0x7f, 0x00); MWLFOFModDepth = AddParameter("MWLFOFModDepth", 0x21, 0x00, 0x7f, 0x00); MWLFOAModDepth = AddParameter("MWLFOAModDepth", 0x22, 0x00, 0x7f, 0x00); }
public MainForm() { this.Font = new System.Drawing.Font(Config.FontFace, Config.FontSize); this.Text = Util.EntryAssemblyInformation.Title; Device = new XGMidiIODevice(); Device.ResetXG(); InitializeComponent(); this.midiDeviceSelector1.SetDevice(Device); this.midiDeviceSelector1.SizeChanged += (s, e) => FitClientSize(); this.partParameterGrid1.SetDevice(Device); this.partParameterGrid1.SizeChanged += (s, e) => FitClientSize(); this.drumParameterGrid1.SetDevice(Device); this.drumParameterGrid1.SizeChanged += (s, e) => FitClientSize(); this.drumParameterGrid2.SetDevice(Device); this.drumParameterGrid2.SizeChanged += (s, e) => FitClientSize(); this.drumParameterGrid3.SetDevice(Device); this.drumParameterGrid3.SizeChanged += (s, e) => FitClientSize(); this.drumParameterGrid4.SetDevice(Device); this.drumParameterGrid4.SizeChanged += (s, e) => FitClientSize(); this.effectParameterGrid1.SetDevice(Device); this.effectParameterGrid1.SizeChanged += (s, e) => FitClientSize(); this.effectParameterGrid2.SetDevice(Device); this.effectParameterGrid2.SizeChanged += (s, e) => FitClientSize(); this.multiEQParameterGrid1.SetDevice(Device); this.multiEQParameterGrid1.SizeChanged += (s, e) => FitClientSize(); x_ = this.Size.Width - tabControl1.SelectedTab.ClientSize.Width; y_ = this.Size.Height - tabControl1.SelectedTab.ClientSize.Height; FitClientSize(); }
public XGMultiEQParams(XGMidiIODevice host) : base(host, "MULTI EQ", 0x024000) { bandParams = new BandParameter[5]; ToStringDelegate dBStringFunc = XGMidiParameter.MakePlusMinusToStringFunc("-", "dB", "+0dB", "+", "dB", null); ToStringDelegate QStringFunc = v => (v * 0.1).ToString("0.0"); Type = AddParameter("Type", 0, 0, 4, 0, XGMidiParameter.MakeTableToStringFunc("FLAT", "JAZZ", "POPS", "ROCK", "CLASSIC")); Gain1 = AddParameter("Gain1", 1, 0x34, 0x4C, 0x40, dBStringFunc); Freq1 = AddParameter("Freq1", 2, 0x04, 0x28, 0x04, XGMidiParameter.FreqToString); Q1 = AddParameter("Q1", 3, 0x01, 0x78, 0x07, QStringFunc); Shape1 = AddParameter("Shape1", 4, 0, 1, 0, XGMidiParameter.MakeTableToStringFunc("SHELVING", "PEAKING")); bandParams[0] = new BandParameter(Gain1, Freq1, Q1, Shape1, null); Gain2 = AddParameter("Gain2", 5, 0x34, 0x4C, 0x40, dBStringFunc); Freq2 = AddParameter("Freq2", 6, 0x0E, 0x36, 0x0E, XGMidiParameter.FreqToString); Q2 = AddParameter("Q2", 7, 0x01, 0x78, 0x07, QStringFunc); bandParams[1] = new BandParameter(Gain2, Freq2, Q2, null, null); Gain3 = AddParameter("Gain3", 9, 0x34, 0x4C, 0x40, dBStringFunc); Freq3 = AddParameter("Freq3", 10, 0x0E, 0x36, 0x0E, XGMidiParameter.FreqToString); Q3 = AddParameter("Q3", 11, 0x01, 0x78, 0x07, QStringFunc); bandParams[2] = new BandParameter(Gain3, Freq3, Q3, null, null); Gain4 = AddParameter("Gain4", 13, 0x34, 0x4C, 0x40, dBStringFunc); Freq4 = AddParameter("Freq4", 14, 0x0E, 0x36, 0x0E, XGMidiParameter.FreqToString); Q4 = AddParameter("Q4", 15, 0x01, 0x78, 0x07, QStringFunc); bandParams[3] = new BandParameter(Gain4, Freq4, Q4, null, null); Gain5 = AddParameter("Gain5", 17, 0x34, 0x4C, 0x40, dBStringFunc); Freq5 = AddParameter("Freq5", 18, 0x1C, 0x3A, 0x1C, XGMidiParameter.FreqToString); Q5 = AddParameter("Q5", 19, 0x01, 0x78, 0x07, QStringFunc); Shape5 = AddParameter("Shape5", 20, 0, 1, 0, XGMidiParameter.MakeTableToStringFunc("SHELVING", "PEAKING")); bandParams[4] = new BandParameter(Gain5, Freq5, Q5, null, Shape5); Bands = new ReadOnlyCollection <BandParameter>(bandParams); }
public void SetDevice(XGMidiIODevice device) { Debug.Assert(this.Device == null); this.Device = device; comboBoxMidiInSelect.Items.AddRange(MidiIn.GetDeviceNames()); comboBoxMidiOutSelect.Items.AddRange(MidiOut.GetDeviceNames()); int inIndex = Array.IndexOf(MidiIn.GetDeviceNames(), Config.lastSelectedMidiIn); if (inIndex < 0) { inIndex = 0; } if (comboBoxMidiInSelect.Items.Count > 0) { comboBoxMidiInSelect.SelectedIndex = inIndex; } int outIndex = Array.IndexOf(MidiOut.GetDeviceNames(), Config.lastSelectedMidiOut); if (outIndex < 0) { outIndex = 0; } if (comboBoxMidiOutSelect.Items.Count > 0) { comboBoxMidiOutSelect.SelectedIndex = outIndex; } pictureBox1.Height = pictureBox1.Width; timer1.Interval = 10; timer1.Tick += Timer1_Tick; timer1.Enabled = true; CreateXGPControls(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (Device != null) { Device.Dispose(); Device = null; } }
public XGEffectParams(XGMidiIODevice host, XGEffectBlockType type) : base(host, "Effect[" + type + "]", GetEffectBlockAddress(type)) { BlockType = type; efctParams = new XGMidiParameter[16]; int address = 0; EffectType = AddParameter("EffectType", address++, 0x00, 0x00, 0x00); EffectType.ToStringConverter = v => XGEffect.GetEffectByTypeValue(v << 1 & 0x7F00 | v & 0x7F).Name; EffectType.Count = 2; address++; bool isSystemEffect = type <= XGEffectBlockType.Variation; bool isInsEffect = type >= XGEffectBlockType.Variation; bool hasSendToRev = type == XGEffectBlockType.Chorus || type == XGEffectBlockType.Variation; bool hasSendToCho = type == XGEffectBlockType.Variation; bool hasVarConnect = type == XGEffectBlockType.Variation; for (int i = 0; i < 10; i++) { if (type != XGEffectBlockType.Variation) { efctParams[i] = AddParameter("Parameter " + i, address, 0, 127, 0); address += 1; } else { efctParams[i] = AddParameter("Parameter " + i, address, 0, 16384, 0); efctParams[i].Count = 2; address += 2; } } Return = isSystemEffect ? AddParameter("Return", address++, 0x00, 0x7f, 0x00) : null; Pan = isSystemEffect ? AddParameter("Pan", address++, 0x00, 0x7f, 0x40, XGMidiParameter.PanpotPM) : null; SendToReverb = hasSendToRev ? AddParameter("SendToReverb", address++, 0x00, 0x7f, 0x00) : null; SendToChorus = hasSendToCho ? AddParameter("SendToChorus", address++, 0x00, 0x7f, 0x00) : null; VariationConnect = hasVarConnect ? AddParameter("VariationConnect", address++, 0x00, 0x01, 0x00, v => v == 0 ? "Insertion" : v == 1 ? "System" : "? " + v) : null; if (isInsEffect) { PartNumber = AddParameter("PartNumber", address++, 0, 66, 0); PartNumber.ToStringConverter = v => v == 66 ? "OFF" : v < 64 ? (v + 1).ToString() : v == 64 ? "AD1" : v == 65 ? "AD2" : "? " + v; PartNumber.ReadValueEncoding = v => v != 127 ? v : 66; PartNumber.WriteValueEncoding = v => v != 66 ? v : 127; } for (int i = 0; i < 6; i++) { int subBlock = type == XGEffectBlockType.Reverb ? 0x10 : type == XGEffectBlockType.Chorus ? 0x10 : type == XGEffectBlockType.Variation ? 0x30 : type >= XGEffectBlockType.Insertion1 ? 0x20 : 0; efctParams[10 + i] = AddParameter("---", subBlock + i, 0, 127, 0); address += 1; } EffectParameters = new ReadOnlyCollection <XGMidiParameter>(efctParams); ReLink(); }
public XGPartParams(XGMidiIODevice host, int channel) : base(host, "Part[" + (channel + 1) + "]", 0x080000 | channel << 8) { Channel = channel; PartMode = AddParameter("PartMode", 0x07, 0x00, 0x05, 0x00, XGMidiParameter.MakeTableToStringFunc("N","D","D1","D2","D3","D4")); ProgramMSB = AddParameter("ProgramMSB", 0x01, 0x00, 0x7f, 0x00); ProgramLSB = AddParameter("ProgramLSB", 0x02, 0x00, 0x7f, 0x00); ProgramNumber = AddParameter("ProgramNumber", 0x03, 0x00, 0x7f, 0x00, XGMidiParameter.ProgramNumber); Pan = AddParameter("Pan", 0x0E, 0x00, 0x7f, 0x40, XGMidiParameter.PanpotPM); Volume = AddParameter("Volume", 0x0B, 0x00, 0x7f, 0x00); Reverb = AddParameter("Reverb", 0x13, 0x00, 0x7f, 0x00); Chorus = AddParameter("Chorus", 0x12, 0x00, 0x7f, 0x00); Variation = AddParameter("Variation", 0x14, 0x00, 0x7f, 0x00); DryLevel = AddParameter("DryLevel", 0x11, 0x00, 0x7f, 0x00); LPFCutoffFreq = AddParameter("LPFCutoffFreq", 0x18, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); LPFResonance = AddParameter("LPFResonance", 0x19, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); HPFCutoffFreq = AddParameter("HPFCutoffFreq", 0x020020, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); RcvNoteMessage = AddParameter("RcvNoteMessage", 0x35, 0x00, 0x01, 0x00, XGMidiParameter.OnOff); EGAttack = AddParameter("EGAttack", 0x1A, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGDecay = AddParameter("EGDecay", 0x1B, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGRelease = AddParameter("EGRelease", 0x1C, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VibRate = AddParameter("VibRate", 0x15, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VibDepth = AddParameter("VibDepth", 0x16, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VibDelay = AddParameter("VibDelay", 0x17, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQBassFreq = AddParameter("EQBassFreq", 0x76, 0x04, 0x28, 0x0C, XGMidiParameter.FreqToString); EQBassGain = AddParameter("EQBassGain", 0x72, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQTrebleFreq = AddParameter("EQTrebleFreq", 0x77, 0x1C, 0x3A, 0x36, XGMidiParameter.FreqToString); EQTrebleGain = AddParameter("EQTrebleGain", 0x73, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); MWPitchControl = AddParameter("MWPitchControl", 0x1D, 0x28, 0x58, 0x40, XGMidiParameter.CenterPM); MWLPFControl = AddParameter("MWLPFControl", 0x1E, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); MWAmpControl = AddParameter("MWAmpControl", 0x1F, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); MWLFOPModDepth = AddParameter("MWLFOPModDepth", 0x20, 0x00, 0x7f, 0x00); MWLFOFModDepth = AddParameter("MWLFOFModDepth", 0x21, 0x00, 0x7f, 0x00); MWLFOAModDepth = AddParameter("MWLFOAModDepth", 0x22, 0x00, 0x7f, 0x00); }
public XGMultiEQParams(XGMidiIODevice host) : base(host, "MULTI EQ", 0x024000) { bandParams = new BandParameter[5]; ToStringDelegate dBStringFunc = XGMidiParameter.MakePlusMinusToStringFunc("-", "dB", "+0dB", "+", "dB", null); ToStringDelegate QStringFunc = v => (v * 0.1).ToString("0.0"); Type = AddParameter("Type", 0, 0, 4, 0, XGMidiParameter.MakeTableToStringFunc("FLAT", "JAZZ", "POPS", "ROCK", "CLASSIC")); Gain1 = AddParameter("Gain1", 1, 0x34, 0x4C, 0x40, dBStringFunc); Freq1 = AddParameter("Freq1", 2, 0x04, 0x28, 0x04, XGMidiParameter.FreqToString); Q1 = AddParameter("Q1", 3, 0x01, 0x78, 0x07, QStringFunc); Shape1 = AddParameter("Shape1", 4, 0, 1, 0, XGMidiParameter.MakeTableToStringFunc("SHELVING", "PEAKING")); bandParams[0] = new BandParameter(Gain1, Freq1, Q1, Shape1, null); Gain2 = AddParameter("Gain2", 5, 0x34, 0x4C, 0x40, dBStringFunc); Freq2 = AddParameter("Freq2", 6, 0x0E, 0x36, 0x0E, XGMidiParameter.FreqToString); Q2 = AddParameter("Q2", 7, 0x01, 0x78, 0x07, QStringFunc); bandParams[1] = new BandParameter(Gain2, Freq2, Q2, null, null); Gain3 = AddParameter("Gain3", 9, 0x34, 0x4C, 0x40, dBStringFunc); Freq3 = AddParameter("Freq3", 10, 0x0E, 0x36, 0x0E, XGMidiParameter.FreqToString); Q3 = AddParameter("Q3", 11, 0x01, 0x78, 0x07, QStringFunc); bandParams[2] = new BandParameter(Gain3, Freq3, Q3, null, null); Gain4 = AddParameter("Gain4", 13, 0x34, 0x4C, 0x40, dBStringFunc); Freq4 = AddParameter("Freq4", 14, 0x0E, 0x36, 0x0E, XGMidiParameter.FreqToString); Q4 = AddParameter("Q4", 15, 0x01, 0x78, 0x07, QStringFunc); bandParams[3] = new BandParameter(Gain4, Freq4, Q4, null, null); Gain5 = AddParameter("Gain5", 17, 0x34, 0x4C, 0x40, dBStringFunc); Freq5 = AddParameter("Freq5", 18, 0x1C, 0x3A, 0x1C, XGMidiParameter.FreqToString); Q5 = AddParameter("Q5", 19, 0x01, 0x78, 0x07, QStringFunc); Shape5 = AddParameter("Shape5", 20, 0, 1, 0, XGMidiParameter.MakeTableToStringFunc("SHELVING", "PEAKING")); bandParams[4] = new BandParameter(Gain5, Freq5, Q5, null, Shape5); Bands = new ReadOnlyCollection<BandParameter>(bandParams); }
public XGMidiParameter(XGMidiIODevice host, string name, int address, int count, int min, int max, int center) { this.Host = host; this.Name = name; this.Address = address; this.Count = count; this.MinValue = min; this.MaxValue = max; this.CenterValue = center; this.ToStringConverter = DefaultToString; this.WriteValueEncoding = v => v; this.ReadValueEncoding = v => v; }
public XGEffectParams(XGMidiIODevice host, XGEffectBlockType type) : base(host, "Effect[" + type + "]", GetEffectBlockAddress(type)) { BlockType = type; efctParams = new XGMidiParameter[16]; int address = 0; EffectType = AddParameter("EffectType", address++, 0x00, 0x00, 0x00); EffectType.ToStringConverter = v => XGEffect.GetEffectByTypeValue(v << 1 & 0x7F00 | v & 0x7F).Name; EffectType.Count = 2; address++; bool isSystemEffect = type <= XGEffectBlockType.Variation; bool isInsEffect = type >= XGEffectBlockType.Variation; bool hasSendToRev = type == XGEffectBlockType.Chorus || type == XGEffectBlockType.Variation; bool hasSendToCho = type == XGEffectBlockType.Variation; bool hasVarConnect = type == XGEffectBlockType.Variation; for (int i = 0; i < 10; i++) { if (type != XGEffectBlockType.Variation) { efctParams[i] = AddParameter("Parameter " + i, address, 0, 127, 0); address += 1; } else { efctParams[i] = AddParameter("Parameter " + i, address, 0, 16384, 0); efctParams[i].Count = 2; address += 2; } } Return = isSystemEffect ? AddParameter("Return", address++, 0x00, 0x7f, 0x00) : null; Pan = isSystemEffect ? AddParameter("Pan", address++, 0x00, 0x7f, 0x40, XGMidiParameter.PanpotPM) : null; SendToReverb = hasSendToRev ? AddParameter("SendToReverb", address++, 0x00, 0x7f, 0x00) : null; SendToChorus = hasSendToCho ? AddParameter("SendToChorus", address++, 0x00, 0x7f, 0x00) : null; VariationConnect = hasVarConnect ? AddParameter("VariationConnect", address++, 0x00, 0x01, 0x00, v => v == 0 ? "Insertion" : v == 1 ? "System" : "? " + v) : null; if (isInsEffect) { PartNumber = AddParameter("PartNumber", address++, 0, 66, 0); PartNumber.ToStringConverter = v => v == 66 ? "OFF" : v < 64 ? (v + 1).ToString() : v == 64 ? "AD1" : v == 65 ? "AD2" : "? " + v; PartNumber.ReadValueEncoding = v => v != 127 ? v : 66; PartNumber.WriteValueEncoding = v => v != 66 ? v : 127; } for (int i = 0; i < 6; i++) { int subBlock = type == XGEffectBlockType.Reverb ? 0x10 : type == XGEffectBlockType.Chorus ? 0x10 : type == XGEffectBlockType.Variation ? 0x30 : type >= XGEffectBlockType.Insertion1 ? 0x20 : 0; efctParams[10 + i] = AddParameter("---", subBlock + i, 0, 127, 0); address += 1; } EffectParameters = new ReadOnlyCollection<XGMidiParameter>(efctParams); ReLink(); }
public XGDrumParams(XGMidiIODevice host, int setup, int note) : base(host, "DRUM SETUP S" + (setup + 1) + "N" + note, 0x300000 | setup << 16 | note << 8) { this.SetupNumber = setup; this.NoteNumber = note; PitchCoarse = AddParameter("PitchCoarse", 0x00, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); PitchFine = AddParameter("PitchFine", 0x01, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); Volume = AddParameter("Volume", 0x02, 0x00, 0x7f, 0x00); AltGroup = AddParameter("AltGroup", 0x03, 0x00, 0x7f, 0x00); Pan = AddParameter("Pan", 0x04, 0x00, 0x7f, 0x40, XGMidiParameter.PanpotPM); Reverb = AddParameter("Reverb", 0x05, 0x00, 0x7f, 0x00); Chorus = AddParameter("Chorus", 0x06, 0x00, 0x7f, 0x00); Variation = AddParameter("Variation", 0x07, 0x00, 0x7f, 0x00); KeyAssign = AddParameter("KeyAssign", 0x08, 0x00, 0x7f, 0x00); RcvNoteOff = AddParameter("RcvNoteOff", 0x09, 0x00, 0x01, 0x00, XGMidiParameter.OnOff); RcvNoteOn = AddParameter("RcvNoteOn", 0x0A, 0x00, 0x01, 0x00, XGMidiParameter.OnOff); LPFCutoffFreq = AddParameter("LPFCutoffFreq", 0x0B, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); LPFResonance = AddParameter("LPFResonance", 0x0C, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGAttackRate = AddParameter("EGAttackRate", 0x0D, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGDecay1Rate = AddParameter("EGDecay1Rate", 0x0E, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EGDecay2Rate = AddParameter("EGDecay2Rate", 0x0F, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQBassGain = AddParameter("EQBassGain", 0x20, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQTrebleGain = AddParameter("EQTrebleGain", 0x21, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); EQBassFreq = AddParameter("EQBassFreq", 0x24, 0x04, 0x28, 0x04, XGMidiParameter.FreqToString); EQTrebleFreq = AddParameter("EQTrebleFreq", 0x25, 0x1C, 0x3A, 0x1C, XGMidiParameter.FreqToString); HPFCutoffFreq = AddParameter("HPFCutoffFreq", 0x50, 0x00, 0x7f, 0x40, XGMidiParameter.CenterPM); VelocitySensePitch = AddParameter("VelocitySensePitch", 0x60, 0x30, 0x50, 0x40, XGMidiParameter.CenterPM); VelocitySenseLPFCutoff = AddParameter("VelocitySenseLPFCutoff", 0x61, 0x30, 0x50, 0x40, XGMidiParameter.CenterPM); }
public void SetDevice(XGMidiIODevice device) { Debug.Assert(this.Device == null); this.Device = device; OnSetDevice(); AdjustWindowSize(); }