Class MidiTokensWriter
Provides a way to write data to 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 MidiTokensWriter : IDisposable
Methods
Dispose()
Releases all resources used by the current MidiTokensWriter
and also flushes all remaining data to the underlying stream.
Declaration
public void Dispose()
EndTrackChunk()
Ends the current track chunk.
Declaration
public void EndTrackChunk()
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurred while writing the file. |
StartTrackChunk()
Starts a new track chunk writing the chunk's header.
Declaration
public void StartTrackChunk()
Remarks
If the current track chunk is not ended properly via EndTrackChunk(),
the EndTrackChunk() method will be called automatically on StartTrackChunk()
called.
Exceptions
Type | Condition |
---|---|
IOException | An I/O error occurred while writing the file. |
WriteChunk(MidiChunk)
Writes the specified chunk.
Declaration
public void WriteChunk(MidiChunk chunk)
Parameters
Type | Name | Description |
---|---|---|
MidiChunk | chunk | A chunk to write. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | chunk is null . |
IOException | An I/O error occurred while writing the file. |
InvalidOperationException | Another chunk is being written, end it first. |
WriteEvent(MidiEvent)
Writes the specified MIDI event.
Declaration
public void WriteEvent(MidiEvent midiEvent)
Parameters
Type | Name | Description |
---|---|---|
MidiEvent | midiEvent |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | midiEvent is null . |
IOException | An I/O error occurred while writing the file. |
InvalidOperationException | One of the following errors occurred:
|