Search Results for

    Show / Hide Table of Contents

    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.
    Inheritance
    object
    MidiTokensWriter
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    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:
    • A track chunk is not started (see StartTrackChunk()).
    • midiEvent is of EndOfTrackEvent type but previously written event is of the same type, writing of two End of Track events is prohibited.

    Implements

    IDisposable

    See Also

    MidiTokensReader
    In this article
    Back to top 2024 / Generated by DocFX