Class MidiTokensReader
Provides a way to read a MIDI file sequentially token by token keeping
low memory consumption. See
Lazy reading/writing article to learn more.
Implements
Inherited Members
Namespace: Melanchall.DryWetMidi.Core
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class MidiTokensReader : IDisposable
Methods
Dispose()
Releases all resources used by the current MidiTokensReader.
Declaration
public void Dispose()
ReadToken()
Reads a next MIDI token from the underlying stream.
Declaration
public MidiToken ReadToken()
Returns
Type | Description |
---|---|
MidiToken | An instance of the MidiToken. |
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurred while reading the file. |
NoHeaderChunkException | There is no header chunk in a file and that should be treated as error according to the NoHeaderChunkPolicy of the used settings. |
InvalidChunkSizeException | Actual header or track chunk's size differs from the one declared in its header and that should be treated as error according to the InvalidChunkSizePolicy of the used settings. |
UnknownChunkException | Chunk to be read has unknown ID and that should be treated as error according to the UnknownChunkIdPolicy of the used settings. |
UnexpectedTrackChunksCountException | Actual track chunks count differs from the expected one (declared in the file header) and that should be treated as error according to the UnexpectedTrackChunksCountPolicy of the used settings. |
UnknownFileFormatException | The header chunk of the file specifies unknown file format and that should be treated as error according to the UnknownFileFormatPolicy of the used settings. |
InvalidChannelEventParameterValueException | Value of a channel event's parameter just read is invalid (is out of [0; 127] range) and that should be treated as error according to the InvalidChannelEventParameterValuePolicy of the used settings. |
InvalidMetaEventParameterValueException | Value of a meta event's parameter just read is invalid and that should be treated as error according to the InvalidMetaEventParameterValuePolicy of the used settings. |
UnknownChannelEventException | Reader has encountered an unknown channel event and that should be treated as error according to the UnknownChannelEventPolicy of the used settings. |
NotEnoughBytesException | MIDI file data cannot be read since the reader's underlying stream doesn't have enough bytes and that should be treated as error according to the NotEnoughBytesPolicy of the used settings. |
UnexpectedRunningStatusException | Unexpected running status is encountered. |
MissedEndOfTrackEventException | Track chunk doesn't end with End Of Track event and that
should be treated as error according to the MissedEndOfTrackPolicy of
the used settings. |
InvalidOperationException | Buffer of the used settings
is null in case of BufferingPolicy set to
UseCustomBuffer. |