public void Read(Stream strm) { stream = strm; // FAB : 27/07/2014 if (FindTrack() != -1) { int trackLength = GetTrackLength(); trackData = new byte[trackLength]; int result = strm.Read(trackData, 0, trackLength); if (result < 0) { throw new MidiFileException("End of MIDI file unexpectedly reached."); } newTrack = new Track(); ParseTrackData(); track = newTrack; track.checkNotes(); } else { track = null; } }