private void Load(Stream reader) { List <SfzRegion> regions = new List <SfzRegion>(); using (reader) { SfzRegion group = new SfzRegion(true); SfzRegion global = new SfzRegion(true); SfzRegion master = new SfzRegion(true); string[] regionText; SkipNextString(reader, '<'); regionText = ReadNextRegion(reader); while (!regionText[0].Equals(string.Empty)) { switch (regionText[0].ToLower()) { case "global": ToRegion(regionText[1], global); break; case "master": ToRegion(regionText[1], master); break; case "group": ToRegion(regionText[1], group); break; case "region": SfzRegion r = new SfzRegion(false); r.ApplyGlobal(global); r.ApplyGlobal(master); r.ApplyGlobal(group); ToRegion(regionText[1], r); if (!r.sample.Equals(string.Empty)) { regions.Add(r); } break; default: break; } regionText = ReadNextRegion(reader); } } regionList = regions.ToArray(); }
private void Load(Stream reader) { List<SfzRegion> regions = new List<SfzRegion>(); using (reader) { SfzRegion group = new SfzRegion(true); SfzRegion global = new SfzRegion(true); SfzRegion master = new SfzRegion(true); string[] regionText = new string[2]; ReadNextString(reader, '<'); //skip everything before the first region while (ReadNextRegion(reader, regionText)) { switch (regionText[0].ToLower()) { case "global": ToRegion(regionText[1], global); break; case "master": ToRegion(regionText[1], master); break; case "group": ToRegion(regionText[1], group); break; case "region": SfzRegion r = new SfzRegion(false); r.ApplyGlobal(global); r.ApplyGlobal(master); r.ApplyGlobal(group); ToRegion(regionText[1], r); if (!r.sample.Equals(string.Empty)) regions.Add(r); break; default: break; } } } regionList = regions.ToArray(); }
private void LoadSfzCustom(SfzRegion region) { CustomDescriptions = new CustomDescriptor[1]; CustomDescriptions[0] = new CustomDescriptor("sfzi", 32, new object[] { region.offBy, region.group, region.volume, region.pan / 100f, region.ampKeyTrack, region.ampKeyCenter, region.ampVelTrack / 100f }); }
private void LoadSfzGens(SfzRegion region) { GenDescriptions = new GeneratorDescriptor[1]; GenDescriptions[0] = new GeneratorDescriptor(); GenDescriptions[0].SamplerType = Components.WaveformEnum.SampleData; GenDescriptions[0].AssetName = region.sample; //deal with end point if (region.end == -1) //-1 is silent region, so set end to 0 and let the generator figure it out later GenDescriptions[0].EndPhase = 0; else if (region.end == 0) //set end out of range and let the descriptor default it to the proper end value GenDescriptions[0].EndPhase = -1; else //add one to the value because its inclusive GenDescriptions[0].EndPhase = region.end + 1; GenDescriptions[0].KeyTrack = region.pitchKeyTrack; //deal with loop end if (region.loopEnd < 0) GenDescriptions[0].LoopEndPhase = -1; else GenDescriptions[0].LoopEndPhase = region.loopEnd + 1; GenDescriptions[0].LoopMethod = region.loopMode; if (region.loopStart < 0) GenDescriptions[0].LoopStartPhase = -1; else GenDescriptions[0].LoopStartPhase = region.loopStart; GenDescriptions[0].Offset = region.offset; GenDescriptions[0].Rootkey = region.pitchKeyCenter; GenDescriptions[0].Tune = (short)(region.tune + region.transpose * 100); GenDescriptions[0].VelTrack = region.pitchVelTrack; }
private void LoadSfzLfos(SfzRegion region) { LfoDescriptions = new LfoDescriptor[3]; LfoDescriptions[0] = new LfoDescriptor(); LfoDescriptions[0].DelayTime = region.pitchLfoDelay; //make sure pitch lfo is enabled for midi mod event LfoDescriptions[0].Frequency = region.pitchLfoFrequency > 0 ? region.pitchLfoFrequency : (float)Synthesizer.DefaultLfoFrequency; LfoDescriptions[0].Depth = region.pitchLfoDepth; LfoDescriptions[1] = new LfoDescriptor(); LfoDescriptions[1].DelayTime = region.filterLfoDelay; LfoDescriptions[1].Frequency = region.filterLfoFrequency; LfoDescriptions[1].Depth = region.filterLfoDepth; LfoDescriptions[2] = new LfoDescriptor(); LfoDescriptions[2].DelayTime = region.ampLfoDelay; LfoDescriptions[2].Frequency = region.ampLfoFrequency; LfoDescriptions[2].Depth = (float)SynthHelper.DBtoLinear(region.ampLfoDepth); }
private void LoadSfzFilters(SfzRegion region) { FilterDescriptions = new FilterDescriptor[1]; FilterDescriptions[0] = new FilterDescriptor(); FilterDescriptions[0].FilterMethod = region.filterType; FilterDescriptions[0].CutOff = region.cutOff; FilterDescriptions[0].KeyTrack = region.filterKeyTrack; FilterDescriptions[0].Resonance = (float)SynthHelper.DBtoLinear(region.resonance); FilterDescriptions[0].RootKey = region.filterKeyCenter; FilterDescriptions[0].VelTrack = region.filterVelTrack; }
private void LoadSfzEnvelopes(SfzRegion region) { EnvelopeDescriptions = new EnvelopeDescriptor[3]; EnvelopeDescriptions[0] = new EnvelopeDescriptor(); EnvelopeDescriptions[0].DelayTime = region.pitchEGDelay; EnvelopeDescriptions[0].AttackTime = region.pitchEGAttack; EnvelopeDescriptions[0].HoldTime = region.pitchEGHold; EnvelopeDescriptions[0].DecayTime = region.pitchEGDecay; EnvelopeDescriptions[0].SustainLevel = region.pitchEGSustain / 100f; EnvelopeDescriptions[0].ReleaseTime = region.pitchEGRelease; EnvelopeDescriptions[0].StartLevel = region.pitchEGStart / 100f; EnvelopeDescriptions[0].Depth = region.pitchEGDepth; EnvelopeDescriptions[0].Vel2Delay = region.pitchEGVel2Delay; EnvelopeDescriptions[0].Vel2Attack = region.pitchEGVel2Attack; EnvelopeDescriptions[0].Vel2Hold = region.pitchEGVel2Hold; EnvelopeDescriptions[0].Vel2Decay = region.pitchEGVel2Decay; EnvelopeDescriptions[0].Vel2Sustain = region.pitchEGVel2Sustain; EnvelopeDescriptions[0].Vel2Release = region.pitchEGVel2Release; EnvelopeDescriptions[0].Vel2Depth = region.pitchEGVel2Depth; EnvelopeDescriptions[1] = new EnvelopeDescriptor(); EnvelopeDescriptions[1].DelayTime = region.filterEGDelay; EnvelopeDescriptions[1].AttackTime = region.filterEGAttack; EnvelopeDescriptions[1].HoldTime = region.filterEGHold; EnvelopeDescriptions[1].DecayTime = region.filterEGDecay; EnvelopeDescriptions[1].SustainLevel = region.filterEGSustain / 100f; EnvelopeDescriptions[1].ReleaseTime = region.filterEGRelease; EnvelopeDescriptions[1].StartLevel = region.filterEGStart / 100f; EnvelopeDescriptions[1].Depth = region.filterEGDepth; EnvelopeDescriptions[1].Vel2Delay = region.filterEGVel2Delay; EnvelopeDescriptions[1].Vel2Attack = region.filterEGVel2Attack; EnvelopeDescriptions[1].Vel2Hold = region.filterEGVel2Hold; EnvelopeDescriptions[1].Vel2Decay = region.filterEGVel2Decay; EnvelopeDescriptions[1].Vel2Sustain = region.filterEGVel2Sustain; EnvelopeDescriptions[1].Vel2Release = region.filterEGVel2Release; EnvelopeDescriptions[1].Vel2Depth = region.filterEGVel2Depth; EnvelopeDescriptions[2] = new EnvelopeDescriptor(); EnvelopeDescriptions[2].DelayTime = region.ampEGDelay; EnvelopeDescriptions[2].AttackTime = region.ampEGAttack; EnvelopeDescriptions[2].HoldTime = region.ampEGHold; EnvelopeDescriptions[2].DecayTime = region.ampEGDecay; EnvelopeDescriptions[2].SustainLevel = region.ampEGSustain / 100f; EnvelopeDescriptions[2].ReleaseTime = region.ampEGRelease; EnvelopeDescriptions[2].StartLevel = region.ampEGStart / 100f; EnvelopeDescriptions[2].Depth = 1f; EnvelopeDescriptions[2].Vel2Delay = region.ampEGVel2Delay; EnvelopeDescriptions[2].Vel2Attack = region.ampEGVel2Attack; EnvelopeDescriptions[2].Vel2Hold = region.ampEGVel2Hold; EnvelopeDescriptions[2].Vel2Decay = region.ampEGVel2Decay; EnvelopeDescriptions[2].Vel2Sustain = region.ampEGVel2Sustain; EnvelopeDescriptions[2].Vel2Release = region.ampEGVel2Release; EnvelopeDescriptions[2].Vel2Depth = 0f; }
public DescriptorList(SfzRegion region) { LoadSfzEnvelopes(region); LoadSfzFilters(region); LoadSfzLfos(region); LoadSfzGens(region); LoadSfzCustom(region); }
private void ToRegion(string regionText, SfzRegion region) { string[] param = new string[2]; int index = ReadNextParam(0, regionText, param); while (index != -1) { string command = param[0].ToLower(); string parameter = param[1].ToLower(); switch (command) { case "sample": if (IOHelper.GetExtension(parameter).Equals(string.Empty)) { parameter += ".wav"; } region.sample = parameter; break; case "lochan": region.loChan = (byte)(int.Parse(parameter) - 1); break; case "hichan": region.hiChan = (byte)(int.Parse(parameter) - 1); break; case "lokey": region.loKey = NoteNameToValue(parameter); break; case "hikey": region.hiKey = NoteNameToValue(parameter); break; case "key": region.loKey = NoteNameToValue(parameter); region.hiKey = region.loKey; region.pitchKeyCenter = region.loKey; break; case "lovel": region.loVel = byte.Parse(parameter); break; case "hivel": region.hiVel = byte.Parse(parameter); break; case "lobend": region.loBend = short.Parse(parameter); break; case "hibend": region.hiBend = short.Parse(parameter); break; case "lochanaft": region.loChanAft = byte.Parse(parameter); break; case "hichanaft": region.hiChanAft = byte.Parse(parameter); break; case "lopolyaft": region.loPolyAft = byte.Parse(parameter); break; case "hipolyaft": region.hiPolyAft = byte.Parse(parameter); break; case "group": region.group = int.Parse(parameter); break; case "off_by": region.offBy = int.Parse(parameter); break; case "off_mode": region.offMode = parameter.Equals("fast") ? SfzRegion.OffModeEnum.Fast : SfzRegion.OffModeEnum.Normal; break; case "delay": region.delay = float.Parse(parameter); break; case "offset": region.offset = int.Parse(parameter); break; case "end": region.end = int.Parse(parameter); break; case "count": region.count = int.Parse(parameter); region.loopMode = LoopModeEnum.OneShot; break; case "loop_mode": switch (parameter) { case "no_loop": region.loopMode = LoopModeEnum.NoLoop; break; case "one_shot": region.loopMode = LoopModeEnum.OneShot; break; case "loop_continuous": region.loopMode = LoopModeEnum.Continuous; break; case "loop_sustain": region.loopMode = LoopModeEnum.LoopUntilNoteOff; break; default: break; } break; case "loop_start": region.loopStart = int.Parse(parameter); break; case "loop_end": region.loopEnd = int.Parse(parameter); break; case "transpose": region.transpose = short.Parse(parameter); break; case "tune": region.tune = short.Parse(parameter); break; case "pitch_keycenter": region.pitchKeyCenter = NoteNameToValue(parameter); break; case "pitch_keytrack": region.pitchKeyTrack = short.Parse(parameter); break; case "pitch_veltrack": region.pitchVelTrack = short.Parse(parameter); break; case "pitcheg_delay": region.pitchEGDelay = float.Parse(parameter); break; case "pitcheg_start": region.pitchEGStart = float.Parse(parameter); break; case "pitcheg_attack": region.pitchEGAttack = float.Parse(parameter); break; case "pitcheg_hold": region.pitchEGHold = float.Parse(parameter); break; case "pitcheg_decay": region.pitchEGDecay = float.Parse(parameter); break; case "pitcheg_sustain": region.pitchEGSustain = float.Parse(parameter); break; case "pitcheg_release": region.pitchEGRelease = float.Parse(parameter); break; case "pitcheg_depth": region.pitchEGDepth = short.Parse(parameter); break; case "pitcheg_vel2delay": region.pitchEGVel2Delay = float.Parse(parameter); break; case "pitcheg_vel2attack": region.pitchEGVel2Attack = float.Parse(parameter); break; case "pitcheg_vel2hold": region.pitchEGVel2Hold = float.Parse(parameter); break; case "pitcheg_vel2decay": region.pitchEGVel2Decay = float.Parse(parameter); break; case "pitcheg_vel2sustain": region.pitchEGVel2Sustain = float.Parse(parameter); break; case "pitcheg_vel2release": region.pitchEGVel2Release = float.Parse(parameter); break; case "pitcheg_vel2depth": region.pitchEGVel2Depth = short.Parse(parameter); break; case "pitchlfo_delay": region.pitchLfoDelay = float.Parse(parameter); break; case "pitchlfo_freq": region.pitchLfoFrequency = float.Parse(parameter); break; case "pitchlfo_depth": region.pitchLfoDepth = short.Parse(parameter); break; case "fil_type": switch (parameter) { case "lpf_1p": region.filterType = FilterTypeEnum.OnePoleLowpass; break; case "hpf_1p": region.filterType = FilterTypeEnum.None; //unsupported break; case "lpf_2p": region.filterType = FilterTypeEnum.BiquadLowpass; break; case "hpf_2p": region.filterType = FilterTypeEnum.BiquadHighpass; break; case "bpf_2p": region.filterType = FilterTypeEnum.None; //unsupported break; case "brf_2p": region.filterType = FilterTypeEnum.None; //unsupported break; default: break; } break; case "cutoff": region.cutOff = float.Parse(parameter); break; case "resonance": region.resonance = float.Parse(parameter); break; case "fil_keytrack": region.filterKeyTrack = short.Parse(parameter); break; case "fil_keycenter": region.filterKeyCenter = byte.Parse(parameter); break; case "fil_veltrack": region.filterVelTrack = short.Parse(parameter); break; case "fileg_delay": region.filterEGDelay = float.Parse(parameter); break; case "fileg_start": region.filterEGStart = float.Parse(parameter); break; case "fileg_attack": region.filterEGAttack = float.Parse(parameter); break; case "fileg_hold": region.filterEGHold = float.Parse(parameter); break; case "fileg_decay": region.filterEGDecay = float.Parse(parameter); break; case "fileg_sustain": region.filterEGSustain = float.Parse(parameter); break; case "fileg_release": region.filterEGRelease = float.Parse(parameter); break; case "fileg_depth": region.filterEGDepth = short.Parse(parameter); break; case "fileg_vel2delay": region.filterEGVel2Delay = float.Parse(parameter); break; case "fileg_vel2attack": region.filterEGVel2Attack = float.Parse(parameter); break; case "fileg_vel2hold": region.filterEGVel2Hold = float.Parse(parameter); break; case "fileg_vel2decay": region.filterEGVel2Decay = float.Parse(parameter); break; case "fileg_vel2sustain": region.filterEGVel2Sustain = float.Parse(parameter); break; case "fileg_vel2release": region.filterEGVel2Release = float.Parse(parameter); break; case "fileg_vel2depth": region.filterEGVel2Depth = short.Parse(parameter); break; case "fillfo_delay": region.filterLfoDelay = float.Parse(parameter); break; case "fillfo_freq": region.filterLfoFrequency = float.Parse(parameter); break; case "fillfo_depth": region.filterLfoDepth = float.Parse(parameter); break; case "volume": region.volume = float.Parse(parameter); break; case "pan": region.pan = float.Parse(parameter); break; case "amp_keytrack": region.ampKeyTrack = float.Parse(parameter); break; case "amp_keycenter": region.ampKeyCenter = byte.Parse(parameter); break; case "amp_veltrack": region.ampVelTrack = float.Parse(parameter); break; case "ampeg_delay": region.ampEGDelay = float.Parse(parameter); break; case "ampeg_start": region.ampEGStart = float.Parse(parameter); break; case "ampeg_attack": region.ampEGAttack = float.Parse(parameter); break; case "ampeg_hold": region.ampEGHold = float.Parse(parameter); break; case "ampeg_decay": region.ampEGDecay = float.Parse(parameter); break; case "ampeg_sustain": region.ampEGSustain = float.Parse(parameter); break; case "ampeg_release": region.ampEGRelease = float.Parse(parameter); break; case "ampeg_vel2delay": region.ampEGVel2Delay = float.Parse(parameter); break; case "ampeg_vel2attack": region.ampEGVel2Attack = float.Parse(parameter); break; case "ampeg_vel2hold": region.ampEGVel2Hold = float.Parse(parameter); break; case "ampeg_vel2decay": region.ampEGVel2Decay = float.Parse(parameter); break; case "ampeg_vel2sustain": region.ampEGVel2Sustain = float.Parse(parameter); break; case "ampeg_vel2release": region.ampEGVel2Release = float.Parse(parameter); break; case "amplfo_delay": region.ampLfoDelay = float.Parse(parameter); break; case "amplfo_freq": region.ampLfoFrequency = float.Parse(parameter); break; case "amplfo_depth": region.ampLfoDepth = float.Parse(parameter); break; default: break; } index = ReadNextParam(index, regionText, param); } }
public void ApplyGlobal(SfzRegion globalRegion) { if (globalRegion.sample != null) { this.sample = globalRegion.sample; } if (globalRegion.loChan != 255) { this.loChan = globalRegion.loChan; } if (globalRegion.hiChan != 255) { this.hiChan = globalRegion.hiChan; } if (globalRegion.loKey != 255) { this.loKey = globalRegion.loKey; } if (globalRegion.hiKey != 255) { this.hiKey = globalRegion.hiKey; } if (globalRegion.loVel != 255) { this.loVel = globalRegion.loVel; } if (globalRegion.hiVel != 255) { this.hiVel = globalRegion.hiVel; } if (globalRegion.loBend != short.MaxValue) { this.loBend = globalRegion.loBend; } if (globalRegion.hiBend != short.MaxValue) { this.hiBend = globalRegion.hiBend; } if (globalRegion.loChanAft != 255) { this.loChanAft = globalRegion.loChanAft; } if (globalRegion.hiChanAft != 255) { this.hiChanAft = globalRegion.hiChanAft; } if (globalRegion.loPolyAft != 255) { this.loPolyAft = globalRegion.loPolyAft; } if (globalRegion.hiPolyAft != 255) { this.hiPolyAft = globalRegion.hiPolyAft; } if (globalRegion.group != int.MaxValue) { this.group = globalRegion.group; } if (globalRegion.offBy != int.MaxValue) { this.offBy = globalRegion.offBy; } if ((int)globalRegion.offMode != int.MaxValue) { this.offMode = globalRegion.offMode; } if (globalRegion.delay != float.MaxValue) { this.delay = globalRegion.delay; } if (globalRegion.offset != int.MaxValue) { this.offset = globalRegion.offset; } if (globalRegion.end != int.MaxValue) { this.end = globalRegion.end; } if (globalRegion.count != int.MaxValue) { this.count = globalRegion.count; } if ((int)globalRegion.loopMode != int.MaxValue) { this.loopMode = globalRegion.loopMode; } if (globalRegion.loopStart != int.MaxValue) { this.loopStart = globalRegion.loopStart; } if (globalRegion.loopEnd != int.MaxValue) { this.loopEnd = globalRegion.loopEnd; } if (globalRegion.transpose != short.MaxValue) { this.transpose = globalRegion.transpose; } if (globalRegion.tune != short.MaxValue) { this.tune = globalRegion.tune; } if (globalRegion.pitchKeyCenter != short.MaxValue) { this.pitchKeyCenter = globalRegion.pitchKeyCenter; } if (globalRegion.pitchKeyTrack != short.MaxValue) { this.pitchKeyTrack = globalRegion.pitchKeyTrack; } if (globalRegion.pitchVelTrack != short.MaxValue) { this.pitchVelTrack = globalRegion.pitchVelTrack; } if (globalRegion.pitchEGDelay != float.MaxValue) { this.pitchEGDelay = globalRegion.pitchEGDelay; } if (globalRegion.pitchEGStart != float.MaxValue) { this.pitchEGStart = globalRegion.pitchEGStart; } if (globalRegion.pitchEGAttack != float.MaxValue) { this.pitchEGAttack = globalRegion.pitchEGAttack; } if (globalRegion.pitchEGHold != float.MaxValue) { this.pitchEGHold = globalRegion.pitchEGHold; } if (globalRegion.pitchEGDecay != float.MaxValue) { this.pitchEGDecay = globalRegion.pitchEGDecay; } if (globalRegion.pitchEGSustain != float.MaxValue) { this.pitchEGSustain = globalRegion.pitchEGSustain; } if (globalRegion.pitchEGRelease != float.MaxValue) { this.pitchEGRelease = globalRegion.pitchEGRelease; } if (globalRegion.pitchEGDepth != short.MaxValue) { this.pitchEGDepth = globalRegion.pitchEGDepth; } if (globalRegion.pitchEGVel2Delay != float.MaxValue) { this.pitchEGVel2Delay = globalRegion.pitchEGVel2Delay; } if (globalRegion.pitchEGVel2Attack != float.MaxValue) { this.pitchEGVel2Attack = globalRegion.pitchEGVel2Attack; } if (globalRegion.pitchEGVel2Hold != float.MaxValue) { this.pitchEGVel2Hold = globalRegion.pitchEGVel2Hold; } if (globalRegion.pitchEGVel2Decay != float.MaxValue) { this.pitchEGVel2Decay = globalRegion.pitchEGVel2Decay; } if (globalRegion.pitchEGVel2Sustain != float.MaxValue) { this.pitchEGVel2Sustain = globalRegion.pitchEGVel2Sustain; } if (globalRegion.pitchEGVel2Release != float.MaxValue) { this.pitchEGVel2Release = globalRegion.pitchEGVel2Release; } if (globalRegion.pitchEGVel2Depth != short.MaxValue) { this.pitchEGVel2Depth = globalRegion.pitchEGVel2Depth; } if (globalRegion.pitchLfoDelay != float.MaxValue) { this.pitchLfoDelay = globalRegion.pitchLfoDelay; } if (globalRegion.pitchLfoFrequency != float.MaxValue) { this.pitchLfoFrequency = globalRegion.pitchLfoFrequency; } if (globalRegion.pitchLfoDepth != short.MaxValue) { this.pitchLfoDepth = globalRegion.pitchLfoDepth; } if (globalRegion.filterType != FilterTypeEnum.None) { this.filterType = globalRegion.filterType; } if (globalRegion.cutOff != float.MaxValue) { this.cutOff = globalRegion.cutOff; } if (globalRegion.resonance != float.MaxValue) { this.resonance = globalRegion.resonance; } if (globalRegion.filterKeyTrack != short.MaxValue) { this.filterKeyTrack = globalRegion.filterKeyTrack; } if (globalRegion.filterKeyCenter != 255) { this.filterKeyCenter = globalRegion.filterKeyCenter; } if (globalRegion.filterVelTrack != short.MaxValue) { this.filterVelTrack = globalRegion.filterVelTrack; } if (globalRegion.filterEGDelay != float.MaxValue) { this.filterEGDelay = globalRegion.filterEGDelay; } if (globalRegion.filterEGStart != float.MaxValue) { this.filterEGStart = globalRegion.filterEGStart; } if (globalRegion.filterEGAttack != float.MaxValue) { this.filterEGAttack = globalRegion.filterEGAttack; } if (globalRegion.filterEGHold != float.MaxValue) { this.filterEGHold = globalRegion.filterEGHold; } if (globalRegion.filterEGDecay != float.MaxValue) { this.filterEGDecay = globalRegion.filterEGDecay; } if (globalRegion.filterEGSustain != float.MaxValue) { this.filterEGSustain = globalRegion.filterEGSustain; } if (globalRegion.filterEGRelease != float.MaxValue) { this.filterEGRelease = globalRegion.filterEGRelease; } if (globalRegion.filterEGDepth != short.MaxValue) { this.filterEGDepth = globalRegion.filterEGDepth; } if (globalRegion.filterEGVel2Delay != float.MaxValue) { this.filterEGVel2Delay = globalRegion.filterEGVel2Delay; } if (globalRegion.filterEGVel2Attack != float.MaxValue) { this.filterEGVel2Attack = globalRegion.filterEGVel2Attack; } if (globalRegion.filterEGVel2Hold != float.MaxValue) { this.filterEGVel2Hold = globalRegion.filterEGVel2Hold; } if (globalRegion.filterEGVel2Decay != float.MaxValue) { this.filterEGVel2Decay = globalRegion.filterEGVel2Decay; } if (globalRegion.filterEGVel2Sustain != float.MaxValue) { this.filterEGVel2Sustain = globalRegion.filterEGVel2Sustain; } if (globalRegion.filterEGVel2Release != float.MaxValue) { this.filterEGVel2Release = globalRegion.filterEGVel2Release; } if (globalRegion.filterEGVel2Depth != short.MaxValue) { this.filterEGVel2Depth = globalRegion.filterEGVel2Depth; } if (globalRegion.filterLfoDelay != float.MaxValue) { this.filterLfoDelay = globalRegion.filterLfoDelay; } if (globalRegion.filterLfoFrequency != float.MaxValue) { this.filterLfoFrequency = globalRegion.filterLfoFrequency; } if (globalRegion.filterLfoDepth != float.MaxValue) { this.filterLfoDepth = globalRegion.filterLfoDepth; } if (globalRegion.volume != float.MaxValue) { this.volume = globalRegion.volume; } if (globalRegion.pan != float.MaxValue) { this.pan = globalRegion.pan; } if (globalRegion.ampKeyTrack != float.MaxValue) { this.ampKeyTrack = globalRegion.ampKeyTrack; } if (globalRegion.ampKeyCenter != 255) { this.ampKeyCenter = globalRegion.ampKeyCenter; } if (globalRegion.ampVelTrack != float.MaxValue) { this.ampVelTrack = globalRegion.ampVelTrack; } if (globalRegion.ampEGDelay != float.MaxValue) { this.ampEGDelay = globalRegion.ampEGDelay; } if (globalRegion.ampEGStart != float.MaxValue) { this.ampEGStart = globalRegion.ampEGStart; } if (globalRegion.ampEGAttack != float.MaxValue) { this.ampEGAttack = globalRegion.ampEGAttack; } if (globalRegion.ampEGHold != float.MaxValue) { this.ampEGHold = globalRegion.ampEGHold; } if (globalRegion.ampEGDecay != float.MaxValue) { this.ampEGDecay = globalRegion.ampEGDecay; } if (globalRegion.ampEGSustain != float.MaxValue) { this.ampEGSustain = globalRegion.ampEGSustain; } if (globalRegion.ampEGRelease != float.MaxValue) { this.ampEGRelease = globalRegion.ampEGRelease; } if (globalRegion.ampEGVel2Delay != float.MaxValue) { this.ampEGVel2Delay = globalRegion.ampEGVel2Delay; } if (globalRegion.ampEGVel2Attack != float.MaxValue) { this.ampEGVel2Attack = globalRegion.ampEGVel2Attack; } if (globalRegion.ampEGVel2Hold != float.MaxValue) { this.ampEGVel2Hold = globalRegion.ampEGVel2Hold; } if (globalRegion.ampEGVel2Decay != float.MaxValue) { this.ampEGVel2Decay = globalRegion.ampEGVel2Decay; } if (globalRegion.ampEGVel2Sustain != float.MaxValue) { this.ampEGVel2Sustain = globalRegion.ampEGVel2Sustain; } if (globalRegion.ampEGVel2Release != float.MaxValue) { this.ampEGVel2Release = globalRegion.ampEGVel2Release; } if (globalRegion.ampLfoDelay != float.MaxValue) { this.ampLfoDelay = globalRegion.ampLfoDelay; } if (globalRegion.ampLfoFrequency != float.MaxValue) { this.ampLfoFrequency = globalRegion.ampLfoFrequency; } if (globalRegion.ampLfoDepth != float.MaxValue) { this.ampLfoDepth = globalRegion.ampLfoDepth; } }
private void ToRegion(string regionText, SfzRegion region) { string[] param = new string[2]; int index = ReadNextParam(0, regionText, param); while (index != -1) { string command = param[0].ToLower(); string parameter = param[1].ToLower(); switch (command) { case "sample": if (IOHelper.GetExtension(parameter).Equals(string.Empty)) parameter += ".wav"; region.sample = parameter; break; case "lochan": region.loChan = (byte)(int.Parse(parameter) - 1); break; case "hichan": region.hiChan = (byte)(int.Parse(parameter) - 1); break; case "lokey": region.loKey = NoteNameToValue(parameter); break; case "hikey": region.hiKey = NoteNameToValue(parameter); break; case "key": region.loKey = NoteNameToValue(parameter); region.hiKey = region.loKey; region.pitchKeyCenter = region.loKey; break; case "lovel": region.loVel = byte.Parse(parameter); break; case "hivel": region.hiVel = byte.Parse(parameter); break; case "lobend": region.loBend = short.Parse(parameter); break; case "hibend": region.hiBend = short.Parse(parameter); break; case "lochanaft": region.loChanAft = byte.Parse(parameter); break; case "hichanaft": region.hiChanAft = byte.Parse(parameter); break; case "lopolyaft": region.loPolyAft = byte.Parse(parameter); break; case "hipolyaft": region.hiPolyAft = byte.Parse(parameter); break; case "group": region.group = int.Parse(parameter); break; case "off_by": region.offBy = int.Parse(parameter); break; case "off_mode": region.offMode = parameter.Equals("fast") ? SfzRegion.OffModeEnum.Fast : SfzRegion.OffModeEnum.Normal; break; case "delay": region.delay = float.Parse(parameter); break; case "offset": region.offset = int.Parse(parameter); break; case "end": region.end = int.Parse(parameter); break; case "count": region.count = int.Parse(parameter); region.loopMode = LoopModeEnum.OneShot; break; case "loop_mode": switch (parameter) { case "no_loop": region.loopMode = LoopModeEnum.NoLoop; break; case "one_shot": region.loopMode = LoopModeEnum.OneShot; break; case "loop_continuous": region.loopMode = LoopModeEnum.Continuous; break; case "loop_sustain": region.loopMode = LoopModeEnum.LoopUntilNoteOff; break; default: break; } break; case "loop_start": region.loopStart = int.Parse(parameter); break; case "loop_end": region.loopEnd = int.Parse(parameter); break; case "transpose": region.transpose = short.Parse(parameter); break; case "tune": region.tune = short.Parse(parameter); break; case "pitch_keycenter": region.pitchKeyCenter = NoteNameToValue(parameter); break; case "pitch_keytrack": region.pitchKeyTrack = short.Parse(parameter); break; case "pitch_veltrack": region.pitchVelTrack = short.Parse(parameter); break; case "pitcheg_delay": region.pitchEGDelay = float.Parse(parameter); break; case "pitcheg_start": region.pitchEGStart = float.Parse(parameter); break; case "pitcheg_attack": region.pitchEGAttack = float.Parse(parameter); break; case "pitcheg_hold": region.pitchEGHold = float.Parse(parameter); break; case "pitcheg_decay": region.pitchEGDecay = float.Parse(parameter); break; case "pitcheg_sustain": region.pitchEGSustain = float.Parse(parameter); break; case "pitcheg_release": region.pitchEGRelease = float.Parse(parameter); break; case "pitcheg_depth": region.pitchEGDepth = short.Parse(parameter); break; case "pitcheg_vel2delay": region.pitchEGVel2Delay = float.Parse(parameter); break; case "pitcheg_vel2attack": region.pitchEGVel2Attack = float.Parse(parameter); break; case "pitcheg_vel2hold": region.pitchEGVel2Hold = float.Parse(parameter); break; case "pitcheg_vel2decay": region.pitchEGVel2Decay = float.Parse(parameter); break; case "pitcheg_vel2sustain": region.pitchEGVel2Sustain = float.Parse(parameter); break; case "pitcheg_vel2release": region.pitchEGVel2Release = float.Parse(parameter); break; case "pitcheg_vel2depth": region.pitchEGVel2Depth = short.Parse(parameter); break; case "pitchlfo_delay": region.pitchLfoDelay = float.Parse(parameter); break; case "pitchlfo_freq": region.pitchLfoFrequency = float.Parse(parameter); break; case "pitchlfo_depth": region.pitchLfoDepth = short.Parse(parameter); break; case "fil_type": switch (parameter) { case "lpf_1p": region.filterType = FilterTypeEnum.OnePoleLowpass; break; case "hpf_1p": region.filterType = FilterTypeEnum.None;//unsupported break; case "lpf_2p": region.filterType = FilterTypeEnum.BiquadLowpass; break; case "hpf_2p": region.filterType = FilterTypeEnum.BiquadHighpass; break; case "bpf_2p": region.filterType = FilterTypeEnum.None;//unsupported break; case "brf_2p": region.filterType = FilterTypeEnum.None;//unsupported break; default: break; } break; case "cutoff": region.cutOff = float.Parse(parameter); break; case "resonance": region.resonance = float.Parse(parameter); break; case "fil_keytrack": region.filterKeyTrack = short.Parse(parameter); break; case "fil_keycenter": region.filterKeyCenter = byte.Parse(parameter); break; case "fil_veltrack": region.filterVelTrack = short.Parse(parameter); break; case "fileg_delay": region.filterEGDelay = float.Parse(parameter); break; case "fileg_start": region.filterEGStart = float.Parse(parameter); break; case "fileg_attack": region.filterEGAttack = float.Parse(parameter); break; case "fileg_hold": region.filterEGHold = float.Parse(parameter); break; case "fileg_decay": region.filterEGDecay = float.Parse(parameter); break; case "fileg_sustain": region.filterEGSustain = float.Parse(parameter); break; case "fileg_release": region.filterEGRelease = float.Parse(parameter); break; case "fileg_depth": region.filterEGDepth = short.Parse(parameter); break; case "fileg_vel2delay": region.filterEGVel2Delay = float.Parse(parameter); break; case "fileg_vel2attack": region.filterEGVel2Attack = float.Parse(parameter); break; case "fileg_vel2hold": region.filterEGVel2Hold = float.Parse(parameter); break; case "fileg_vel2decay": region.filterEGVel2Decay = float.Parse(parameter); break; case "fileg_vel2sustain": region.filterEGVel2Sustain = float.Parse(parameter); break; case "fileg_vel2release": region.filterEGVel2Release = float.Parse(parameter); break; case "fileg_vel2depth": region.filterEGVel2Depth = short.Parse(parameter); break; case "fillfo_delay": region.filterLfoDelay = float.Parse(parameter); break; case "fillfo_freq": region.filterLfoFrequency = float.Parse(parameter); break; case "fillfo_depth": region.filterLfoDepth = float.Parse(parameter); break; case "volume": region.volume = float.Parse(parameter); break; case "pan": region.pan = float.Parse(parameter); break; case "amp_keytrack": region.ampKeyTrack = float.Parse(parameter); break; case "amp_keycenter": region.ampKeyCenter = byte.Parse(parameter); break; case "amp_veltrack": region.ampVelTrack = float.Parse(parameter); break; case "ampeg_delay": region.ampEGDelay = float.Parse(parameter); break; case "ampeg_start": region.ampEGStart = float.Parse(parameter); break; case "ampeg_attack": region.ampEGAttack = float.Parse(parameter); break; case "ampeg_hold": region.ampEGHold = float.Parse(parameter); break; case "ampeg_decay": region.ampEGDecay = float.Parse(parameter); break; case "ampeg_sustain": region.ampEGSustain = float.Parse(parameter); break; case "ampeg_release": region.ampEGRelease = float.Parse(parameter); break; case "ampeg_vel2delay": region.ampEGVel2Delay = float.Parse(parameter); break; case "ampeg_vel2attack": region.ampEGVel2Attack = float.Parse(parameter); break; case "ampeg_vel2hold": region.ampEGVel2Hold = float.Parse(parameter); break; case "ampeg_vel2decay": region.ampEGVel2Decay = float.Parse(parameter); break; case "ampeg_vel2sustain": region.ampEGVel2Sustain = float.Parse(parameter); break; case "ampeg_vel2release": region.ampEGVel2Release = float.Parse(parameter); break; case "amplfo_delay": region.ampLfoDelay = float.Parse(parameter); break; case "amplfo_freq": region.ampLfoFrequency = float.Parse(parameter); break; case "amplfo_depth": region.ampLfoDepth = float.Parse(parameter); break; default: break; } index = ReadNextParam(index, regionText, param); } }
private void ToRegion(string regionText, SfzRegion region) { string[] lines = regionText.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); for (int x = 0; x < lines.Length; x++) { string[] commands = RemoveComment(lines[x]).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < commands.Length; i++) { int index = commands[i].IndexOf('='); if (index >= 0 && index < commands[i].Length) { string command = commands[i].Substring(0, index).ToLower(); string parameter = commands[i].Substring(index + 1).ToLower(); switch (command) { case "sample": region.sample = parameter; break; case "lochan": region.loChan = (byte)(int.Parse(parameter) - 1); break; case "hichan": region.hiChan = (byte)(int.Parse(parameter) - 1); break; case "lokey": region.loKey = NoteNameToValue(parameter); break; case "hikey": region.hiKey = NoteNameToValue(parameter); break; case "key": region.loKey = NoteNameToValue(parameter); region.hiKey = region.loKey; region.pitchKeyCenter = region.loKey; break; case "lovel": region.loVel = byte.Parse(parameter); break; case "hivel": region.hiVel = byte.Parse(parameter); break; case "lobend": region.loBend = short.Parse(parameter); break; case "hibend": region.hiBend = short.Parse(parameter); break; case "lochanaft": region.loChanAft = byte.Parse(parameter); break; case "hichanaft": region.hiChanAft = byte.Parse(parameter); break; case "lopolyaft": region.loPolyAft = byte.Parse(parameter); break; case "hipolyaft": region.hiPolyAft = byte.Parse(parameter); break; case "group": region.group = int.Parse(parameter); break; case "off_by": region.offBy = int.Parse(parameter); break; case "off_mode": region.offMode = parameter.Equals("fast") ? SfzRegion.OffModeEnum.Fast : SfzRegion.OffModeEnum.Normal; break; case "delay": region.delay = float.Parse(parameter); break; case "offset": region.offset = int.Parse(parameter); break; case "end": region.end = int.Parse(parameter); break; case "count": region.count = int.Parse(parameter); region.loopMode = LoopModeEnum.OneShot; break; case "loop_mode": switch (parameter) { case "no_loop": region.loopMode = LoopModeEnum.NoLoop; break; case "one_shot": region.loopMode = LoopModeEnum.OneShot; break; case "loop_continuous": region.loopMode = LoopModeEnum.Continuous; break; case "loop_sustain": region.loopMode = LoopModeEnum.LoopUntilNoteOff; break; default: break; } break; case "loop_start": region.loopStart = int.Parse(parameter); break; case "loop_end": region.loopEnd = int.Parse(parameter); break; case "transpose": region.transpose = short.Parse(parameter); break; case "tune": region.tune = short.Parse(parameter); break; case "pitch_keycenter": region.pitchKeyCenter = NoteNameToValue(parameter); break; case "pitch_keytrack": region.pitchKeyTrack = short.Parse(parameter); break; case "pitch_veltrack": region.pitchVelTrack = short.Parse(parameter); break; case "pitcheg_delay": region.pitchEGDelay = float.Parse(parameter); break; case "pitcheg_start": region.pitchEGStart = float.Parse(parameter); break; case "pitcheg_attack": region.pitchEGAttack = float.Parse(parameter); break; case "pitcheg_hold": region.pitchEGHold = float.Parse(parameter); break; case "pitcheg_decay": region.pitchEGDecay = float.Parse(parameter); break; case "pitcheg_sustain": region.pitchEGSustain = float.Parse(parameter); break; case "pitcheg_release": region.pitchEGRelease = float.Parse(parameter); break; case "pitcheg_depth": region.pitchEGDepth = short.Parse(parameter); break; case "pitcheg_vel2delay": region.pitchEGVel2Delay = float.Parse(parameter); break; case "pitcheg_vel2attack": region.pitchEGVel2Attack = float.Parse(parameter); break; case "pitcheg_vel2hold": region.pitchEGVel2Hold = float.Parse(parameter); break; case "pitcheg_vel2decay": region.pitchEGVel2Decay = float.Parse(parameter); break; case "pitcheg_vel2sustain": region.pitchEGVel2Sustain = float.Parse(parameter); break; case "pitcheg_vel2release": region.pitchEGVel2Release = float.Parse(parameter); break; case "pitcheg_vel2depth": region.pitchEGVel2Depth = short.Parse(parameter); break; case "pitchlfo_delay": region.pitchLfoDelay = float.Parse(parameter); break; case "pitchlfo_freq": region.pitchLfoFrequency = float.Parse(parameter); break; case "pitchlfo_depth": region.pitchLfoDepth = short.Parse(parameter); break; case "fil_type": switch (parameter) { case "lpf_1p": region.filterType = FilterTypeEnum.OnePoleLowpass; break; case "hpf_1p": region.filterType = FilterTypeEnum.None; //unsupported break; case "lpf_2p": region.filterType = FilterTypeEnum.BiquadLowpass; break; case "hpf_2p": region.filterType = FilterTypeEnum.BiquadHighpass; break; case "bpf_2p": region.filterType = FilterTypeEnum.None; //unsupported break; case "brf_2p": region.filterType = FilterTypeEnum.None; //unsupported break; default: break; } break; case "cutoff": region.cutOff = float.Parse(parameter); break; case "resonance": region.resonance = float.Parse(parameter); break; case "fil_keytrack": region.filterKeyTrack = short.Parse(parameter); break; case "fil_keycenter": region.filterKeyCenter = byte.Parse(parameter); break; case "fil_veltrack": region.filterVelTrack = short.Parse(parameter); break; case "fileg_delay": region.filterEGDelay = float.Parse(parameter); break; case "fileg_start": region.filterEGStart = float.Parse(parameter); break; case "fileg_attack": region.filterEGAttack = float.Parse(parameter); break; case "fileg_hold": region.filterEGHold = float.Parse(parameter); break; case "fileg_decay": region.filterEGDecay = float.Parse(parameter); break; case "fileg_sustain": region.filterEGSustain = float.Parse(parameter); break; case "fileg_release": region.filterEGRelease = float.Parse(parameter); break; case "fileg_depth": region.filterEGDepth = short.Parse(parameter); break; case "fileg_vel2delay": region.filterEGVel2Delay = float.Parse(parameter); break; case "fileg_vel2attack": region.filterEGVel2Attack = float.Parse(parameter); break; case "fileg_vel2hold": region.filterEGVel2Hold = float.Parse(parameter); break; case "fileg_vel2decay": region.filterEGVel2Decay = float.Parse(parameter); break; case "fileg_vel2sustain": region.filterEGVel2Sustain = float.Parse(parameter); break; case "fileg_vel2release": region.filterEGVel2Release = float.Parse(parameter); break; case "fileg_vel2depth": region.filterEGVel2Depth = short.Parse(parameter); break; case "fillfo_delay": region.filterLfoDelay = float.Parse(parameter); break; case "fillfo_freq": region.filterLfoFrequency = float.Parse(parameter); break; case "fillfo_depth": region.filterLfoDepth = float.Parse(parameter); break; case "volume": region.volume = float.Parse(parameter); break; case "pan": region.pan = float.Parse(parameter); break; case "amp_keytrack": region.ampKeyTrack = float.Parse(parameter); break; case "amp_keycenter": region.ampKeyCenter = byte.Parse(parameter); break; case "amp_veltrack": region.ampVelTrack = float.Parse(parameter); break; case "ampeg_delay": region.ampEGDelay = float.Parse(parameter); break; case "ampeg_start": region.ampEGStart = float.Parse(parameter); break; case "ampeg_attack": region.ampEGAttack = float.Parse(parameter); break; case "ampeg_hold": region.ampEGHold = float.Parse(parameter); break; case "ampeg_decay": region.ampEGDecay = float.Parse(parameter); break; case "ampeg_sustain": region.ampEGSustain = float.Parse(parameter); break; case "ampeg_release": region.ampEGRelease = float.Parse(parameter); break; case "ampeg_vel2delay": region.ampEGVel2Delay = float.Parse(parameter); break; case "ampeg_vel2attack": region.ampEGVel2Attack = float.Parse(parameter); break; case "ampeg_vel2hold": region.ampEGVel2Hold = float.Parse(parameter); break; case "ampeg_vel2decay": region.ampEGVel2Decay = float.Parse(parameter); break; case "ampeg_vel2sustain": region.ampEGVel2Sustain = float.Parse(parameter); break; case "ampeg_vel2release": region.ampEGVel2Release = float.Parse(parameter); break; case "amplfo_delay": region.ampLfoDelay = float.Parse(parameter); break; case "amplfo_freq": region.ampLfoFrequency = float.Parse(parameter); break; case "amplfo_depth": region.ampLfoDepth = float.Parse(parameter); break; default: break; } } } } }
public void ApplyGlobal(SfzRegion globalRegion) { if (globalRegion.sample != null) this.sample = globalRegion.sample; if (globalRegion.loChan != 255) this.loChan = globalRegion.loChan; if (globalRegion.hiChan != 255) this.hiChan = globalRegion.hiChan; if (globalRegion.loKey != 255) this.loKey = globalRegion.loKey; if (globalRegion.hiKey != 255) this.hiKey = globalRegion.hiKey; if (globalRegion.loVel != 255) this.loVel = globalRegion.loVel; if (globalRegion.hiVel != 255) this.hiVel = globalRegion.hiVel; if (globalRegion.loBend != short.MaxValue) this.loBend = globalRegion.loBend; if (globalRegion.hiBend != short.MaxValue) this.hiBend = globalRegion.hiBend; if (globalRegion.loChanAft != 255) this.loChanAft = globalRegion.loChanAft; if (globalRegion.hiChanAft != 255) this.hiChanAft = globalRegion.hiChanAft; if (globalRegion.loPolyAft != 255) this.loPolyAft = globalRegion.loPolyAft; if (globalRegion.hiPolyAft != 255) this.hiPolyAft = globalRegion.hiPolyAft; if (globalRegion.group != int.MaxValue) this.group = globalRegion.group; if (globalRegion.offBy != int.MaxValue) this.offBy = globalRegion.offBy; if ((int)globalRegion.offMode != int.MaxValue) this.offMode = globalRegion.offMode; if (globalRegion.delay != float.MaxValue) this.delay = globalRegion.delay; if (globalRegion.offset != int.MaxValue) this.offset = globalRegion.offset; if (globalRegion.end != int.MaxValue) this.end = globalRegion.end; if (globalRegion.count != int.MaxValue) this.count = globalRegion.count; if ((int)globalRegion.loopMode != int.MaxValue) this.loopMode = globalRegion.loopMode; if (globalRegion.loopStart != int.MaxValue) this.loopStart = globalRegion.loopStart; if (globalRegion.loopEnd != int.MaxValue) this.loopEnd = globalRegion.loopEnd; if (globalRegion.transpose != short.MaxValue) this.transpose = globalRegion.transpose; if (globalRegion.tune != short.MaxValue) this.tune = globalRegion.tune; if (globalRegion.pitchKeyCenter != short.MaxValue) this.pitchKeyCenter = globalRegion.pitchKeyCenter; if (globalRegion.pitchKeyTrack != short.MaxValue) this.pitchKeyTrack = globalRegion.pitchKeyTrack; if (globalRegion.pitchVelTrack != short.MaxValue) this.pitchVelTrack = globalRegion.pitchVelTrack; if (globalRegion.pitchEGDelay != float.MaxValue) this.pitchEGDelay = globalRegion.pitchEGDelay; if(globalRegion.pitchEGStart != float.MaxValue) this.pitchEGStart = globalRegion.pitchEGStart; if(globalRegion.pitchEGAttack != float.MaxValue) this.pitchEGAttack = globalRegion.pitchEGAttack; if(globalRegion.pitchEGHold != float.MaxValue) this.pitchEGHold = globalRegion.pitchEGHold; if(globalRegion.pitchEGDecay != float.MaxValue) this.pitchEGDecay = globalRegion.pitchEGDecay; if(globalRegion.pitchEGSustain != float.MaxValue) this.pitchEGSustain = globalRegion.pitchEGSustain; if(globalRegion.pitchEGRelease != float.MaxValue) this.pitchEGRelease = globalRegion.pitchEGRelease; if(globalRegion.pitchEGDepth != short.MaxValue) this.pitchEGDepth = globalRegion.pitchEGDepth; if(globalRegion.pitchEGVel2Delay != float.MaxValue) this.pitchEGVel2Delay = globalRegion.pitchEGVel2Delay; if(globalRegion.pitchEGVel2Attack != float.MaxValue) this.pitchEGVel2Attack = globalRegion.pitchEGVel2Attack; if(globalRegion.pitchEGVel2Hold != float.MaxValue) this.pitchEGVel2Hold = globalRegion.pitchEGVel2Hold; if(globalRegion.pitchEGVel2Decay != float.MaxValue) this.pitchEGVel2Decay = globalRegion.pitchEGVel2Decay; if(globalRegion.pitchEGVel2Sustain != float.MaxValue) this.pitchEGVel2Sustain = globalRegion.pitchEGVel2Sustain; if(globalRegion.pitchEGVel2Release != float.MaxValue) this.pitchEGVel2Release = globalRegion.pitchEGVel2Release; if(globalRegion.pitchEGVel2Depth != short.MaxValue) this.pitchEGVel2Depth = globalRegion.pitchEGVel2Depth; if(globalRegion.pitchLfoDelay != float.MaxValue) this.pitchLfoDelay = globalRegion.pitchLfoDelay; if(globalRegion.pitchLfoFrequency != float.MaxValue) this.pitchLfoFrequency = globalRegion.pitchLfoFrequency; if(globalRegion.pitchLfoDepth != short.MaxValue) this.pitchLfoDepth = globalRegion.pitchLfoDepth; if(globalRegion.filterType != FilterTypeEnum.None) this.filterType = globalRegion.filterType; if(globalRegion.cutOff != float.MaxValue) this.cutOff = globalRegion.cutOff; if(globalRegion.resonance != float.MaxValue) this.resonance = globalRegion.resonance; if (globalRegion.filterKeyTrack != short.MaxValue) this.filterKeyTrack = globalRegion.filterKeyTrack; if (globalRegion.filterKeyCenter != 255) this.filterKeyCenter = globalRegion.filterKeyCenter; if (globalRegion.filterVelTrack != short.MaxValue) this.filterVelTrack = globalRegion.filterVelTrack; if (globalRegion.filterEGDelay != float.MaxValue) this.filterEGDelay = globalRegion.filterEGDelay; if (globalRegion.filterEGStart != float.MaxValue) this.filterEGStart = globalRegion.filterEGStart; if (globalRegion.filterEGAttack != float.MaxValue) this.filterEGAttack = globalRegion.filterEGAttack; if (globalRegion.filterEGHold != float.MaxValue) this.filterEGHold = globalRegion.filterEGHold; if (globalRegion.filterEGDecay != float.MaxValue) this.filterEGDecay = globalRegion.filterEGDecay; if (globalRegion.filterEGSustain != float.MaxValue) this.filterEGSustain = globalRegion.filterEGSustain; if (globalRegion.filterEGRelease != float.MaxValue) this.filterEGRelease = globalRegion.filterEGRelease; if (globalRegion.filterEGDepth != short.MaxValue) this.filterEGDepth = globalRegion.filterEGDepth; if (globalRegion.filterEGVel2Delay != float.MaxValue) this.filterEGVel2Delay = globalRegion.filterEGVel2Delay; if (globalRegion.filterEGVel2Attack != float.MaxValue) this.filterEGVel2Attack = globalRegion.filterEGVel2Attack; if (globalRegion.filterEGVel2Hold != float.MaxValue) this.filterEGVel2Hold = globalRegion.filterEGVel2Hold; if (globalRegion.filterEGVel2Decay != float.MaxValue) this.filterEGVel2Decay = globalRegion.filterEGVel2Decay; if (globalRegion.filterEGVel2Sustain != float.MaxValue) this.filterEGVel2Sustain = globalRegion.filterEGVel2Sustain; if (globalRegion.filterEGVel2Release != float.MaxValue) this.filterEGVel2Release = globalRegion.filterEGVel2Release; if (globalRegion.filterEGVel2Depth != short.MaxValue) this.filterEGVel2Depth = globalRegion.filterEGVel2Depth; if (globalRegion.filterLfoDelay != float.MaxValue) this.filterLfoDelay = globalRegion.filterLfoDelay; if (globalRegion.filterLfoFrequency != float.MaxValue) this.filterLfoFrequency = globalRegion.filterLfoFrequency; if (globalRegion.filterLfoDepth != float.MaxValue) this.filterLfoDepth = globalRegion.filterLfoDepth; if (globalRegion.volume != float.MaxValue) this.volume = globalRegion.volume; if (globalRegion.pan != float.MaxValue) this.pan = globalRegion.pan; if (globalRegion.ampKeyTrack != float.MaxValue) this.ampKeyTrack = globalRegion.ampKeyTrack; if (globalRegion.ampKeyCenter != 255) this.ampKeyCenter = globalRegion.ampKeyCenter; if (globalRegion.ampVelTrack != float.MaxValue) this.ampVelTrack = globalRegion.ampVelTrack; if(globalRegion.ampEGDelay != float.MaxValue) this.ampEGDelay = globalRegion.ampEGDelay; if(globalRegion.ampEGStart != float.MaxValue) this.ampEGStart = globalRegion.ampEGStart; if(globalRegion.ampEGAttack != float.MaxValue) this.ampEGAttack = globalRegion.ampEGAttack; if(globalRegion.ampEGHold != float.MaxValue) this.ampEGHold = globalRegion.ampEGHold; if(globalRegion.ampEGDecay != float.MaxValue) this.ampEGDecay = globalRegion.ampEGDecay; if(globalRegion.ampEGSustain != float.MaxValue) this.ampEGSustain = globalRegion.ampEGSustain; if(globalRegion.ampEGRelease != float.MaxValue) this.ampEGRelease = globalRegion.ampEGRelease; if(globalRegion.ampEGVel2Delay != float.MaxValue) this.ampEGVel2Delay = globalRegion.ampEGVel2Delay; if(globalRegion.ampEGVel2Attack != float.MaxValue) this.ampEGVel2Attack = globalRegion.ampEGVel2Attack; if(globalRegion.ampEGVel2Hold != float.MaxValue) this.ampEGVel2Hold = globalRegion.ampEGVel2Hold; if(globalRegion.ampEGVel2Decay != float.MaxValue) this.ampEGVel2Decay = globalRegion.ampEGVel2Decay; if(globalRegion.ampEGVel2Sustain != float.MaxValue) this.ampEGVel2Sustain = globalRegion.ampEGVel2Sustain; if(globalRegion.ampEGVel2Release != float.MaxValue) this.ampEGVel2Release = globalRegion.ampEGVel2Release; if(globalRegion.ampLfoDelay != float.MaxValue) this.ampLfoDelay = globalRegion.ampLfoDelay; if(globalRegion.ampLfoFrequency != float.MaxValue) this.ampLfoFrequency = globalRegion.ampLfoFrequency; if(globalRegion.ampLfoDepth != float.MaxValue) this.ampLfoDepth = globalRegion.ampLfoDepth; }