public BufferByteReader(DiskReadProvider stream, int buffersize, long streamstart, long streamlen) { if (buffersize > streamlen) { buffersize = (int)streamlen; } this.bufferSize = buffersize; buffer = new byte[buffersize]; bufferNext = new byte[buffersize]; this.streamStart = streamstart; this.streamLen = streamlen; this.stream = stream; UpdateBuffer(pos, true); }
public MidiFile(Stream stream, int readBufferSize) { reader = stream; ParseHeaderChunk(); List <MidiChunkPointer> tracks = new List <MidiChunkPointer>(); while (reader.Position < reader.Length) { ParseTrackChunk(tracks); } TrackLocations = tracks.ToArray(); TrackCount = TrackLocations.Length; readProvider = new DiskReadProvider(stream); }