Class MidiReader
Reader of the MIDI data types.
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class MidiReader : IDisposable
Constructors
MidiReader(Stream, ReaderSettings)
Initializes a new instance of the
MidiReader with the specified stream.
Declaration
public MidiReader(Stream stream, ReaderSettings settings)
Parameters
| Type |
Name |
Description |
| Stream |
stream |
Stream to read MIDI file from. |
| ReaderSettings |
settings |
Settings according to which MIDI data should be read. |
Exceptions
Properties
EndReached
Gets a value indicating whether end of the underlying stream is reached.
Declaration
public bool EndReached { get; }
Property Value
Exceptions
Length
Gets length of the underlying stream.
Declaration
public long Length { get; }
Property Value
Position
Gets or sets the position within the underlying stream.
Declaration
public long Position { get; set; }
Property Value
Exceptions
Methods
Dispose()
Releases all resources used by the current instance of the
MidiReader class.
Declaration
Read3ByteDword()
Reads a DWORD value (32-bit unsigned integer) presented by 3 bytes from the underlying
stream and advances the current position by three bytes.
Declaration
public uint Read3ByteDword()
Returns
| Type |
Description |
| uint |
A 32-bit unsigned integer read from the underlying stream. |
Exceptions
ReadByte()
Reads a byte from the underlying stream and advances the current position by one byte.
Declaration
Returns
| Type |
Description |
| byte |
The next byte read from the underlying stream. |
Exceptions
ReadBytes(int)
Reads the specified number of bytes from the underlying stream into a byte array
and advances the current position by that number of bytes.
Declaration
public byte[] ReadBytes(int count)
Parameters
| Type |
Name |
Description |
| int |
count |
The number of bytes to read. This value must be 0 or a
non-negative number or an exception will occur. |
Returns
| Type |
Description |
| byte[] |
A byte array containing data read from the underlying stream. This might be less
than the number of bytes requested if the end of the stream is reached. |
Exceptions
ReadDword()
Reads a DWORD value (32-bit unsigned integer) from the underlying stream and
advances the current position by four bytes.
Declaration
Returns
| Type |
Description |
| uint |
A 32-bit unsigned integer read from the underlying stream. |
Exceptions
ReadInt16()
Reads an INT16 value (16-bit signed integer) from the underlying stream and
advances the current position by two bytes.
Declaration
Returns
| Type |
Description |
| short |
A 16-bit signed integer read from the underlying stream. |
Exceptions
ReadSByte()
Reads a signed byte from the underlying stream and advances the current position by one byte.
Declaration
Returns
| Type |
Description |
| sbyte |
A signed byte read from the underlying stream. |
Exceptions
ReadString(int)
Reads the specified number of characters from the underlying stream, returns the
data as string, and advances the current position by that number of characters.
Declaration
public string ReadString(int count)
Parameters
| Type |
Name |
Description |
| int |
count |
The length of string to read. |
Returns
| Type |
Description |
| string |
The string being read. |
Exceptions
ReadVlqLongNumber()
Reads a 64-bit signed integer presented in compressed format called variable-length quantity (VLQ)
to the underlying stream.
Declaration
public long ReadVlqLongNumber()
Returns
| Type |
Description |
| long |
A 64-bit signed integer read from the underlying stream. |
Exceptions
ReadVlqNumber()
Reads a 32-bit signed integer presented in compressed format called variable-length quantity (VLQ)
to the underlying stream.
Declaration
public int ReadVlqNumber()
Returns
| Type |
Description |
| int |
A 32-bit signed integer read from the underlying stream. |
Exceptions
ReadWord()
Reads a WORD value (16-bit unsigned integer) from the underlying stream and
advances the current position by two bytes.
Declaration
Returns
| Type |
Description |
| ushort |
A 16-bit unsigned integer read from the underlying stream. |
Exceptions
Implements