public static void PlayPitch(McPitch pitch) { if (pitch.Volume >= 0.001f) { McNotePack parentNotePack = pitch.ParentNotePack; MusicCanvasControl canvas = parentNotePack.Canvas; McMeasure parentMeasure = parentNotePack.ParentMeasure; float num = ((parentMeasure.TemporaryInfo.RelativeX + McNotation.Margin.Left) + McRegularTrack.Margin.Left) - canvas.ScrollXSmooth; float num2 = ((((McRegularTrack.Margin.Bottom + McRegularTrack.Margin.Top) + McMeasure.Height) * parentMeasure.ParentRegularTrack.Index) + McNotation.Margin.Top) + McRegularTrack.Margin.Top; float x = (num + parentNotePack.TemporaryInfo.RelativeXSmooth) + 8f; if (parentNotePack.Staccato) { canvas.PlaySound(parentMeasure.InstrumentType, pitch.AlterantValue, pitch.Volume, (long)parentNotePack.TemporaryInfo.PlayingDurationTimeMs, 0.03f); } else { canvas.PlaySound(parentMeasure.InstrumentType, pitch.AlterantValue, pitch.Volume, (long)parentNotePack.TemporaryInfo.PlayingDurationTimeMs, 0.03f); } int num4 = parentNotePack.IsRest ? (((parentMeasure.ClefType == McMeasure.ClefTypes.L2G) ? 0x2c : 0x17) + 5) : pitch.Value; float measureLineRelativeY = pitch.MeasureLineRelativeY; float num6 = 3.141593f * (((float)num4) / 88f); Color color = parentNotePack.IsRest ? Color.FromArgb(0x80, Color.White) : Color.FromArgb(0xff, (int)(((Math.Cos((double)num6) + 1.0) / 2.0) * 255.0), (int)(((Math.Sin((double)num6) + 1.0) / 2.0) * 255.0), (int)(((Math.Cos((double)num6) + 1.0) / 2.0) * 255.0)); MusicCanvasControl.RippleAniManager.Append(x, num2 + measureLineRelativeY, color, 10 + ((int)(30f * parentNotePack.Volume)), 0.5f, parentNotePack); } }
public bool IsPitchEnabled(int pitchValue) { if ((pitchValue < McPitch.PitchMin) || (pitchValue > McPitch.PitchMax)) { return(false); } McPitch pitch = this._pitches[pitchValue]; return((pitch != null) && (pitch.PitchType != McPitch.PitchTypes.Disabled)); }
public McPitch.PitchTypes GetPitchType(int pitchValue) { if ((pitchValue < McPitch.PitchMin) || (pitchValue > McPitch.PitchMax)) { return(McPitch.PitchTypes.Disabled); } McPitch pitch = this._pitches[pitchValue]; return((pitch == null) ? McPitch.PitchTypes.Disabled : pitch.PitchType); }
public void ClearTemporaryPitch() { for (int i = McPitch.PitchMin; i <= McPitch.PitchMax; i++) { McPitch pitch = this._pitches[i]; if ((pitch != null) && (pitch.PitchType == McPitch.PitchTypes.Temporary)) { this.MarkPitch(i, McPitch.PitchTypes.Disabled); } } }
public bool MarkPitch(int pitchValue, McPitch.PitchTypes pitchType) { if ((pitchValue < McPitch.PitchMin) || (pitchValue > McPitch.PitchMax)) { return(false); } if (!((pitchType != McPitch.PitchTypes.Enabled) || this.CanAppendNewPitch)) { return(false); } McPitch pitch = this._pitches[pitchValue]; McPitch.PitchTypes disabled = McPitch.PitchTypes.Disabled; if (pitch != null) { disabled = pitch.PitchType; } if ((disabled != pitchType) && this.IsViald) { this._pitches[pitchValue] = (pitchType != McPitch.PitchTypes.Disabled) ? McPitch.FromNaturalPitchValue(this, pitchValue, pitchType) : null; int num = (this.ParentMeasure.ClefType == McMeasure.ClefTypes.L2G) ? 0x2c : 0x17; int?nullable = null; int?nullable2 = null; for (int i = McPitch.PitchMin; i <= McPitch.PitchMax; i++) { if (this._pitches[i] != null) { if (!nullable.HasValue) { nullable = new int?(i); } nullable2 = new int?(i); } } int?nullable3 = nullable2; this.HighestPitchValue = nullable3.HasValue ? nullable3.GetValueOrDefault() : num; nullable3 = nullable; this.LowestPitchValue = nullable3.HasValue ? nullable3.GetValueOrDefault() : num; if (this.IsViald) { if (((disabled == McPitch.PitchTypes.Temporary) && (pitchType == McPitch.PitchTypes.Disabled)) || ((disabled == McPitch.PitchTypes.Disabled) && (pitchType == McPitch.PitchTypes.Temporary))) { McUtility.AppendRedrawingMeasure(this.ParentMeasure); } else { McUtility.MarkModified(this.ParentMeasure); } } } return(true); }
public static void EffectArpeggios(int elapsedTimeMs) { foreach (Arpeggio arpeggio in ActivatedArpeggios.ToArray()) { arpeggio.ElapsedTimeMs += elapsedTimeMs; if (arpeggio.ElapsedTimeMs >= (arpeggio.PlayedPitchCount * arpeggio.Interval)) { int num = arpeggio.PlayedPitchCount + 1; McPitch[] validPitchArray = arpeggio.NotePack.ValidPitchArray; McPitch pitch = null; switch (arpeggio.NotePack.ArpeggioMode) { case ArpeggioTypes.Upward: if ((num > 1) && (num <= validPitchArray.Length)) { pitch = validPitchArray[num - 1]; } break; case ArpeggioTypes.Downward: if ((num > 1) && (num <= validPitchArray.Length)) { pitch = validPitchArray[validPitchArray.Length - num]; } break; } if (pitch != null) { PlayPitch(pitch); arpeggio.PlayedPitchCount = num; } if (num > validPitchArray.Length) { ActivatedArpeggios.Remove(arpeggio); } } } }
public McNotePack Clone(McMeasure measure) { McNotePack pack = new McNotePack(measure ?? this.ParentMeasure) { _isRest = this._isRest, _isDotted = this._isDotted, _tieType = this._tieType, _triplet = this._triplet, _durationType = this._durationType, _staccato = this._staccato, _arpeggioMode = this._arpeggioMode }; foreach (int num in this.ValidPitchValueArray) { McPitch pitch = this._pitches[num]; if (((pitch != null) && (pitch.PitchType == McPitch.PitchTypes.Enabled)) && pack.MarkPitch(pitch.Value, McPitch.PitchTypes.Enabled)) { pack.GetPitch(pitch.Value).AlterantType = pitch.RawAlterantType; } } return(pack); }