public BpmInterpreter(string[] string0) { for (var i = 0; i < string0.Length; i++) { var text = string0[i]; var array = text.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); var num = ChartParser.GetNoteFromResolution(array[0]); var num2 = Convert.ToInt32(array[2]); string a; if ((a = array[1]) != null) { if (!(a == "TS")) { if (a == "B" && (BpmList.Count == 0 || BpmList[num] != num2)) { BpmList.Add(num, num2); } } else if (TsList.Count == 0 || TsList[num] != num2) { TsList.Add(num, num2); } } } if (!TsList.ContainsKey(0)) { TsList.Add(0, 4); } }
public void TryAddIncreasesCount() { ITrack minutes = new Track(5); minutes.Add(1); Assert.AreEqual(1, minutes.Count); }
private void PasteEvent(object frameBoxed) { int frame = (int)frameBoxed; FEvent evt = Instantiate <FEvent>((FEvent)FSequenceEditor.CopyObject); evt.hideFlags = Track.hideFlags; Undo.RegisterCreatedObjectUndo(evt.gameObject, "Paste " + FSequenceEditor.CopyObject.name); Undo.RecordObject(Track, string.Empty); int evtLength = evt.Length; int maxEvtLength; if (Track.CanAddAt(frame, out maxEvtLength) && maxEvtLength >= evtLength) { int delta = frame - evt.Start; evt.Start += delta; evt.End += delta; } else { evt.End = frame + maxEvtLength; evt.Start = evt.End - evtLength; } Undo.SetTransformParent(evt.transform, Track.transform, string.Empty); Track.Add(evt); }
public FEvent TryAddEvent(int t) { FEvent newEvt = null; if (Track.CanAddAt(t)) { FEvent evtAfterT = Track.GetEventAfter(t); int newEventEndT; if (evtAfterT == null) { newEventEndT = SequenceEditor.Sequence.Length; } else { newEventEndT = evtAfterT.Start; } newEvt = FEvent.Create(Track.GetEventType(), new FrameRange(t, newEventEndT)); Undo.RecordObject(Track, string.Empty); Undo.RegisterCreatedObjectUndo(newEvt.gameObject, "create Event"); Track.Add(newEvt); } return(newEvt); }
public void Append(Checkpoint cp) { Checkpoints.Add(cp); if (finishForced) { return; } var position = positions.GetOrAdd(cp.RiderId, x => RoundPosition.FromStartTime(x, RoundStartTime)); if (position.Finished) { return; } position.Append(cp); if (Track.Count < position.LapCount) { Track.Add(new List <Checkpoint>()); } Track[position.LapCount - 1].Add(cp); if (FinishCriteria?.HasFinished(position, GetSequence(), false) == true) { position.Finish(); } rating = null; }
private void mapControl_Click(object sender, EventArgs e) { if (cboxEnableLineDraw.Checked) { if (bingLine.Count == 0) { mapControl.Markers.Clear(); } var coord = mapControl.Mouse; bingLine.Add(coord); mapControl.Invalidate(); lblPoints.Text = bingLine.Count.ToString(); { // Create marker's location point var point = coord; var style = new MarkerStyle(8); // Create marker instance: specify location on the map, drawing style, and label var marker = new Marker(point, style, bingLine.Count.ToString()); // Add marker to the map mapControl.Markers.Add(marker); mapControl.Invalidate(); } } }
// public override void OnTogglePreview () // { //// int currentFrame = Track.Sequence.GetCurrentFrame(); // // base.OnTogglePreview(); // //// if( currentFrame >= 0 ) //// SequenceEditor.SetCurrentFrame( currentFrame ); // } public override void Render(Rect rect, float headerWidth) { // bool isPreviewing = _track.IsPreviewing; base.Render(rect, headerWidth); // if( isPreviewing != _track.IsPreviewing ) // { // if( Event.current.alt ) // SyncWithAnimationWindow = true; // } switch (Event.current.type) { case EventType.DragUpdated: if (rect.Contains(Event.current.mousePosition)) { int numAnimationsDragged = FAnimationEventInspector.NumAnimationsDragAndDrop(Track.Sequence.FrameRate); int frame = SequenceEditor.GetFrameForX(Event.current.mousePosition.x); DragAndDrop.visualMode = numAnimationsDragged > 0 && Track.CanAddAt(frame) ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected; Event.current.Use(); } break; case EventType.DragPerform: if (rect.Contains(Event.current.mousePosition)) { AnimationClip animClip = FAnimationEventInspector.GetAnimationClipDragAndDrop(Track.Sequence.FrameRate); if (animClip && Mathf.Approximately(animClip.frameRate, Track.Sequence.FrameRate)) { int frame = SequenceEditor.GetFrameForX(Event.current.mousePosition.x); int maxLength; if (Track.CanAddAt(frame, out maxLength)) { FPlayAnimationEvent animEvt = FEvent.Create <FPlayAnimationEvent>(new FrameRange(frame, frame + Mathf.Min(maxLength, Mathf.RoundToInt(animClip.length * animClip.frameRate)))); Track.Add(animEvt); FAnimationEventInspector.SetAnimationClip(animEvt, animClip); DragAndDrop.AcceptDrag(); } } Event.current.Use(); } break; } // if( _wasPreviewing != _track.IsPreviewing ) // { // if( _wasPreviewing ) // SequenceEditor.OnUpdateEvent.RemoveListener( OnUpdate ); // else // SequenceEditor.OnUpdateEvent.AddListener( OnUpdate ); // // _wasPreviewing = _track.IsPreviewing; // } }
/// <summary> /// Reads a track from the provided stream. /// </summary> /// <param name="stream">The stream to read the track from</param> /// <returns>The track as an object</returns> /// <exception cref="InvalidDataException">Thrown when the track file is formatted incorrectly or corrupted.</exception> public Track ReadTrack(Stream stream) { this.stream = stream; var track = new Track(); using (reader = new BinaryReader(this.stream)) { var realFilesize = (int)stream.Length; if (realFilesize < 20) { throw new InvalidDataException("Incorrect filesize, corrupted track!"); } var legoHeader = ReadString(12); var trkVersion = reader.ReadUInt32(); var claimedFilesize = reader.ReadUInt32(); if (claimedFilesize != 65576) { throw new InvalidDataException("TRK file reports incorrect filesize!"); } if (claimedFilesize != realFilesize) { throw new InvalidDataException("Incorrect filesize, corrupted track!"); } track.size = (Track.TrackSize)reader.ReadUInt32(); track.theme = (Track.TrackTheme)reader.ReadUInt32(); track.time = (Track.TrackTime)reader.ReadUInt32(); var iters = 8 * ((int)track.size + 1); var skip = (56 - (int)track.size * 8) * 16; for (var z = 0; z < iters; z++) { for (var x = 0; x < iters; x++) { var element = new TrackElement(); element.mystery = reader.ReadBytes(4); element.pos = new GridPosition(x, ReadHeight(), z); element.SetId(reader.ReadUInt32()); element.rotation = (TrackElement.TrackRotation)reader.ReadUInt32(); track.Add(element); } stream.Seek(skip, SeekOrigin.Current); } stream.Seek(65572, SeekOrigin.Begin); track.playable = reader.ReadUInt32() == 1; } return(track); }
public StationCall(StationTrack track, Time arrival, Time departure, bool isStop) { Track = track ?? throw new ArgumentNullException(nameof(track)); Track.Add(this); Arrival = arrival ?? throw new ArgumentNullException(nameof(arrival), string.Format(CultureInfo.CurrentCulture, "At {0}", track.Station)); Departure = departure ?? throw new ArgumentNullException(nameof(departure), string.Format(CultureInfo.CurrentCulture, "At {0}", track.Station)); IsStop = isStop; Notes = new List <StationCallNote>(); }
private void button1_Click(object sender, EventArgs e) { DXPlayer _dxPlayer = new DXPlayer(); _dxPlayer.Owner = this; Wave _wave = new Wave(EngineDesigner.Properties.Resources.Kick); Track _track = new Track(_wave.WaveFormat.Channels, _wave.WaveFormat.BitsPerSample); _track = _track.GenerateSilence(_wave.WaveTrack.SampleNumber); Track _left = new Track(_wave.WaveFormat.Channels, _wave.WaveFormat.BitsPerSample); for (int a = 0; a < _wave.WaveTrack.SampleNumber; a++) { _left.Add(0, _wave.WaveTrack[0, a]); _left.Add(1, new Sample(16)); } Track _right = new Track(_wave.WaveFormat.Channels, _wave.WaveFormat.BitsPerSample); for (int a = 0; a < _wave.WaveTrack.SampleNumber; a++) { _right.Add(0, new Sample(16)); _right.Add(1, _wave.WaveTrack[1, a]); } _track.MixWith(_left, 0, false); _track.MixWith(_right, 6000, false); _wave.WaveTrack = _track; SoundPatch _soundPatch = _dxPlayer.AddSoundPatch(_wave); _soundPatch.Play(true); }
public override void OnPostTargetMembersGUI() { if (NumTargets > 1) { return; } Undo.RecordObject(Track, "Track wheel add/remove."); InspectorGUI.ToolListGUI(this, Track.Wheels, "Wheels", wheel => Track.Add(wheel), wheel => Track.Remove(wheel)); }
void InitMidiSequence() { // Generate midi file midiSequence = new Sequence(Sequence.PPQ, midiTickResolution, 0, (int)MidiHelper.MidiFormat.SingleTrack); midiTrack = midiSequence.CreateTrack(); midiTrack.Add(MetaEvent.CreateMetaEvent((int)MidiHelper.MetaEventType.SequenceOrTrackName, "Audio2Midi", 0, midiTickResolution)); midiTrack.Add(MetaEvent.CreateMetaEvent((int)MidiHelper.MetaEventType.CopyrightNotice, "*****@*****.**", 0, midiTickResolution)); midiTrack.Add(MetaEvent.CreateMetaEvent((int)MidiHelper.MetaEventType.Tempo, "" + midiBPM, 0, midiTickResolution)); midiTrack.Add(MetaEvent.CreateMetaEvent((int)MidiHelper.MetaEventType.TimeSignature, "4/4", 0, midiTickResolution)); // Convert from ticks to duration // Midi timings are explained here // http://sites.uci.edu/camp2014/2014/05/19/timing-in-midi-files/ // http://stackoverflow.com/questions/2038313/midi-ticks-to-actual-playback-seconds-midi-music // The formula is 60000 / (BPM * PPQ) (milliseconds). // Where BPM is the tempo of the track (Beats Per Minute). // (i.e. a 120 BPM track would have a MIDI time of: // (60000 / (120 * 192)) or 2.604 ms for 1 tick. double timeBufferMs = ((double)bufferSize / sampleRate) * 1000; double timeTickMs = (60000 / (double)(midiBPM * midiTickResolution)); tickMultiplier = timeBufferMs / timeTickMs; }
public bool AddMessage(string content, User author) { if (TicketStatus == TicketStatus.Closed) { return(false); } Track.Add(new TrackEntry() { Content = content, Author = author }); return(true); }
private void OnWheelSelect(GameObject selection) { if (selection == null) { Debug.LogError("Invalid TrackWheel selection - selected object is null."); return; } if (selection.GetComponentInParent <RigidBody>() == null) { Debug.LogError("Invalid TrackWheel selection - unable to find RigidBody component.", selection); return; } var createNewComponent = selection.GetComponent <TrackWheel>() == null; if (createNewComponent) { Undo.RegisterCreatedObjectUndo(TrackWheel.Create(selection), "Create TrackWheel"); } else if (Track.Contains(selection.GetComponent <TrackWheel>())) { Debug.Log("TrackWheel already part of Track - ignoring selection."); return; } // Reconfigure TrackWheel given new or the same selection. else { selection.GetComponent <TrackWheel>().Configure(selection); } if (!Track.Add(selection.GetComponent <TrackWheel>())) { Debug.LogError("Track failed to add TrackWheel instance.", Track); if (createNewComponent) { Object.DestroyImmediate(selection.GetComponent <TrackWheel>()); } return; } InspectorGUI.GetItemToolArrayGUIData(Track, "Wheels", selection.GetComponent <TrackWheel>()).Bool = true; EditorUtility.SetDirty(Track); }
public ActionResult Add([FromBody] Track t) { Track track = new Track() { Title = t.Title, Duration = t.Duration, }; if (track.Add() > 0) { return(Ok(new { message = "Track added." })); } else { return(Ok(new { message = "An error occurred while adding the track." })); } }
public void DumpReturnsReverseOrderedBalls() { ITrack minutes = new Track(5); for (int i = 0; i < 5; ++i) { minutes.Add(i); } var balls = minutes.Dump(); Assert.AreEqual(5, balls.Count); for (int i = 4; i >= 0 && balls.Count > 0; --i) { int ball = balls.Dequeue(); Assert.AreEqual(i, ball); } }
static void Main(string[] args) { var writer = new TrkWriter(); var track = new Track() { size = Track.TrackSize.Multiplayer, theme = Track.TrackTheme.Ice, time = Track.TrackTime.Night }; track.Add(new TrackElement() { theme = track.theme, // theme is set first, because that's important for the ID. index = 0, rotation = 0, pos = new GridPosition(0, 0, 0) }); writer.WriteTrack(track, "test.trk"); }
public override void Render(Rect rect, float headerWidth) { base.Render(rect, headerWidth); switch (Event.current.type) { case EventType.DragUpdated: if (rect.Contains(Event.current.mousePosition)) { int numAnimationsDragged = FAnimationEventInspector.NumAnimationsDragAndDrop(Track.Sequence.FrameRate); int frame = SequenceEditor.GetFrameForX(Event.current.mousePosition.x); DragAndDrop.visualMode = numAnimationsDragged > 0 && Track.CanAddAt(frame) ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected; Event.current.Use(); } break; case EventType.DragPerform: if (rect.Contains(Event.current.mousePosition)) { AnimationClip animClip = FAnimationEventInspector.GetAnimationClipDragAndDrop(Track.Sequence.FrameRate); if (animClip && Mathf.Approximately(animClip.frameRate, Track.Sequence.FrameRate)) { int frame = SequenceEditor.GetFrameForX(Event.current.mousePosition.x); int maxLength; if (Track.CanAddAt(frame, out maxLength)) { FPlayAnimationEvent animEvt = FEvent.Create <FPlayAnimationEvent>(new FrameRange(frame, frame + Mathf.Min(maxLength, Mathf.RoundToInt(animClip.length * animClip.frameRate)))); Track.Add(animEvt); FAnimationEventInspector.SetAnimationClip(animEvt, animClip); DragAndDrop.AcceptDrag(); } } Event.current.Use(); } break; } }
public SectionInterpreter(string[] string0) { for (var i = 0; i < string0.Length; i++) { var text = string0[i]; var array = text.Split(new[] { '=', '"' }, 3, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 3 && !(array[1].Trim() != "E")) { array[2] = array[2].TrimEnd(' ', '\t'); if (array[2].EndsWith("\"")) { array[2] = array[2].Substring(0, array[2].Length - 1); } var num = ChartParser.GetNoteFromResolution(array[0].Trim()); if (array[2].StartsWith("section ")) { SectionList.Add(num, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(array[2] .Substring("section ".Length) .Replace('_', ' '))); } else if (OtherList.ContainsKey(num)) { OtherList[num].Add(array[2]); } else { OtherList.Add(num, new List <string>()); OtherList[num].Add(array[2]); } } } }
public QBCParser(string string_0, zzGenericNode1 class308_0, zzGenericNode1 class308_1, zzGenericNode1 class308_2) { string[] array = new string[] { "Easy", "Medium", "Hard", "Expert" }; string[] array2 = new string[] { "Single", "Double" }; ArrayPointerRootNode @class; for (int i = 0; i < array2.Length; i++) { string a = array2[i]; string[] array3 = new string[] { "Guitar", "Rhythm" }; for (int j = 0; j < array3.Length; j++) { string text = array3[j]; string[] array4 = array; for (int k = 0; k < array4.Length; k++) { string text2 = array4[k]; string text3 = (text.ToLower() + ((a == "Double") ? "coop" : "") + "_" + text2.ToLower()).Replace("guitar_", ""); @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_song_" + text3)); if (@class != null && @class.method_7() is IntegerArrayNode) { Track<int, NotesAtOffset> class2 = new Track<int, NotesAtOffset>(); int[] array5 = @class.method_7().method_7<int>(); for (int l = 0; l < array5.Length; l += 3) { class2.Add(array5[l], new NotesAtOffset(array5[l + 2], array5[l + 1])); } this.noteList.Add(text3, class2); } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_" + text3 + "_star")); if (@class != null && @class.method_7() is ListArrayNode) { Track<int, int[]> class3 = new Track<int, int[]>(); foreach (IntegerArrayNode current in @class.method_7().method_8<IntegerArrayNode>()) { class3.Add(current[0], new int[] { current[1], current[2] }); } this.spList.Add(text3, class3); } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_" + text3 + "_starbattlemode")); if (@class != null && @class.method_7() is ListArrayNode) { Track<int, int[]> class4 = new Track<int, int[]>(); foreach (IntegerArrayNode current2 in @class.method_7().method_8<IntegerArrayNode>()) { class4.Add(current2[0], new int[] { current2[1], current2[2] }); } this.battleNoteList.Add(text3, class4); } } } } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_faceoffp1")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (IntegerArrayNode current3 in @class.method_7().method_8<IntegerArrayNode>()) { this.class228_2.Add(current3[0], current3[1]); } } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_faceoffp2")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (IntegerArrayNode current4 in @class.method_7().method_8<IntegerArrayNode>()) { this.class228_3.Add(current4[0], current4[1]); } } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_bossbattlep1")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (IntegerArrayNode current5 in @class.method_7().method_8<IntegerArrayNode>()) { this.bpmList.Add(current5[0], current5[1]); } } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_bossbattlep2")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (IntegerArrayNode current6 in @class.method_7().method_8<IntegerArrayNode>()) { this.class228_5.Add(current6[0], current6[1]); } } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_timesig")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (IntegerArrayNode current7 in @class.method_7().method_8<IntegerArrayNode>()) { this.tsList.Add(current7[0], new int[] { current7[1], current7[2] }); } } @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_fretbars")); if (@class != null && @class.method_7() is IntegerArrayNode) { this.class239_0 = new Class239<int>(@class.method_7().method_8<int>()); this.int_0 = (this.class239_0[1] - this.class239_0[0]) / 4; try { Dictionary<int, string> dictionary = new Dictionary<int, string>(); @class = class308_0.method_5<ArrayPointerRootNode>(new ArrayPointerRootNode(string_0 + "_markers")); if (class308_1 != null && @class != null && @class.method_7() is StructureArrayNode) { foreach (UnicodeRootNode class5 in class308_1.Nodes) { dictionary.Add(class5.int_0, class5.method_7()); } using (List<StructureHeaderNode>.Enumerator enumerator9 = @class.method_7().method_8<StructureHeaderNode>().GetEnumerator()) { while (enumerator9.MoveNext()) { StructureHeaderNode current8 = enumerator9.Current; this.class228_1.Add(((IntegerStructureNode)current8[0]).method_8(), dictionary[((FileTagStructureNode)current8[1]).method_9()]); } goto IL_7C2; } } if (@class != null && @class.method_7() is StructureArrayNode) { foreach (StructureHeaderNode current9 in @class.method_7().method_8<StructureHeaderNode>()) { this.class228_1.Add(((IntegerStructureNode)current9[0]).method_8(), ((UnicodeStructureNode)current9[1]).method_8()); } } IL_7C2:; } catch { } try { if (class308_2 != null) { this.gh3Song_0 = new GH3Song(class308_2.method_5<StructurePointerNode>(new StructurePointerNode(string_0))); } return; } catch { return; } } throw new Exception("Not a MID.QB!"); }
private void method_6(Track<int, int> class228_1, Track<int, int> class228_2) { if (class228_2 == null) { return; } foreach (int current in class228_2.Keys) { int num = this.calculateOffset(current); int value = (class228_2[current] == 0) ? 1 : (this.calculateOffset(current + class228_2[current]) - num); class228_1.Add(num, value); } }
public ChartParser method_2(Gh3Song gh3Song1) { var @class = new ChartParser(Gh3Song0); @class.Constant480 = Int1; if (gh3Song1 != null) { @class.Gh3SongInfo.vmethod_0(gh3Song1); } _class2286 = new Track <int, int>(); if (FretbarList != null) { var value = FretbarList[0]; FretbarList[0] = 0; var num = 0; for (var i = 1; i < FretbarList.Count; i++) { var num2 = FretbarList[i] - FretbarList[i - 1]; var num3 = Convert.ToInt32(60000000.0 / num2); if (num3 != num) { @class.BpmInterpreter.BpmList.Add((i - 1) * Int1, num3); num = num3; } _class2286.Add(FretbarList[i - 1], num2); } FretbarList[0] = value; @class.SectionInterpreter.OtherList.Add(method_0(FretbarList[FretbarList.Count - 1]), new List <string>( new[] { "end" })); foreach (var current in Class2281.Keys) { @class.SectionInterpreter.SectionList.Add(method_0(current), Class2281[current]); } foreach (var current2 in TsList.Keys) { @class.BpmInterpreter.TsList.Add(method_0(current2), TsList[current2][0]); } var class2 = new Track <int, int>(); var class3 = new Track <int, int>(); foreach (var current3 in Class2282.Keys) { var num4 = method_0(current3); var num5 = method_0(current3 + Class2282[current3] - Int0) - num4; class2.Add(num4, (num5 <= Int1 / 4) ? 0 : num5); } foreach (var current4 in Class2283.Keys) { var num4 = method_0(current4); var num5 = method_0(current4 + Class2283[current4] - Int0) - num4; class3.Add(num4, (num5 <= Int1 / 4) ? 0 : num5); } var class4 = new Track <int, int>(); var class5 = new Track <int, int>(); foreach (var current5 in BpmList.Keys) { var num4 = method_0(current5); var num5 = method_0(current5 + BpmList[current5] - Int0) - num4; class4.Add(num4, (num5 <= Int1 / 4) ? 0 : num5); } foreach (var current6 in Class2285.Keys) { var num4 = method_0(current6); var num5 = method_0(current6 + Class2285[current6] - Int0) - num4; class5.Add(num4, (num5 <= Int1 / 4) ? 0 : num5); } string[] array = { "Easy", "Medium", "Hard", "Expert" }; string[] array2 = { "Single", "Double" }; for (var j = 0; j < array2.Length; j++) { var text = array2[j]; string[] array3 = { "Guitar", "Rhythm" }; for (var k = 0; k < array3.Length; k++) { var text2 = array3[k]; var array4 = array; for (var l = 0; l < array4.Length; l++) { var text3 = array4[l]; var key = (text2.ToLower() + ((text == "Double") ? "coop" : "") + "_" + text3.ToLower()) .Replace("guitar_", ""); if (NoteList.ContainsKey(key)) { var class6 = new NoteEventInterpreter(); var class7 = NoteList[key]; foreach (var current7 in class7.Keys) { var num4 = method_0(current7); var num5 = method_0(current7 + class7[current7].SustainLength - Int0) - num4; class6.NoteList.Add(num4, new NotesAtOffset(class7[current7].NoteValues, (num5 <= Int1 / 4) ? 0 : num5)); } class6.AlwaysTrue = false; if (SpList.ContainsKey(key)) { var class8 = SpList[key]; foreach (var current8 in class8.Keys) { var num4 = method_0(current8); var num5 = method_0(current8 + class8[current8][0] - Int0) - num4; class6.Class2281.Add(num4, (num5 <= Int1 / 4) ? 0 : num5); } } if (BattleNoteList.ContainsKey(key)) { var class9 = SpList[key]; foreach (var current9 in class9.Keys) { var num4 = method_0(current9); var num5 = method_0(current9 + class9[current9][0] - Int0) - num4; class6.Class2284.Add(num4, (num5 <= Int1 / 4) ? 0 : num5); } } class6.Class2282 = class2; class6.Class2283 = class3; class6.Class2285 = class4; class6.Class2286 = class5; @class.DifficultyWithNotes.Add(text3 + text + text2, class6); } } } } _class2286.Clear(); _class2286 = null; return(@class); } return(null); }
public QbcParser(string fileName) { var list = new List <string>(); var streamReader = File.OpenText(fileName); string text = null; string currentLine; while ((currentLine = streamReader.ReadLine()) != null) { if (currentLine.StartsWith("[")) { text = currentLine.Split(new[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries)[0]; } else if (!currentLine.Equals("{")) { if (currentLine.Equals("}")) { string key; if ((key = text) == null) { goto IL_8AA; } if (Class369.Dictionary0 == null) { Class369.Dictionary0 = new Dictionary <string, int>(8) { { "Song", 0 }, { "SyncTrack", 1 }, { "FretBars", 2 }, { "Events", 3 }, { "FaceOffP1", 4 }, { "FaceOffP2", 5 }, { "BossBattleP1", 6 }, { "BossBattleP2", 7 } }; } int num; if (Class369.Dictionary0.TryGetValue(key, out num)) { switch (num) { case 0: Gh3Song0.Editable = true; using (var enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { var current = enumerator.Current; var array = current.Split(new[] { '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length > 1) { var text3 = array[0].Trim().ToLower(); var text4 = array[1].Trim().Replace("\"", ""); string key2; switch (key2 = text3) { case "name": Gh3Song0.Title = text4; break; case "artist": Gh3Song0.Artist = text4; break; case "year": Gh3Song0.Year = text4; break; case "player2": Gh3Song0.NotBass = !text4.ToLower().Equals("bass"); break; case "artisttext": if (text4.Equals("by")) { Gh3Song0.ArtistText = true; } else if (text4.Equals("as made famous by")) { Gh3Song0.ArtistText = false; } else { Gh3Song0.ArtistText = text4; } break; case "offset": Gh3Song0.InputOffset = (Gh3Song0.GemOffset = Convert.ToInt32( Convert.ToDouble(text4) * -1000.0)); break; case "singer": Gh3Song0.Singer = text4; break; case "bassist": Gh3Song0.Bassist = text4; break; case "boss": Gh3Song0.Boss = text4; break; case "countoff": Gh3Song0.Countoff = text4; break; case "guitarvol": Gh3Song0.GuitarVol = Convert.ToSingle(text4); break; case "bandvol": Gh3Song0.BandVol = Convert.ToSingle(text4); break; case "hopo": Gh3Song0.HammerOn = Convert.ToSingle(text4); break; case "originalartist": Gh3Song0.OriginalArtist = text4.Equals("true"); break; case "resolution": Int1 = Convert.ToInt32(text4); break; } } } goto IL_A3C; } goto IL_514; case 1: goto IL_514; case 2: goto IL_5AE; case 3: using (var enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { var current2 = enumerator2.Current; var array2 = current2.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a; if ((a = array2[1]) != null && a == "S") { Class2281.Add(Convert.ToInt32(array2[0]), array2[2]); } } goto IL_A3C; } break; case 4: break; case 5: goto IL_72D; case 6: goto IL_7AC; case 7: goto IL_82B; default: goto IL_8AA; } using (var enumerator3 = list.GetEnumerator()) { while (enumerator3.MoveNext()) { var current3 = enumerator3.Current; var array3 = current3.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a2; if ((a2 = array3[1]) != null && a2 == "F") { Class2282.Add(Convert.ToInt32(array3[0]), Convert.ToInt32(array3[2])); } } goto IL_A3C; } goto IL_72D; IL_5AE: FretbarList = new Fretbar <int>(); foreach (var current4 in list) { FretbarList.method_1(Convert.ToInt32(current4.Trim(' ', '\t', '='))); } Int0 = (FretbarList[1] - FretbarList[0]) / 4; goto IL_A3C; IL_514: using (var enumerator5 = list.GetEnumerator()) { while (enumerator5.MoveNext()) { var current5 = enumerator5.Current; var array4 = current5.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a3; if ((a3 = array4[1]) != null && a3 == "TS") { TsList.Add(Convert.ToInt32(array4[0]), new[] { Convert.ToInt32(array4[2]), Convert.ToInt32(array4[3]) }); } } goto IL_A3C; } goto IL_5AE; IL_72D: using (var enumerator6 = list.GetEnumerator()) { while (enumerator6.MoveNext()) { var current6 = enumerator6.Current; var array5 = current6.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a4; if ((a4 = array5[1]) != null && a4 == "F") { Class2283.Add(Convert.ToInt32(array5[0]), Convert.ToInt32(array5[2])); } } goto IL_A3C; } IL_7AC: using (var enumerator7 = list.GetEnumerator()) { while (enumerator7.MoveNext()) { var current7 = enumerator7.Current; var array6 = current7.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a5; if ((a5 = array6[1]) != null && a5 == "B") { BpmList.Add(Convert.ToInt32(array6[0]), Convert.ToInt32(array6[2])); } } goto IL_A3C; } IL_82B: using (var enumerator8 = list.GetEnumerator()) { while (enumerator8.MoveNext()) { var current8 = enumerator8.Current; var array7 = current8.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a6; if ((a6 = array7[1]) != null && a6 == "B") { Class2285.Add(Convert.ToInt32(array7[0]), Convert.ToInt32(array7[2])); } } goto IL_A3C; } goto IL_8AA; } goto IL_8AA; IL_A3C: list.Clear(); continue; IL_8AA: text = text.ToLower(); if (!NoteList.ContainsKey(text)) { var noteList = new Track <int, NotesAtOffset>(); var spList = new Track <int, int[]>(); var battleNote = new Track <int, int[]>(); foreach (var current9 in list) { var array8 = current9.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a7; if ((a7 = array8[1]) != null) { if (!(a7 == "N")) { if (!(a7 == "S")) { if (a7 == "B") { battleNote.Add(Convert.ToInt32(array8[0]), new[] { Convert.ToInt32(array8[3]), Convert.ToInt32(array8[2]) }); } } else { spList.Add(Convert.ToInt32(array8[0]), new[] { Convert.ToInt32(array8[3]), Convert.ToInt32(array8[2]) }); } } else { noteList.Add(Convert.ToInt32(array8[0]), new NotesAtOffset(Convert.ToInt32(array8[2]), Convert.ToInt32(array8[3]))); } } } NoteList.Add(text, noteList); SpList.Add(text, spList); BattleNoteList.Add(text, battleNote); } goto IL_A3C; } if (!currentLine.Equals("")) { list.Add(currentLine); } } } streamReader.Close(); }
public QbcParser(string string0, ZzGenericNode1 class3080, ZzGenericNode1 class3081, ZzGenericNode1 class3082) { string[] array = { "Easy", "Medium", "Hard", "Expert" }; string[] array2 = { "Single", "Double" }; ArrayPointerRootNode @class; for (var i = 0; i < array2.Length; i++) { var a = array2[i]; string[] array3 = { "Guitar", "Rhythm" }; for (var j = 0; j < array3.Length; j++) { var text = array3[j]; var array4 = array; for (var k = 0; k < array4.Length; k++) { var text2 = array4[k]; var text3 = (text.ToLower() + ((a == "Double") ? "coop" : "") + "_" + text2.ToLower()) .Replace("guitar_", ""); @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_song_" + text3)); if (@class != null && @class.method_7() is IntegerArrayNode) { var class2 = new Track <int, NotesAtOffset>(); var array5 = @class.method_7().method_7 <int>(); for (var l = 0; l < array5.Length; l += 3) { class2.Add(array5[l], new NotesAtOffset(array5[l + 2], array5[l + 1])); } NoteList.Add(text3, class2); } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_" + text3 + "_star")); if (@class != null && @class.method_7() is ListArrayNode) { var class3 = new Track <int, int[]>(); foreach (var current in @class.method_7().method_8 <IntegerArrayNode>()) { class3.Add(current[0], new[] { current[1], current[2] }); } SpList.Add(text3, class3); } @class = class3080.method_5( new ArrayPointerRootNode(string0 + "_" + text3 + "_starbattlemode")); if (@class != null && @class.method_7() is ListArrayNode) { var class4 = new Track <int, int[]>(); foreach (var current2 in @class.method_7().method_8 <IntegerArrayNode>()) { class4.Add(current2[0], new[] { current2[1], current2[2] }); } BattleNoteList.Add(text3, class4); } } } } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_faceoffp1")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (var current3 in @class.method_7().method_8 <IntegerArrayNode>()) { Class2282.Add(current3[0], current3[1]); } } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_faceoffp2")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (var current4 in @class.method_7().method_8 <IntegerArrayNode>()) { Class2283.Add(current4[0], current4[1]); } } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_bossbattlep1")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (var current5 in @class.method_7().method_8 <IntegerArrayNode>()) { BpmList.Add(current5[0], current5[1]); } } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_bossbattlep2")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (var current6 in @class.method_7().method_8 <IntegerArrayNode>()) { Class2285.Add(current6[0], current6[1]); } } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_timesig")); if (@class != null && @class.method_7() is ListArrayNode) { foreach (var current7 in @class.method_7().method_8 <IntegerArrayNode>()) { TsList.Add(current7[0], new[] { current7[1], current7[2] }); } } @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_fretbars")); if (@class != null && @class.method_7() is IntegerArrayNode) { FretbarList = new Fretbar <int>(@class.method_7().method_8 <int>()); Int0 = (FretbarList[1] - FretbarList[0]) / 4; try { var dictionary = new Dictionary <int, string>(); @class = class3080.method_5(new ArrayPointerRootNode(string0 + "_markers")); if (class3081 != null && @class != null && @class.method_7() is StructureArrayNode) { foreach (UnicodeRootNode class5 in class3081.Nodes) { dictionary.Add(class5.Int0, class5.method_7()); } using (var enumerator9 = @class.method_7().method_8 <StructureHeaderNode>().GetEnumerator()) { while (enumerator9.MoveNext()) { var current8 = enumerator9.Current; Class2281.Add(((IntegerStructureNode)current8[0]).method_8(), dictionary[((FileTagStructureNode)current8[1]).method_9()]); } goto IL_7C2; } } if (@class != null && @class.method_7() is StructureArrayNode) { foreach (var current9 in @class.method_7().method_8 <StructureHeaderNode>()) { Class2281.Add(((IntegerStructureNode)current9[0]).method_8(), ((UnicodeStructureNode)current9[1]).method_8()); } } IL_7C2: ; } catch { } try { if (class3082 != null) { Gh3Song0 = new Gh3Song(class3082.method_5(new StructurePointerNode(string0))); } return; } catch { return; } } throw new Exception("Not a MID.QB!"); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker _backgroundWorker = (BackgroundWorker)sender; BackgroundWorkerArgument _backgroundWorkerArgument = (BackgroundWorkerArgument)e.Argument; // t_rotacije = (60 / RPM) s // t_cikla = t_rotacije * [št rotacij za ciker] s // samplov/cikel = t_cikla * SamplesPerSecond Wave _wave = new Wave(Properties.Resources.Kick); double _rotationTime_s = 60d / _backgroundWorkerArgument.RPM; //_rotationTime_s *= 2; double _cycleTime_s = _rotationTime_s * _backgroundWorkerArgument.Engine.RevolutionsToCompleteCombinedCycle; double _samplesPerCycle = _cycleTime_s * (double)_wave.WaveFormat.SamplesPerSecond; int _strokes = _backgroundWorkerArgument.Engine.RevolutionsToCompleteCombinedCycle * 2; //po 2 stroka za eno rotacijo //dobimo koliko dolg wave lahko uporabimo int _samplesPerStroke = (int)(_samplesPerCycle / (double)_strokes); double _samplesPerDeg = _samplesPerStroke / 180d; #region "Cancelled?" if (_backgroundWorker.CancellationPending) { e.Cancel = true; return; } #endregion "Cancelled?" //dobimo zvok za 1 combustion stroke (trim je pomemben, ker wave ne sme biti daljši ali krajši od stroka!) _wave.WaveTrack.Trim(_samplesPerStroke); if (_wave.WaveTrack.SampleNumber < _samplesPerStroke) { _wave.WaveTrack.AddTo( _wave.WaveTrack.GenerateSilence(_samplesPerStroke - _wave.WaveTrack.SampleNumber)); } #region "Cancelled?" if (_backgroundWorker.CancellationPending) { e.Cancel = true; return; } #endregion "Cancelled?" //zgradimo track za cel engine Track _engineTrack = new Track(_wave.WaveTrack.ChannelNumer, _wave.WaveTrack.BitsPerSample); //v začetku je tišina; gor bomo miksali cilindre _engineTrack.AddTo(_engineTrack.GenerateSilence((int)_samplesPerCycle)); //dobimo naklone List <double> _tilts = new List <double>(); foreach (PositionedCylinder _positionedCylinder in _backgroundWorkerArgument.Engine.PositionedCylinders) { double _double = Mathematics.GetAbsoluteAngle_deg(_positionedCylinder.Tilt_deg); if (!_tilts.Contains(_double)) { _tilts.Add(_double); } } //dobimo tracke po naklonih Dictionary <double, Track> _tracks = new Dictionary <double, Track>(); //naklon, track za naklon foreach (double _tilt in _tilts) { Track _totalTrackPerTilt = new Track(_wave.WaveTrack.ChannelNumer, _wave.WaveTrack.BitsPerSample); //v začetku je tišina; gor bomo miksali cilinder _totalTrackPerTilt.AddTo(_totalTrackPerTilt.GenerateSilence((int)_samplesPerCycle)); #region "Cancelled?" if (_backgroundWorker.CancellationPending) { e.Cancel = true; return; } #endregion "Cancelled?" #region "dobimo tracke od cilindrov" foreach (PositionedCylinder _positionedCylinder in _backgroundWorkerArgument.Engine.PositionedCylinders) { if (_positionedCylinder.Tilt_deg == _tilt) { Track _track = new Track(_wave.WaveFormat.Channels, _wave.WaveFormat.BitsPerSample); foreach (Stroke _stroke in _positionedCylinder.Cycle.Strokes) { if ((_stroke.Equals(Stroke.Combustion)) || (_stroke.Equals(Stroke.CombustionExhaust))) { _track.AddTo(_wave.WaveTrack); } else { _track.AddTo(_wave.WaveTrack.GenerateSilence(_samplesPerStroke)); } #region "Cancelled?" if (_backgroundWorker.CancellationPending) { e.Cancel = true; return; } #endregion "Cancelled?" } //izračunamo na katerem samplu se začne miksanje za ta cilinder int _mixStartSample = (int)(_positionedCylinder.FiringAngle_deg * _samplesPerDeg); //zmiksamo z ostankom Track _return = _totalTrackPerTilt.MixWithReturn(_track, _mixStartSample); //če je kaj ostalo, damo na začetek (za tiste takte, ki se mogoče ne bi končali v ciklu) if ((_return != null) && (_return.SampleNumber > 0)) { _totalTrackPerTilt.MixWith(_return, 0, false); //sprostimo, ker žre dosti rama _return = null; } //sprostimo, ker žre dosti rama _track = null; GC.Collect(); #region "Cancelled?" if (_backgroundWorker.CancellationPending) { e.Cancel = true; return; } #endregion "Cancelled?" } } #endregion "dobimo tracke od cilindrov" _tracks.Add(_tilt, _totalTrackPerTilt); } //če imamo V motor ali boxer, računamo, da gre vsak bank v svoj auspuh if (_tilts.Count == 2) { Track _left = new Track(_wave.WaveFormat.Channels, _wave.WaveFormat.BitsPerSample); for (int a = 0; a < _tracks[_tilts[0]].SampleNumber; a++) { _left.Add(0, _tracks[_tilts[0]][0, a]); _left.Add(1, new Sample(16)); } Track _right = new Track(_wave.WaveFormat.Channels, _wave.WaveFormat.BitsPerSample); for (int a = 0; a < _tracks[_tilts[1]].SampleNumber; a++) { _right.Add(0, new Sample(16)); _right.Add(1, _tracks[_tilts[1]][1, a]); } _engineTrack.MixWith(_left, 0, false); _engineTrack.MixWith(_right, 0, false); } else { foreach (Track _track in _tracks.Values) { _engineTrack.MixWith(_track, 0, false); } } //damo spet v wave _wave.WaveTrack = _engineTrack; //sprostimo, ker žre dosti rama _engineTrack = null; GC.Collect(); e.Result = _wave; }
/// <summary> /// Записать новую точку в список пройденного пути /// </summary> public static void AddTrack() { Track.Add(new Dot(Snake.Snake_)); }
public void AddPart(Route route) { Track.Add(route); }
static void Main(string[] args) { string[] inputs; bool initializing = true; Point prevCheckPoint = new Point(0, 0); Point myPrevLoc = new Point(0, 0); Point opPrevLoc = new Point(0, 0); int prevDist = 0; int prevAngle = 0; int velocity = 0; int opVelocity = 0; State state = State.Approach; bool boostAvailable = true; Track track = new Track(); string msg = ""; // game loop while (true) { inputs = Console.ReadLine().Split(' '); Point myLoc = new Point(int.Parse(inputs[0]), int.Parse(inputs[1])); Point checkpoint = new Point(int.Parse(inputs[2]), int.Parse(inputs[3])); int dist = int.Parse(inputs[4]); // distance to the next checkpoint int angle = int.Parse(inputs[5]); // angle between your pod orientation and the direction of the next checkpoint inputs = Console.ReadLine().Split(' '); Point opLoc = new Point(int.Parse(inputs[0]), int.Parse(inputs[1])); if (initializing) { initializing = false; myPrevLoc = new Point(myLoc); prevCheckPoint = new Point(checkpoint); prevDist = dist; prevAngle = angle; opPrevLoc = opLoc; track.Add(myLoc); track.Add(checkpoint); } velocity = Util.Distance(myPrevLoc, myLoc); opVelocity = Util.Distance(opPrevLoc, opLoc); Console.Error.WriteLine("State: {2}; Dist: {0}; Angle: {1}", dist, angle, state); Console.Error.WriteLine( "My:: Loc {0}; Velocity: {1}; Op:: Loc {2}; Velocity: {3};", myLoc, velocity, opLoc, opVelocity); if (checkpoint != prevCheckPoint) { state = State.Reorient; track.Add(checkpoint); Console.Error.WriteLine("Reorienting to CheckPoint: {0}", checkpoint); } double maxThrust = 100; if (state == State.Reorient) { if (Math.Abs(angle) < 25) { state = State.Approach; } else { maxThrust = 95; if (dist < 3000) { maxThrust = 90; } } } double adjustThrust = 0; if (state == State.Approach) { // we missed the checkpoint if (dist - prevDist > 0 && Math.Abs(angle) > 5) { adjustThrust = maxThrust * .9; Console.Error.WriteLine("Missed Checkpoint"); } else if (dist < 2500) { if (track.IsComplete) { Point nextCP = track.Next(checkpoint); double nextAngle = Math.Abs(Util.Angle(myLoc, nextCP)); int nextDist = Util.Distance(checkpoint, nextCP); Console.Error.WriteLine("Next CP:: {0}; Dist: {1}; Angle: {2}", nextCP, nextDist, nextAngle); if (nextAngle > 90) { adjustThrust = maxThrust * .25; } else if (nextAngle > 45) { adjustThrust = maxThrust * .10; } if (nextDist < 3000 && velocity > 500) { adjustThrust *= 2.5; } } else { adjustThrust = maxThrust * .10; } if (Math.Abs(angle) > Math.Abs(prevAngle)) { maxThrust *= .75; } } } else if (state == State.Reorient) { int absAngle = Math.Abs(angle); if (absAngle > 90) { if (dist < 3000 && velocity > 400) { adjustThrust = maxThrust * .75; } else { adjustThrust = maxThrust * .5; } } else { if (dist < 3000 && velocity > 400) { adjustThrust = absAngle; } else { adjustThrust = absAngle * .5; } } } Console.Error.WriteLine("MaxThrust: {0}; AdjustThrust: {1}", maxThrust, adjustThrust); string thrust = ((int)Math.Ceiling(Math.Max(maxThrust * .1, (maxThrust - adjustThrust)))).ToString(); if (boostAvailable && thrust == "100" && dist > 3000) { thrust = "BOOST"; boostAvailable = false; } Console.WriteLine(checkpoint + " " + thrust + msg); myPrevLoc = new Point(myLoc); prevCheckPoint = new Point(checkpoint); prevDist = dist; prevAngle = angle; opPrevLoc = opLoc; } }
public NoteEventInterpreter(string[] stringImported, int constant480) { if (!(AlwaysTrue = (stringImported.Length == 0))) //If string is empty { //Cycles through the string array imported (All notes/SP) for (var i = 0; i < stringImported.Length; i++) { var currentString = stringImported[i]; /* * Indexes: * 0=Offset * 1=Event Type * 2=Note Value * 3=Sustain Length */ var notesEventsArray = currentString.Split(new[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); var offset = ChartParser.GetNoteFromResolution(notesEventsArray[0]); string eventType; if ((eventType = notesEventsArray[1]) != null) { if (!(eventType == "N")) { if (!(eventType == "S")) { if (eventType == "E") { //Interprets Events if (EventList.ContainsKey(offset)) { _currentEventLine = notesEventsArray[2]; for (var j = 3; j < notesEventsArray.Length; j++) { _currentEventLine = _currentEventLine + " " + notesEventsArray[j]; } EventList[offset].Add(_currentEventLine); } else { _currentEventLine = notesEventsArray[2]; for (var k = 3; k < notesEventsArray.Length; k++) { _currentEventLine = _currentEventLine + " " + notesEventsArray[k]; } EventList.Add(offset, new List <string>()); EventList[offset].Add(_currentEventLine); } } } //Interprets Starpower else { switch (Convert.ToInt32(notesEventsArray[2])) { case 0: if (!Class2282.ContainsKey(offset)) { Class2282.Add(offset, ChartParser.GetNoteFromResolution(notesEventsArray[3])); } break; case 1: if (!Class2283.ContainsKey(offset)) { Class2283.Add(offset, ChartParser.GetNoteFromResolution(notesEventsArray[3])); } break; case 2: if (!Class2281.ContainsKey(offset)) { Class2281.Add(offset, ChartParser.GetNoteFromResolution(notesEventsArray[3])); } break; case 3: if (!Class2284.ContainsKey(offset)) { Class2284.Add(offset, ChartParser.GetNoteFromResolution(notesEventsArray[3])); } break; case 4: if (!Class2285.ContainsKey(offset)) { Class2285.Add(offset, ChartParser.GetNoteFromResolution(notesEventsArray[3])); } break; case 5: if (!Class2286.ContainsKey(offset)) { Class2286.Add(offset, ChartParser.GetNoteFromResolution(notesEventsArray[3])); } break; } } } //Interprets Notes /* * Indexes: * 0=Offset * 1=Event Type * 2=Note Value * 3=Sustain Length */ else { var notes = new bool[32]; var sustainLength = ChartParser.GetNoteFromResolution(notesEventsArray[3]); if (sustainLength <= constant480 / 4) { sustainLength = 0; } if (!NoteList.ContainsKey(offset)) { NoteList.Add(offset, new NotesAtOffset(notes, sustainLength)); } else { var currentSustainLength = NoteList[offset].SustainLength; //Updates sustain length if (currentSustainLength < sustainLength) { NoteList[offset].SustainLength = sustainLength; } } var note = Convert.ToInt32(notesEventsArray[2]); NoteList[offset].NoteValues[note] = true; } } } } }
/// <summary> /// Get the MIDI Sequence found in this input stream. /// <see cref="gnu.sound.midi.spi.MidiFileReader#GetSequence(Stream)"/> /// </summary> public override Sequence GetSequence(Stream stream) { // Good midi spec: // http://www.somascape.org/midi/tech/mfile.html // http://www.ccarh.org/courses/253/handout/smf/ var din = new MidiDataInputStream(stream); var mff = (ExtendedMidiFileFormat)GetMidiFileFormat(din.BaseStream); var seq = new Sequence(mff.DivisionType, mff.Resolution, 0, mff.MidiFileType); int ntracks = mff.NumberOfTracks; while (ntracks-- > 0) { Track track = seq.CreateTrack(); int Mtrk = din.ReadInt32(); if (Mtrk != 0x4D54726B) // "MTrk" { throw new InvalidMidiDataException("Invalid MIDI track header."); } int length = din.ReadInt32(); int runningStatus = -1; int click = 0; // Set this to true when we've hit an End of Track meta event. bool done = false; // Read all events. while (!done) { MidiMessage mm; int deltaTime = din.ReadVariableLengthInt(); click += deltaTime; // in Java bytes are signed (-128, +127) // where in C# it's not (0, 255). int statusByte = din.ReadByte(); if (statusByte < (int)MidiHelper.MidiEventType.SystemExclusive) { ShortMessage shortMessage; switch (statusByte & 0xF0) { case (int)MidiHelper.MidiEventType.NoteOff: case (int)MidiHelper.MidiEventType.NoteOn: case (int)MidiHelper.MidiEventType.AfterTouchPoly: case (int)MidiHelper.MidiEventType.ControlChange: case (int)MidiHelper.MidiEventType.PitchBend: case (int)MidiHelper.MidiEventType.SongPosition: shortMessage = new ShortMessage(); shortMessage.SetMessage(statusByte, din.ReadByte(), din.ReadByte()); runningStatus = statusByte; break; case (int)MidiHelper.MidiEventType.ProgramChange: case (int)MidiHelper.MidiEventType.AfterTouchChannel: case (int)MidiHelper.MidiEventType.SongSelect: case (int)MidiHelper.MidiEventType.BusSelect: shortMessage = new ShortMessage(); shortMessage.SetMessage(statusByte, din.ReadByte(), 0); runningStatus = statusByte; break; case (int)MidiHelper.MidiEventType.TuneRequest: case (int)MidiHelper.MidiEventType.EndOfExclusive: case (int)MidiHelper.MidiEventType.Clock: case (int)MidiHelper.MidiEventType.Start: case (int)MidiHelper.MidiEventType.Continue: case (int)MidiHelper.MidiEventType.Stop: case (int)MidiHelper.MidiEventType.ActiveSensing: case (int)MidiHelper.MidiEventType.SystemReset: shortMessage = new ShortMessage(); shortMessage.SetMessage(statusByte, 0, 0); runningStatus = statusByte; break; default: if (runningStatus != -1) { switch (runningStatus & 0xF0) { case (int)MidiHelper.MidiEventType.NoteOff: case (int)MidiHelper.MidiEventType.NoteOn: case (int)MidiHelper.MidiEventType.AfterTouchPoly: case (int)MidiHelper.MidiEventType.ControlChange: case (int)MidiHelper.MidiEventType.PitchBend: case (int)MidiHelper.MidiEventType.SongPosition: shortMessage = new ShortMessage(); shortMessage.SetMessage(runningStatus, statusByte, din.ReadByte()); break; case (int)MidiHelper.MidiEventType.ProgramChange: case (int)MidiHelper.MidiEventType.AfterTouchChannel: case (int)MidiHelper.MidiEventType.SongSelect: case (int)MidiHelper.MidiEventType.BusSelect: shortMessage = new ShortMessage(); shortMessage.SetMessage(runningStatus, statusByte, 0); continue; case (int)MidiHelper.MidiEventType.TuneRequest: case (int)MidiHelper.MidiEventType.EndOfExclusive: case (int)MidiHelper.MidiEventType.Clock: case (int)MidiHelper.MidiEventType.Start: case (int)MidiHelper.MidiEventType.Continue: case (int)MidiHelper.MidiEventType.Stop: case (int)MidiHelper.MidiEventType.ActiveSensing: case (int)MidiHelper.MidiEventType.SystemReset: shortMessage = new ShortMessage(); shortMessage.SetMessage(runningStatus, 0, 0); continue; default: throw new InvalidMidiDataException("Invalid Short MIDI Event: " + statusByte); } } else { throw new InvalidMidiDataException("Invalid Short MIDI Event: " + statusByte); } break; } mm = shortMessage; } else if (statusByte == (int)MidiHelper.MidiEventType.SystemExclusive || statusByte == (int)MidiHelper.MidiEventType.EndOfExclusive) { // System Exclusive event int sysexLength = din.ReadVariableLengthInt(); var sysexData = din.ReadBytes(sysexLength); var sysexMessage = new SysexMessage(); sysexMessage.SetMessage(statusByte, sysexData, sysexLength); mm = sysexMessage; runningStatus = -1; } else if (statusByte == (int)MidiHelper.META) { // Meta Message byte metaType = din.ReadByte(); int metaLength = din.ReadVariableLengthInt(); var metaData = din.ReadBytes(metaLength); var metaMessage = new MetaMessage(); metaMessage.SetMessage(metaType, metaData, metaLength); mm = metaMessage; // End of Track if (metaType == (byte)MidiHelper.MetaEventType.EndOfTrack) { done = true; } runningStatus = -1; } else { throw new InvalidMidiDataException("Invalid status byte: " + statusByte); } track.Add(new MidiEvent(mm, click)); } } return(seq); }
public ChartParser method_2(GH3Song gh3Song_1) { ChartParser @class = new ChartParser(this.gh3Song_0); @class.constant480 = this.int_1; if (gh3Song_1 != null) { @class.gh3SongInfo.vmethod_0(gh3Song_1); } this.class228_6 = new Track<int, int>(); if (this.class239_0 != null) { int value = this.class239_0[0]; this.class239_0[0] = 0; int num = 0; for (int i = 1; i < this.class239_0.Count; i++) { int num2 = this.class239_0[i] - this.class239_0[i - 1]; int num3 = Convert.ToInt32(60000000.0 / (double)num2); if (num3 != num) { @class.bpmInterpreter.bpmList.Add((i - 1) * this.int_1, num3); num = num3; } this.class228_6.Add(this.class239_0[i - 1], num2); } this.class239_0[0] = value; @class.sectionInterpreter.otherList.Add(this.method_0(this.class239_0[this.class239_0.Count - 1]), new List<string>(new string[] { "end" })); foreach (int current in this.class228_1.Keys) { @class.sectionInterpreter.sectionList.Add(this.method_0(current), this.class228_1[current]); } foreach (int current2 in this.tsList.Keys) { @class.bpmInterpreter.TSList.Add(this.method_0(current2), this.tsList[current2][0]); } Track<int, int> class2 = new Track<int, int>(); Track<int, int> class3 = new Track<int, int>(); foreach (int current3 in this.class228_2.Keys) { int num4 = this.method_0(current3); int num5 = this.method_0(current3 + this.class228_2[current3] - this.int_0) - num4; class2.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } foreach (int current4 in this.class228_3.Keys) { int num4 = this.method_0(current4); int num5 = this.method_0(current4 + this.class228_3[current4] - this.int_0) - num4; class3.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } Track<int, int> class4 = new Track<int, int>(); Track<int, int> class5 = new Track<int, int>(); foreach (int current5 in this.bpmList.Keys) { int num4 = this.method_0(current5); int num5 = this.method_0(current5 + this.bpmList[current5] - this.int_0) - num4; class4.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } foreach (int current6 in this.class228_5.Keys) { int num4 = this.method_0(current6); int num5 = this.method_0(current6 + this.class228_5[current6] - this.int_0) - num4; class5.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } string[] array = new string[] { "Easy", "Medium", "Hard", "Expert" }; string[] array2 = new string[] { "Single", "Double" }; for (int j = 0; j < array2.Length; j++) { string text = array2[j]; string[] array3 = new string[] { "Guitar", "Rhythm" }; for (int k = 0; k < array3.Length; k++) { string text2 = array3[k]; string[] array4 = array; for (int l = 0; l < array4.Length; l++) { string text3 = array4[l]; string key = (text2.ToLower() + ((text == "Double") ? "coop" : "") + "_" + text3.ToLower()).Replace("guitar_", ""); if (this.noteList.ContainsKey(key)) { NoteEventInterpreter class6 = new NoteEventInterpreter(); Track<int, NotesAtOffset> class7 = this.noteList[key]; foreach (int current7 in class7.Keys) { int num4 = this.method_0(current7); int num5 = this.method_0(current7 + class7[current7].sustainLength - this.int_0) - num4; class6.noteList.Add(num4, new NotesAtOffset(class7[current7].noteValues, (num5 <= this.int_1 / 4) ? 0 : num5)); } class6.alwaysTrue = false; if (this.spList.ContainsKey(key)) { Track<int, int[]> class8 = this.spList[key]; foreach (int current8 in class8.Keys) { int num4 = this.method_0(current8); int num5 = this.method_0(current8 + class8[current8][0] - this.int_0) - num4; class6.class228_1.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } } if (this.battleNoteList.ContainsKey(key)) { Track<int, int[]> class9 = this.spList[key]; foreach (int current9 in class9.Keys) { int num4 = this.method_0(current9); int num5 = this.method_0(current9 + class9[current9][0] - this.int_0) - num4; class6.class228_4.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } } class6.class228_2 = class2; class6.class228_3 = class3; class6.class228_5 = class4; class6.class228_6 = class5; @class.difficultyWithNotes.Add(text3 + text + text2, class6); } } } } this.class228_6.Clear(); this.class228_6 = null; return @class; } return null; }
public QBCParser(string fileName) { List<string> list = new List<string>(); StreamReader streamReader = File.OpenText(fileName); string text = null; string currentLine; while ((currentLine = streamReader.ReadLine()) != null) { if (currentLine.StartsWith("[")) { text = currentLine.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries)[0]; } else if (!currentLine.Equals("{")) { if (currentLine.Equals("}")) { string key; if ((key = text) == null) { goto IL_8AA; } if (Class369.dictionary_0 == null) { Class369.dictionary_0 = new Dictionary<string, int>(8) { { "Song", 0 }, { "SyncTrack", 1 }, { "FretBars", 2 }, { "Events", 3 }, { "FaceOffP1", 4 }, { "FaceOffP2", 5 }, { "BossBattleP1", 6 }, { "BossBattleP2", 7 } }; } int num; if (Class369.dictionary_0.TryGetValue(key, out num)) { switch (num) { case 0: this.gh3Song_0.editable = true; using (List<string>.Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; string[] array = current.Split(new char[] { '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length > 1) { string text3 = array[0].Trim().ToLower(); string text4 = array[1].Trim().Replace("\"", ""); string key2; switch (key2 = text3) { case "name": this.gh3Song_0.title = text4; break; case "artist": this.gh3Song_0.artist = text4; break; case "year": this.gh3Song_0.year = text4; break; case "player2": this.gh3Song_0.not_bass = !text4.ToLower().Equals("bass"); break; case "artisttext": if (text4.Equals("by")) { this.gh3Song_0.artist_text = true; } else if (text4.Equals("as made famous by")) { this.gh3Song_0.artist_text = false; } else { this.gh3Song_0.artist_text = text4; } break; case "offset": this.gh3Song_0.input_offset = (this.gh3Song_0.gem_offset = Convert.ToInt32(Convert.ToDouble(text4) * -1000.0)); break; case "singer": this.gh3Song_0.singer = text4; break; case "bassist": this.gh3Song_0.bassist = text4; break; case "boss": this.gh3Song_0.boss = text4; break; case "countoff": this.gh3Song_0.countoff = text4; break; case "guitarvol": this.gh3Song_0.guitar_vol = Convert.ToSingle(text4); break; case "bandvol": this.gh3Song_0.band_vol = Convert.ToSingle(text4); break; case "hopo": this.gh3Song_0.hammer_on = Convert.ToSingle(text4); break; case "originalartist": this.gh3Song_0.original_artist = text4.Equals("true"); break; case "resolution": this.int_1 = Convert.ToInt32(text4); break; } } } goto IL_A3C; } goto IL_514; case 1: goto IL_514; case 2: goto IL_5AE; case 3: using (List<string>.Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { string current2 = enumerator2.Current; string[] array2 = current2.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a; if ((a = array2[1]) != null && a == "S") { this.class228_1.Add(Convert.ToInt32(array2[0]), array2[2]); } } goto IL_A3C; } break; case 4: break; case 5: goto IL_72D; case 6: goto IL_7AC; case 7: goto IL_82B; default: goto IL_8AA; } using (List<string>.Enumerator enumerator3 = list.GetEnumerator()) { while (enumerator3.MoveNext()) { string current3 = enumerator3.Current; string[] array3 = current3.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a2; if ((a2 = array3[1]) != null && a2 == "F") { this.class228_2.Add(Convert.ToInt32(array3[0]), Convert.ToInt32(array3[2])); } } goto IL_A3C; } goto IL_72D; IL_5AE: this.class239_0 = new Class239<int>(); foreach (string current4 in list) { this.class239_0.method_1(Convert.ToInt32(current4.Trim(new char[] { ' ', '\t', '=' }))); } this.int_0 = (this.class239_0[1] - this.class239_0[0]) / 4; goto IL_A3C; IL_514: using (List<string>.Enumerator enumerator5 = list.GetEnumerator()) { while (enumerator5.MoveNext()) { string current5 = enumerator5.Current; string[] array4 = current5.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a3; if ((a3 = array4[1]) != null && a3 == "TS") { this.tsList.Add(Convert.ToInt32(array4[0]), new int[] { Convert.ToInt32(array4[2]), Convert.ToInt32(array4[3]) }); } } goto IL_A3C; } goto IL_5AE; IL_72D: using (List<string>.Enumerator enumerator6 = list.GetEnumerator()) { while (enumerator6.MoveNext()) { string current6 = enumerator6.Current; string[] array5 = current6.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a4; if ((a4 = array5[1]) != null && a4 == "F") { this.class228_3.Add(Convert.ToInt32(array5[0]), Convert.ToInt32(array5[2])); } } goto IL_A3C; } IL_7AC: using (List<string>.Enumerator enumerator7 = list.GetEnumerator()) { while (enumerator7.MoveNext()) { string current7 = enumerator7.Current; string[] array6 = current7.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a5; if ((a5 = array6[1]) != null && a5 == "B") { this.bpmList.Add(Convert.ToInt32(array6[0]), Convert.ToInt32(array6[2])); } } goto IL_A3C; } IL_82B: using (List<string>.Enumerator enumerator8 = list.GetEnumerator()) { while (enumerator8.MoveNext()) { string current8 = enumerator8.Current; string[] array7 = current8.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a6; if ((a6 = array7[1]) != null && a6 == "B") { this.class228_5.Add(Convert.ToInt32(array7[0]), Convert.ToInt32(array7[2])); } } goto IL_A3C; } goto IL_8AA; } goto IL_8AA; IL_A3C: list.Clear(); continue; IL_8AA: text = text.ToLower(); if (!this.noteList.ContainsKey(text)) { Track<int, NotesAtOffset> noteList = new Track<int, NotesAtOffset>(); Track<int, int[]> spList = new Track<int, int[]>(); Track<int, int[]> battleNote = new Track<int, int[]>(); foreach (string current9 in list) { string[] array8 = current9.Split(new char[] { ' ', '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); string a7; if ((a7 = array8[1]) != null) { if (!(a7 == "N")) { if (!(a7 == "S")) { if (a7 == "B") { battleNote.Add(Convert.ToInt32(array8[0]), new int[] { Convert.ToInt32(array8[3]), Convert.ToInt32(array8[2]) }); } } else { spList.Add(Convert.ToInt32(array8[0]), new int[] { Convert.ToInt32(array8[3]), Convert.ToInt32(array8[2]) }); } } else { noteList.Add(Convert.ToInt32(array8[0]), new NotesAtOffset(Convert.ToInt32(array8[2]), Convert.ToInt32(array8[3]))); } } } this.noteList.Add(text, noteList); this.spList.Add(text, spList); this.battleNoteList.Add(text, battleNote); goto IL_A3C; } goto IL_A3C; } else if (!currentLine.Equals("")) { list.Add(currentLine); } } } streamReader.Close(); }
private void method_5(Track<int, int[]> difficulty, Track<int, int> sp, Track<int, NotesAtOffset> notes) { foreach (int current in sp.Keys) { int num = this.calculateOffset(current); int num2 = 0; if (sp[current] == 0) { num2 = 1; } else { int num4 = 0; if ((sp.Keys[sp.method_1(current + sp[current])] > current)) { num4 = notes.Keys[notes.method_1(sp.Keys[sp.method_1(current + sp[current])] - 1)]; } else { num4 = (current + sp[current]); } int num3 = this.calculateOffset(num4); //int num3 = this.method_2((sp.Keys[sp.method_1(current + sp[current])] > current) ? notes.Keys[notes.method_1(sp.Keys[sp.method_1(current + sp[current])] - 1)] : (current + sp[current])); num2 = (num3 - num); } //int num2 = (sp[current] == 0) ? 1 : (this.method_2((sp.Keys[sp.method_1(current + sp[current])] > current) ? notes.Keys[notes.method_1(sp.Keys[sp.method_1(current + sp[current])] - 1)] : (current + sp[current])) - num); difficulty.Add(num, new int[] { num2, notes.method_3(current, current + sp[current]) }); } }
private void FNoteEdit_KeyDown(object sender, KeyEventArgs e) { ReDraw(); var Px = pos.X; var Py = pos.Y; if (e.KeyCode == Keys.Enter) { try { int o = 0; Note nt = new NoteQuarter(); Note[] NoteArray = new Note[Track.Notes.Count]; Track.Notes.CopyTo(NoteArray); int l = 0; bool ExitFromLoop = false; while (l < Line.Lines.Count) { var L = Line.Lines[l]; if (pos.Y + 3.5F == L.Y || pos.Y + 3F == L.Y) { bool isBreak = false; if (NoteArray.Length == 0) { nt = new NoteQuarter(ij, L); } else { while (o < NoteArray.Length) { if (NoteArray[o].X == pos.X) { int x = NoteArray[o].Xpos; var str = NoteArray[o].ToString(); int index = o; switch (str) { case "PauseSixteenth": Track.Notes.Remove(NoteArray[o]); nt = new NoteSixteenth(x, L); Track.Notes.Insert(index, nt); isBreak = true; break; case "PauseEighth": Track.Notes.Remove(NoteArray[o]); nt = new NoteEighth(x, L); Track.Notes.Insert(index, nt); isBreak = true; break; case "PauseWhole": Track.Notes.Remove(NoteArray[o]); nt = new NoteWhole(x, L); Track.Notes.Insert(index, nt); isBreak = true; break; case "PauseHalf": Track.Notes.Remove(NoteArray[o]); nt = new NoteHalf(x, L); Track.Notes.Insert(index, nt); isBreak = true; break; case "PauseQuarter": Track.Notes.Remove(NoteArray[o]); nt = new NoteQuarter(x, L); Track.Notes.Insert(index, nt); isBreak = true; break; default: nt = new NoteQuarter(ij, L); ExitFromLoop = true; break; } } else if (ExitFromLoop) { } else { nt = new NoteQuarter(ij, L); } if (isBreak) { break; } o++; } } try { if (isBreak) { } else { Track.Add(nt, ij); } } catch { } } l++; } if (nt.Name == MIDI_Library.Name.Pause) { Refresh(); } } catch { } Refresh(); ReDraw(); pos.Draw(Graphics); Graphics.Render(); } else if (e.KeyCode == Keys.Right) { if (pos.X >= Staff.WidthOfStaff) { pos.Y += 75; pos.X = 65; ih = ij; ij = 0; } else { pos.X += 30; ij++; } ReDraw(); pos.Draw(Graphics); Graphics.Render(); } else if (e.Control && e.KeyCode == Keys.S) { SaveSong(DocumentName); ReDraw(); } else if (e.KeyCode == Keys.Down) { if (pos.Y >= Staff.Staff_to_up - Staff.Between_staff_rows / 2 && pos.Y <= Staff.Staff_to_up + Staff.Between_staff_rows * 9 + Staff.Between_staff_rows / 2) { pos.Y += (float)Staff.Between_staff_rows / 2; } ReDraw(); pos.Draw(Graphics); Graphics.Render(); } else if (e.KeyCode == Keys.Left) { if (pos.Y > 60 - 3.5F) { if (pos.X <= 65) { pos.Y -= 75; pos.X = Staff.WidthOfStaff; ij = ih; } else { pos.X -= 30; ij--; } } ReDraw(); pos.Draw(Graphics); Graphics.Render(); } else if (e.KeyCode == Keys.Up) { if (pos.Y >= 50) { pos.DrawWhite(Graphics, Px, Py); pos.Y -= (float)Staff.Between_staff_rows / 2; } ReDraw(); pos.Draw(Graphics); Graphics.Render(); } else if (e.KeyCode == Keys.Delete) { int z = 0; int index = 0; int x = 0; var type = MIDI_Library.Type.Quarter; Note[] NoteArray = new Note[Track.Notes.Count]; Track.Notes.CopyTo(NoteArray); bool isBreak = false; for (int iv = 0; iv < Line.Lines.Count; iv++) { if (isBreak) { break; } else { var ln = Line.Lines[iv]; if (ln.ToString() == "Pause") { while (z < NoteArray.Length) { if ((NoteArray[z].Y == pos.Y && NoteArray[z].X == pos.X) || (NoteArray[z].Y == pos.Y - 0.5F && NoteArray[z].X == pos.X) || (NoteArray[z].Y == pos.Y + 3F && NoteArray[z].X == pos.X)) { index = z; type = NoteArray[z].Type; x = NoteArray[z].Xpos; switch (type) { case MIDI_Library.Type.Sixteenth: Track.Notes[z] = new PauseSixteenth(x, ln); isBreak = true; break; case MIDI_Library.Type.Quarter: Track.Notes[z] = new PauseQuarter(x, ln); isBreak = true; break; case MIDI_Library.Type.Eighth: Track.Notes[z] = new PauseEighth(x, ln); isBreak = true; break; case MIDI_Library.Type.Half: Track.Notes[z] = new PauseHalf(x, ln); isBreak = true; break; case MIDI_Library.Type.Whole: Track.Notes[z] = new PauseWhole(x, ln); isBreak = true; break; } if (isBreak) { break; } } z++; } } } } Refresh(); ReDraw(); pos.Draw(Graphics); Graphics.Render(); } else if (e.KeyCode == Keys.Add) { Note[] temp = new Note[Track.Notes.Count]; Track.Notes.CopyTo(temp); for (int n = 0; n < Track.Notes.Count; n++) { if ((Track.Notes[n].Y == pos.Y && Track.Notes[n].X == pos.X) || (Track.Notes[n].Y == pos.Y - 0.5F && Track.Notes[n].X == pos.X) || Track.Notes[n].Y == pos.Y + 3F && Track.Notes[n].X == pos.X) { var Ln = Track.Notes[n].CurrentLine; var xx = Track.Notes[n].Xpos; if (Track.Notes[n].Name != MIDI_Library.Name.Pause) { switch (Track.Notes[n].Type) { case MIDI_Library.Type.Quarter: Track.Notes[n] = new NoteEighth(xx, Ln); break; case MIDI_Library.Type.Half: Track.Notes[n] = new NoteQuarter(xx, Ln); break; case MIDI_Library.Type.Whole: Track.Notes[n] = new NoteHalf(xx, Ln); break; case MIDI_Library.Type.Eighth: Track.Notes[n] = new NoteSixteenth(xx, Ln); break; case MIDI_Library.Type.Sixteenth: break; default: break; } } else { switch (Track.Notes[n].Type) { case MIDI_Library.Type.Quarter: Track.Notes[n] = new PauseEighth(xx, Ln); break; case MIDI_Library.Type.Half: Track.Notes[n] = new PauseQuarter(xx, Ln); break; case MIDI_Library.Type.Whole: Track.Notes[n] = new PauseHalf(xx, Ln); break; case MIDI_Library.Type.Eighth: Track.Notes[n] = new PauseSixteenth(xx, Ln); break; case MIDI_Library.Type.Sixteenth: break; default: break; } } } } Refresh(); Track.Draw(Graphics); Graphics.Render(); } else if (e.KeyCode == Keys.OemMinus) { Refresh(); Note[] temp = new Note[Track.Notes.Count]; Track.Notes.CopyTo(temp); for (int n = 0; n < Track.Notes.Count; n++) { if ((Track.Notes[n].Y == pos.Y && Track.Notes[n].X == pos.X) || (Track.Notes[n].Y == pos.Y - 0.5F && Track.Notes[n].X == pos.X) || (Track.Notes[n].Y == pos.Y + 3F && Track.Notes[n].X == pos.X)) { var Ln = Track.Notes[n].CurrentLine; var xx = Track.Notes[n].Xpos; if (Track.Notes[n].Name != MIDI_Library.Name.Pause) { switch (Track.Notes[n].Type) { case MIDI_Library.Type.Quarter: Track.Notes[n] = new NoteHalf(xx, Ln); break; case MIDI_Library.Type.Half: Track.Notes[n] = new NoteWhole(xx, Ln); break; case MIDI_Library.Type.Sixteenth: Track.Notes[n] = new NoteEighth(xx, Ln); break; case MIDI_Library.Type.Eighth: Track.Notes[n] = new NoteQuarter(xx, Ln); break; case MIDI_Library.Type.Whole: break; default: break; } } else { switch (Track.Notes[n].Type) { case MIDI_Library.Type.Quarter: Track.Notes[n] = new PauseHalf(xx, Ln); break; case MIDI_Library.Type.Half: Track.Notes[n] = new PauseWhole(xx, Ln); break; case MIDI_Library.Type.Sixteenth: Track.Notes[n] = new PauseEighth(xx, Ln); break; case MIDI_Library.Type.Eighth: Track.Notes[n] = new PauseQuarter(xx, Ln); break; case MIDI_Library.Type.Whole: break; default: break; } } } } Refresh(); ReDraw(); Graphics.Render(); } else if ((e.Shift) && e.KeyCode == Keys.Space) { if (ThreadPlayFromStart == null) { ThreadPlayFromStart = new Thread(PlayTrack); ThreadPlayFromStart.Start(); } else { ThreadPlayFromStart.Abort(); ThreadPlayFromStart = null; } } else if ((e.Control) && e.KeyCode == Keys.Space) { ThreadFromPosition = new Thread(PlayTrackFromPosition); ThreadFromPosition.Start(); } else { ReDraw(); } }
private void method_4(Track<int, NotesAtOffset> class228_1, Track<int, NotesAtOffset> class228_2) { foreach (int current in class228_2.Keys) { int num = this.calculateOffset(current); int int_ = (class228_2[current].sustainLength == 0) ? 1 : (this.calculateOffset(current + class228_2[current].sustainLength) - num); if (class228_1.ContainsKey(num)) { for (int i = 0; i < 32; i++) { if (class228_2[current].noteValues[i]) { class228_1[num].noteValues[i] = true; } } } else { class228_1.Add(num, new NotesAtOffset(class228_2[current].noteValues, int_)); } } }