private void ParseSysCommonMessage() { if (trackIndex >= trackData.Length) { //throw new MidiFileException("End of track unexpectedly reached."); Console.Write("\nERROR: End of track unexpectedly reached (TrackReader.cs ParseSysCommonMessage)"); return; } // System common cancels running status. runningStatus = 0; scBuilder.Type = (SysCommonType)status; switch ((SysCommonType)status) { case SysCommonType.MidiTimeCode: scBuilder.Data1 = trackData[trackIndex]; trackIndex++; break; case SysCommonType.SongPositionPointer: scBuilder.Data1 = trackData[trackIndex]; trackIndex++; if (trackIndex >= trackData.Length) { //throw new MidiFileException("End of track unexpectedly reached."); Console.Write("\nERROR: End of track unexpectedly reached (TrackReader.cs ParseSysCommonMessage)"); return; } scBuilder.Data2 = trackData[trackIndex]; trackIndex++; break; case SysCommonType.SongSelect: scBuilder.Data1 = trackData[trackIndex]; trackIndex++; break; case SysCommonType.TuneRequest: // Nothing to do here. break; } scBuilder.Build(); newTrack.Insert(ticks, scBuilder.Result); }
/// <summary> /// Builds a song position pointer message. /// </summary> public void Build() { builder.Build(); }