Exemple #1
0
        private void ParseSysCommonMessage()
        {
            if (trackIndex >= trackData.Length)
            {
                throw new MidiFileException("End of track unexpectedly reached.");
            }

            // 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.");
                }

                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);
        }
Exemple #2
0
 /// <summary>
 /// Builds a song position pointer message.
 /// </summary>
 public void Build()
 {
     builder.Build();
 }