public void ReLink() { int v = EffectType.Value; XGEffect effect = XGEffect.GetEffectByTypeValue(v & 0x7f | v << 1 & 0x7f00); if (effect == null) { return; } this.effect_ = effect; if (this.BlockType >= XGEffectBlockType.Insertion1) { for (int i = 0; i < 10; i++) { efctParams[i].Address = effect.ExDataUsed ? BaseAddress + 0x30 + i * 2 : BaseAddress + 0x02 + i * 1; efctParams[i].Count = effect.ExDataUsed ? 2 : 1; } } XGEffect.XGEffectParam dummy = new XGEffect.XGEffectParam("---", 0, 0, 0, "", "---"); for (int i = 0; i < 16; i++) { XGEffect.XGEffectParam param = effect.ParameterTypes[i] ?? dummy; efctParams[i].Name = this.Name + " " + param.Name; efctParams[i].Description = param.Description; efctParams[i].MinValue = param.MinValue; efctParams[i].MaxValue = param.MaxValue; efctParams[i].ToStringConverter = param.Conveter; efctParams[i].CenterValue = param.MinValue; } }
void OnBulkDumpChain(int address) { // Insertion Effect if ((address & 0xFFFCFF) == 0x030000) { int v = ParameterMemoryData.Read2(address); XGEffect fx = XGEffect.GetEffectByTypeValue(v & 0x7f | v << 1 & 0x7f00); if (fx != null && fx.ExDataUsed) { SendXGBulkDumpRequest(address + 0x30); } } }
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(); }